summaryrefslogtreecommitdiff
path: root/tools/check-exports.sh
blob: b5a9e952b524ecc7f4a4585c00f93536240193b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

LC_ALL=C
export LC_ALL

stat=0
so=$1
def=$2

# Have to prefix with a tab and suffix with a ';' to match .ver file format
get_syms='nm "$so" | grep "^[[:xdigit:]]\+ T " | sed "s/^[[:xdigit:]]\+ T //" | sed "s/^/\t/" | sed "s/$/;/"'

echo $so: checking exported symbols against $def

{
	echo "{"
	echo "global:"
	eval $get_syms | sort -u
	echo "local:"
	echo "	*;"
	echo "};"
} | diff -u "$def" - >&2 || stat=1

exit $stat