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 <stefanb@linux.vnet.ibm.com>
This commit is contained in:
Stefan Berger 2018-08-30 21:44:18 +00:00
parent b52c19e171
commit 59f46464d5
3 changed files with 12 additions and 2 deletions

View File

@ -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"])

View File

@ -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

9
src/test.syms Normal file
View File

@ -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:
*;
};