summaryrefslogtreecommitdiff
path: root/tools/check-exports.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tools/check-exports.sh')
-rwxr-xr-xtools/check-exports.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/check-exports.sh b/tools/check-exports.sh
new file mode 100755
index 000000000..1415e1448
--- /dev/null
+++ b/tools/check-exports.sh
@@ -0,0 +1,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='( objdump -t "$so" | grep "^[^ ]* [^l.*]*[.]"; objdump -t "$so" | grep "[.]hidden.*"; ) | sed "s/.* //" | 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
+