Commit fa94aa2044c2f709a09c15c552dd6b6c8ac8db11

Steffen Jaeckel 2020-09-13T15:26:42

add travis job to compare symbols of dynamic libraries

diff --git a/.travis.yml b/.travis.yml
index d8aa885..4c6e557 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -72,6 +72,13 @@ matrix:
           packages:
             - astyle
 
+    # Check public symbols of dynamic libraries
+    - env: BUILDOPTIONS='--symbols'
+      addons:
+        apt:
+          packages:
+            - libtool-bin
+
     # Run always with valgrind (no sanitizer, but debug info)
     - env: COMPILE_DEBUG=1 BUILDOPTIONS='--with-cc=gcc-4.9 --with-m64 --with-valgrind'
       addons:
diff --git a/testme.sh b/testme.sh
index 1a03f55..41a165b 100755
--- a/testme.sh
+++ b/testme.sh
@@ -195,6 +195,7 @@ VALGRIND_OPTS=" --leak-check=full --show-leak-kinds=all --error-exitcode=1 "
 #VALGRIND_OPTS=""
 VALGRIND_BIN=""
 CHECK_FORMAT=""
+CHECK_SYMBOLS=""
 C89=""
 C89_C99_ROUNDTRIP=""
 TUNE_CMD="./etc/tune -t -r 10 -L 3"
@@ -276,6 +277,9 @@ do
     --format)
       CHECK_FORMAT="1"
     ;;
+    --symbols)
+      CHECK_SYMBOLS="1"
+    ;;
     --all)
       COMPILERS="gcc clang"
       ARCHFLAGS="-m64 -m32 -mx32"
@@ -309,6 +313,25 @@ then
   exit $?
 fi
 
+if [[ "$CHECK_SYMBOLS" == "1" ]]
+then
+  make -f makefile.shared
+  cat << EOF
+
+
+The following list shows the discrepancy between
+the shared library and the Windows dynamic library.
+To fix this error, one of the following things
+has to be done:
+* the script which generates tommath.def has to be modified
+    (function generate_def() in helper.pl).
+* The exported symbols are really different for some reason
+    This has to be manually investigated.
+
+EOF
+  exit $(comm -3 <(nm -D --defined-only .libs/libtommath.so | cut -d' ' -f3 | grep -v '^_' | sort) <(tail -n+9 tommath.def | tr -d ' ' | sort) | tee /dev/tty | wc -l)
+fi
+
 if [[ "$CHECK_FORMAT" == "1" ]]
 then
   make astyle