]> asedeno.scripts.mit.edu Git - linux.git/commit
radix tree test suite: Fix build with --as-needed
authorMichael Ellerman <mpe@ellerman.id.au>
Thu, 2 Mar 2017 09:29:00 +0000 (04:29 -0500)
committerMatthew Wilcox <mawilcox@microsoft.com>
Tue, 7 Mar 2017 18:18:22 +0000 (13:18 -0500)
commit284d96a494d705b9c5330c900e976fceda885b9f
treee5be3d1096522234f28a05b13f4ca58506807842
parentc4634b08d9eb9c13be2296230bf33c79390dbf9c
radix tree test suite: Fix build with --as-needed

Currently the radix tree test suite doesn't build with toolchains that
use --as-needed by default, for example Ubuntu's:

  cc -I. -I../../include -g -O2 -Wall -D_LGPL_SOURCE -fsanitize=address -lpthread -lurcu main.o ... -o main
  /usr/bin/ld: regression1.o: undefined reference to symbol 'pthread_join@@GLIBC_2.17'
  /lib/powerpc64le-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
  collect2: error: ld returned 1 exit status

This is caused by the custom makefile rules placing LDFLAGS before the
.o files that need the libraries.

We could fix it by using --no-as-needed, or rewriting the custom rules.
But we can also just drop the custom rules and move the libraries to
LDLIBS, and then the default rules work correctly - with the one caveat
that we need to add -fsanitize=address to LDFLAGS because that must be
passed to the linker as well as the compiler.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Matthew Wilcox <mawilcox@microsoft.com>
tools/testing/radix-tree/Makefile