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