From c0903f871e79d7dcec02deb2e2121be6bce16d9b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 26 Aug 2013 13:28:13 -0400 Subject: [PATCH] Fix: test_seek static linking ./configure --disable-shared --enable-static make make check The make check fails for test_seek. Fix this by ensuring that test_seek has a dependency on libbabeltrace and libbabeltrace-ctf. This is a temporary work-around until we improve our plugin handling. Signed-off-by: Mathieu Desnoyers --- tests/lib/Makefile.am | 4 ++++ tests/lib/test_seek.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/lib/Makefile.am b/tests/lib/Makefile.am index 763b7bc0..849767a7 100644 --- a/tests/lib/Makefile.am +++ b/tests/lib/Makefile.am @@ -6,6 +6,10 @@ LIBTAP=$(top_builddir)/tests/utils/tap/libtap.la libtestcommon_a_SOURCES = common.c common.h +# -Wl,--no-as-needed is needed for recent gold linker who seems to think +# it knows better and considers libraries with constructors having +# side-effects as dead code. +test_seek_LDFLAGS = -Wl,--no-as-needed test_seek_LDADD = $(LIBTAP) libtestcommon.a \ $(top_builddir)/lib/libbabeltrace.la \ $(top_builddir)/formats/ctf/libbabeltrace-ctf.la diff --git a/tests/lib/test_seek.c b/tests/lib/test_seek.c index b33f80dc..170c830d 100644 --- a/tests/lib/test_seek.c +++ b/tests/lib/test_seek.c @@ -23,6 +23,7 @@ #include #include #include +#include /* For symbol side-effects */ #include #include @@ -273,6 +274,13 @@ int main(int argc, char **argv) uint64_t expected_begin; uint64_t expected_last; + /* + * Side-effects ensuring libs are not optimized away by static + * linking. + */ + babeltrace_debug = 0; /* libbabeltrace.la */ + opt_clock_offset = 0; /* libbabeltrace-ctf.la */ + plan_tests(NR_TESTS); if (argc < 4) { -- 2.34.1