diff options
Diffstat (limited to 'tests/abicheck.sh')
-rwxr-xr-x | tests/abicheck.sh | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/abicheck.sh b/tests/abicheck.sh new file mode 100755 index 0000000..49291bd --- /dev/null +++ b/tests/abicheck.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +# The following checks that a given binary only defines the symbols +# specified +# +# We also make sure to ignore gcov symbols included when building with +# --coverage, which usually means the following: +# +# __gcov_error_file +# __gcov_master +# __gcov_sort_n_vals +# __gcov_var +# +# And starting with gcc-9, also this one: +# +# mangle_path + +set -x + +if test $# != 2; then + echo " Usage: $0 <binary> <symbol_file>" + echo " symbol_file is a file where each line is the name of an exported symbol" + exit 1 +fi + +BINARY="$1" +SYMBOL_FILE="$2" + +${NM:-nm} --dynamic --defined-only "$BINARY" | \ + cut -f 3 -d ' ' | \ + grep -v ^_ | \ + grep -v ^mangle_path | \ + diff "$SYMBOL_FILE" - |