btrfs-progs: build: fix asan and ubsan build
authorDavid Sterba <dsterba@suse.com>
Mon, 28 Aug 2017 11:38:32 +0000 (13:38 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2017 14:15:05 +0000 (16:15 +0200)
Probably with a new gcc (7.1.1) I started to see asan/ubsan link failures.
Fixed by explicitly linking the libraries.

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

index 3bc9bb4..62c535c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -164,6 +164,7 @@ endif
 
 ifneq (,$(findstring asan,$(D)))
   DEBUG_CFLAGS_INTERNAL += -fsanitize=address
+  DEBUG_LDFLAGS_INTERNAL += -fsanitize=address -lasan
 endif
 
 ifneq (,$(findstring tsan,$(D)))
@@ -173,6 +174,7 @@ endif
 
 ifneq (,$(findstring ubsan,$(D)))
   DEBUG_CFLAGS_INTERNAL += -fsanitize=undefined
+  DEBUG_LDFLAGS_INTERNAL += -fsanitize=undefined -lubsan
 endif
 
 ifneq (,$(findstring bcheck,$(D)))