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