Hi,

 Riku Voipio told me make check was failing on ARM; see:
 
http://experimental.debian.net/fetch.php?&pkg=mpeg2dec&ver=0.5.1-1&arch=armel&stamp=1229436558&file=log&as=raw
 these are symbols in an ARM specific assembly file.  See attached patch
 60_arm-private-symbols for a fix.

 However even with this patch, the testsuite doesn't pass because a) it
 checks all object files instead of the final object files (i.e. the
 libs) and b) it uses nm which will report all global symbols in object
 files, ignoring the visibility attribute (these symbols are necessarily
 globals, yet aren't part of the ABI because they are of internal
 visibility).

 So I rewrote the globals test to verify the shared libraries, to check
 for more things, and to avoid duplication.  See attached patch
 61_global-symbol-test.  Note however than in a --disable-shared build,
 this test is now a no-op.  I think that's good enough as I expect
 distros and upstream releases to make check with shared libs enabled.
 If we want to run this check on static libraries, it will need to be
 based on something else than nm, perhaps objdump, and is likely to be
 more complex (objdump output is more complex and we need to test for
 scope and visibility ourselves).

   Cheers,
-- 
Loïc Minier
Set visibility of global symbols used in ARM specific assembly file to
internal; spotted my make check on armel; thanks Riku Voipio for the report.

--- a/libmpeg2/motion_comp_arm_s.S
+++ b/libmpeg2/motion_comp_arm_s.S
@@ -23,7 +23,8 @@
 
 @ ----------------------------------------------------------------
 	.align
-	.global MC_put_o_16_arm
+	.global   MC_put_o_16_arm
+	.internal MC_put_o_16_arm
 MC_put_o_16_arm:
 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
 	pld [r1]
@@ -83,7 +84,8 @@
 
 @ ----------------------------------------------------------------
 	.align
-	.global MC_put_o_8_arm
+	.global   MC_put_o_8_arm
+	.internal MC_put_o_8_arm
 MC_put_o_8_arm:
 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
 	pld [r1]
@@ -152,7 +154,8 @@
 .endm
 
 	.align
-	.global MC_put_x_16_arm
+	.global   MC_put_x_16_arm
+	.internal MC_put_x_16_arm
 MC_put_x_16_arm:
 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
 	pld [r1]
@@ -244,7 +247,8 @@
 
 @ ----------------------------------------------------------------
 	.align
-	.global MC_put_x_8_arm
+	.global   MC_put_x_8_arm
+	.internal MC_put_x_8_arm
 MC_put_x_8_arm:
 	@@ void func(uint8_t * dest, const uint8_t * ref, int stride, int height)
 	pld [r1]
Rewrite the public symbol check to verify the shared libraries, to check for
more things, and to avoid duplication; fixes make check on ARM

--- a/test/globals
+++ b/test/globals
@@ -1,4 +1,8 @@
 #!/bin/sh
+# TODO
+# - fix checking of .a libs; problem is that "nm -g --defined-only" lists
+#   internal symbols; this can be solved by using objdump, but it's probably
+#   good enough to just run the tests on the shared lib
 
 if test x"$srcdir" != x""; then
     builddir="."	# running from make check, but it does not define that
@@ -14,22 +18,30 @@
 
 error=0
 
-bad_globals=`nm -g --defined-only $builddir/../libmpeg2/*.o |\
-    awk '{if ($3) print $3}' | grep -v '^_\?mpeg2_'`
-
-if test x"$bad_globals" != x""; then
-    echo BAD GLOBAL SYMBOLS:
-    for s in $bad_globals; do echo $s; done
+# check_bad_public_symbols <symbol prefix> <lib file> [<lib file>...]
+#
+# checks public symbols in shared libs:
+# - allow prefix_anything
+# - reject _prefixanything
+# - allow _anything
+# - reject anything else
+#
+# NB: skips missing files
+check_bad_public_symbols() {
+    symbols_prefix="$1"
+    shift
+    lib_files=`ls "$@" 2>/dev/null`
+    [ -z "$lib_files" ] && return
+    bad_globals=`nm -g --defined-only $lib_files |
+        awk '{if ($3) print $3}' |
+        sed -n "/^${symbols_prefix}_/ d; /^_${symbols_prefix}/ { p; d }; /^_/ d; p"`
+    [ -z "$bad_globals" ] && return
     error=1
-fi
-
-bad_globals=`nm -g --defined-only $builddir/../libmpeg2/convert/*.o |\
-    awk '{if ($3) print $3}' | grep -v '^_\?mpeg2convert_'`
+    echo BAD GLOBAL SYMBOLS in $lib_files:
+    echo "$bad_globals"
+}
 
-if test x"$bad_globals" != x""; then
-    echo BAD GLOBAL SYMBOLS:
-    for s in $bad_globals; do echo $s; done
-    error=1
-fi
+check_bad_public_symbols mpeg2 $builddir/../libmpeg2/.libs/libmpeg2.so
+check_bad_public_symbols mpeg2convert $builddir/../libmpeg2/convert/.libs/libmpeg2convert.so
 
 exit $error
------------------------------------------------------------------------------
_______________________________________________
Libmpeg2-devel mailing list
Libmpeg2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmpeg2-devel

Reply via email to