btrfs-progs: build: add internal LDFLAGS for the D= features
authorDavid Sterba <dsterba@suse.com>
Fri, 25 Aug 2017 18:04:48 +0000 (20:04 +0200)
committerDavid Sterba <dsterba@suse.com>
Fri, 8 Sep 2017 14:15:05 +0000 (16:15 +0200)
We might want to pass additional linker flags for various sanitization
features.

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

index 358b236..f196198 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -55,6 +55,10 @@ DEBUG_CFLAGS_DEFAULT = -O0 -U_FORTIFY_SOURCE -ggdb3
 DEBUG_CFLAGS_INTERNAL =
 DEBUG_CFLAGS :=
 
+DEBUG_LDFLAGS_DEFAULT =
+DEBUG_LDFLAGS_INTERNAL =
+DEBUG_LDFLAGS :=
+
 TOPDIR := $(shell pwd)
 
 # Common build flags
@@ -72,7 +76,9 @@ CFLAGS = $(SUBST_CFLAGS) \
         $(EXTRA_CFLAGS)
 
 LDFLAGS = $(SUBST_LDFLAGS) \
-         -rdynamic -L$(TOPDIR) $(EXTRA_LDFLAGS)
+         -rdynamic -L$(TOPDIR) \
+         $(DEBUG_LDFLAGS_INTERNAL) \
+         $(EXTRA_LDFLAGS)
 
 LIBS = $(LIBS_BASE)
 LIBBTRFS_LIBS = $(LIBS_BASE)
@@ -135,6 +141,7 @@ endif
 
 ifeq ("$(origin D)", "command line")
   DEBUG_CFLAGS_INTERNAL = $(DEBUG_CFLAGS_DEFAULT) $(DEBUG_CFLAGS)
+  DEBUG_LDFLAGS_INTERNAL = $(DEBUG_LDFLAGS_DEFAULT) $(DEBUG_LDFLAGS)
 endif
 
 ifneq (,$(findstring verbose,$(D)))