diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2014-08-19 09:16:39 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-08-25 10:06:48 +1000 |
commit | 31113e6038a6ba4d8504f6329fb99b9adc4d58c2 (patch) | |
tree | 3f10aac5cc7e6ce78aea5b7b4df17a6583a17992 | |
parent | 6d3c994694f7ab82d7e65084332b17d8aeded829 (diff) | |
download | libevdev-31113e6038a6ba4d8504f6329fb99b9adc4d58c2.tar.gz |
Hook up nm to check for leaking symbols in the static library
We ignore anything that starts with an underscore, anything that starts with
libevdev and main (since we test the test-static-link binary) and a couple of
gcov-related functions. This should catch any functions we accidentally
export.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | configure.ac | 17 | ||||
-rw-r--r-- | test/Makefile.am | 22 |
2 files changed, 35 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 4781434..bb4bbbb 100644 --- a/configure.ac +++ b/configure.ac @@ -125,6 +125,16 @@ AC_MSG_RESULT([$enable_gcov]) AM_PATH_PYTHON([2.6]) +# nm to check for leaking symbols in the static library +AC_PATH_PROG(NM, [nm]) +AM_CONDITIONAL(HAVE_NM, [test "x$NM" != "x"]) +if test "x$NM" == "x"; then + AC_MSG_WARN([nm not found - skipping symbol leak test]) + have_nm="no" +else + have_nm="yes" +fi + AC_CONFIG_FILES([Makefile libevdev/Makefile doc/Makefile @@ -136,7 +146,8 @@ AC_CONFIG_FILES([Makefile AC_OUTPUT AC_MSG_RESULT([ - Build documentation ${have_doxygen} - Build unit-tests ${HAVE_CHECK} - Enable profiling ${enable_gcov} + Build documentation ${have_doxygen} + Build unit-tests ${HAVE_CHECK} + Enable profiling ${enable_gcov} + Static library symbol check ${have_nm} ]) diff --git a/test/Makefile.am b/test/Makefile.am index 992ce4f..0781d72 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -119,6 +119,26 @@ endif clean-local: gcov-clean rm -f *.gcno *.gcda -check-local: $(check_local_deps) +if HAVE_NM +# Hack to check for leaking symbols in the static library. +# See https://bugs.freedesktop.org/show_bug.cgi?id=82785 +# Note the spaces in the expressions! After the first grep, each line +# is " T symbol_name" +static-symbol-leaks: test-static-link + $(AM_V_GEN)(\ + $(NM) --extern-only $(builddir)/test-static-link | \ + grep -o -e " T .*" | \ + grep -v -e " main$$" \ + -e " atexit" \ + -e " *gcov.*" \ + -e " _.*" \ + -e " libevdev_*" && \ + echo "Leaking symbols found" && \ + exit 1 || exit 0 \ + ) +check_local_deps += static-symbol-leaks +endif + +check-local: $(check_local_deps) endif |