bdc76f
commit b5ffdc48c20ae865b197b67e5a9068a528fbc198
bdc76f
Author: Florian Weimer <fweimer@redhat.com>
bdc76f
Date:   Thu Apr 25 10:41:52 2019 +0200
bdc76f
bdc76f
    benchtests: Enable BIND_NOW if configured with --enable-bind-now
bdc76f
    
bdc76f
    Benchmarks should reflect distribution build policies, so it makes
bdc76f
    sense to honor the BIND_NOW configuration for them.
bdc76f
    
bdc76f
    This commit keeps using $(+link-tests), so that the benchmarks are
bdc76f
    linked according to the --enable-hardcoded-path-in-tests configure
bdc76f
    option.
bdc76f
    
bdc76f
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>
bdc76f
bdc76f
diff --git a/benchtests/Makefile b/benchtests/Makefile
bdc76f
index bcd6a9c26d9a0005..28d6b0c43f5bd390 100644
bdc76f
--- a/benchtests/Makefile
bdc76f
+++ b/benchtests/Makefile
bdc76f
@@ -235,13 +235,21 @@ bench-func: $(binaries-bench)
bdc76f
 	  scripts/benchout.schema.json; \
bdc76f
 	fi
bdc76f
 
bdc76f
-$(timing-type) $(binaries-bench) $(binaries-benchset) \
bdc76f
-	$(binaries-bench-malloc): %: %.o $(objpfx)json-lib.o \
bdc76f
+ifeq ($(bind-now),yes)
bdc76f
+link-bench-bind-now = -Wl,-z,now
bdc76f
+endif
bdc76f
+
bdc76f
+bench-link-targets = $(timing-type) $(binaries-bench) $(binaries-benchset) \
bdc76f
+	$(binaries-bench-malloc)
bdc76f
+
bdc76f
+$(bench-link-targets): %: %.o $(objpfx)json-lib.o \
bdc76f
 	$(link-extra-libs-tests) \
bdc76f
   $(sort $(filter $(common-objpfx)lib%,$(link-libc))) \
bdc76f
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
bdc76f
 	$(+link-tests)
bdc76f
 
bdc76f
+$(bench-link-targets): LDFLAGS += $(link-bench-bind-now)
bdc76f
+
bdc76f
 $(objpfx)bench-%.c: %-inputs $(bench-deps)
bdc76f
 	{ if [ -n "$($*-INCLUDE)" ]; then \
bdc76f
 	  cat $($*-INCLUDE); \