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