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