|
| 1 | +Rewrite the public symbol check to verify the shared libraries, to check for |
| 2 | +more things, and to avoid duplication; fixes make check on ARM |
| 3 | + |
| 4 | +--- a/test/globals |
| 5 | ++++ b/test/globals |
| 6 | +@@ -1,4 +1,8 @@ |
| 7 | + #!/bin/sh |
| 8 | ++# TODO |
| 9 | ++# - fix checking of .a libs; problem is that "nm -g --defined-only" lists |
| 10 | ++# internal symbols; this can be solved by using objdump, but it's probably |
| 11 | ++# good enough to just run the tests on the shared lib |
| 12 | + |
| 13 | + if test x"$srcdir" != x""; then |
| 14 | + builddir="." # running from make check, but it does not define that |
| 15 | +@@ -14,22 +18,30 @@ |
| 16 | + |
| 17 | + error=0 |
| 18 | + |
| 19 | +-bad_globals=`nm -g --defined-only $builddir/../libmpeg2/*.o |\ |
| 20 | +- awk '{if ($3) print $3}' | grep -v '^_\?mpeg2_'` |
| 21 | +- |
| 22 | +-if test x"$bad_globals" != x""; then |
| 23 | +- echo BAD GLOBAL SYMBOLS: |
| 24 | +- for s in $bad_globals; do echo $s; done |
| 25 | ++# check_bad_public_symbols <symbol prefix> <lib file> [<lib file>...] |
| 26 | ++# |
| 27 | ++# checks public symbols in shared libs: |
| 28 | ++# - allow prefix_anything |
| 29 | ++# - reject _prefixanything |
| 30 | ++# - allow _anything |
| 31 | ++# - reject anything else |
| 32 | ++# |
| 33 | ++# NB: skips missing files |
| 34 | ++check_bad_public_symbols() { |
| 35 | ++ symbols_prefix="$1" |
| 36 | ++ shift |
| 37 | ++ lib_files=`ls "$@" 2>/dev/null` |
| 38 | ++ [ -z "$lib_files" ] && return |
| 39 | ++ bad_globals=`nm -g --defined-only $lib_files | |
| 40 | ++ awk '{if ($3) print $3}' | |
| 41 | ++ sed -n "/^${symbols_prefix}_/ d; /^_${symbols_prefix}/ { p; d }; /^_/ d; p"` |
| 42 | ++ [ -z "$bad_globals" ] && return |
| 43 | + error=1 |
| 44 | +-fi |
| 45 | +- |
| 46 | +-bad_globals=`nm -g --defined-only $builddir/../libmpeg2/convert/*.o |\ |
| 47 | +- awk '{if ($3) print $3}' | grep -v '^_\?mpeg2convert_'` |
| 48 | ++ echo BAD GLOBAL SYMBOLS in $lib_files: |
| 49 | ++ echo "$bad_globals" |
| 50 | ++} |
| 51 | + |
| 52 | +-if test x"$bad_globals" != x""; then |
| 53 | +- echo BAD GLOBAL SYMBOLS: |
| 54 | +- for s in $bad_globals; do echo $s; done |
| 55 | +- error=1 |
| 56 | +-fi |
| 57 | ++check_bad_public_symbols mpeg2 $builddir/../libmpeg2/.libs/libmpeg2.so |
| 58 | ++check_bad_public_symbols mpeg2convert $builddir/../libmpeg2/convert/.libs/libmpeg2convert.so |
| 59 | + |
| 60 | + exit $error |
0 commit comments