From 59f46464d59d2da4e312fcd270bd9b19fa81075c Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 30 Aug 2018 21:44:18 +0000 Subject: [PATCH] build-sys: work around broken linker when testing --version-script support The linker on FreeBSD seems to be broken and fails for other reasons when testing for support of the --version-script flag. The error that is reported is: local symbol 'environ' in /usr/lib/crt1.o is referenced by DSO. Also __progname is needed. To work around this problem we add a test.syms file that only has these two symbols in it, which is enough for the test in configure.ac and gives version script support in case of the broken linker. On FreeBSD TPM 1.2 related tests were failing due to test case 6 failures in case no linker script was used. (Very odd.) This patch fixes this problem. Signed-off-by: Stefan Berger --- configure.ac | 2 +- src/Makefile.am | 3 ++- src/test.syms | 9 +++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/test.syms diff --git a/configure.ac b/configure.ac index e33ecc73..1212872a 100644 --- a/configure.ac +++ b/configure.ac @@ -59,7 +59,7 @@ if test "$DEBUG" = "yes"; then fi AC_SUBST(DEBUG_DEFINES, $debug_defines) -AX_CHECK_LINK_FLAG([-Wl,--version-script=$srcdir/src/libtpms.syms], +AX_CHECK_LINK_FLAG([-Wl,--version-script=$srcdir/src/test.syms], [have_version_script="yes"], [have_version_script="no"]) AM_CONDITIONAL([HAVE_VERSION_SCRIPT], [test "x$have_version_script" = "xyes"]) diff --git a/src/Makefile.am b/src/Makefile.am index 0e046e69..98ce0109 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -588,6 +588,7 @@ check-local: EXTRA_DIST = \ tpm12/tpm_crypto_freebl.c \ tpm12/tpm_crypto.c \ - libtpms.syms + libtpms.syms \ + test.syms CLEANFILES = a.out diff --git a/src/test.syms b/src/test.syms new file mode 100644 index 00000000..40cdd2e5 --- /dev/null +++ b/src/test.syms @@ -0,0 +1,9 @@ +# Symbol file for the linker. For testing in configure.ac only +TEST { + global: + # two work-around for a broken link + environ; + __progname; + local: + *; +};