btrfs-progs: build: fix building libbtrfs.so with tsan
authorDavid Sterba <dsterba@suse.com>
Mon, 28 Aug 2017 11:33:19 +0000 (13:33 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2017 14:15:05 +0000 (16:15 +0200)
Except libbtrfs.so object, all other tools compile fine. The error is:

ld: send-stream.o: relocation R_X86_64_PC32 against symbol
`stderr@@GLIBC_2.2.5' can not be used when making a shared object;
recompile with -fPIC

Compiling with -fPIC fixes the problem.

Signed-off-by: David Sterba <dsterba@suse.com>
Makefile

index 3d55203..3bc9bb4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -167,7 +167,7 @@ ifneq (,$(findstring asan,$(D)))
 endif
 
 ifneq (,$(findstring tsan,$(D)))
-  DEBUG_CFLAGS_INTERNAL += -fsanitize=thread -fPIE
+  DEBUG_CFLAGS_INTERNAL += -fsanitize=thread -fPIC
   DEBUG_LDFLAGS_INTERNAL += -fsanitize=thread -ltsan -pie
 endif