From 34b5d981bd529867681100dc75862141a1e5c055 Mon Sep 17 00:00:00 2001
From: Dridi Boukelmoune <dridi@fedoraproject.org>
Date: Sun, 16 Apr 2023 15:57:54 +0200
Subject: [PATCH] Makefile: Pass LDFLAGS to link hare and hare-tests

Since hare(1) invokes $(LD) with $(LDFLAGS) but hare(1) itself is built
with a direct $(LD) invocation from the makefile, it is inconsistently
linked without those (usually disto-wide) flags.
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 2fc0ecc2..e89228de 100644
--- a/Makefile
+++ b/Makefile
@@ -59,13 +59,13 @@ $(TESTCACHE)/hare.ssa: $(hare_srcs) $(testlib_deps_any) $(testlib_deps_$(PLATFOR
 $(BINOUT)/hare: $(HARECACHE)/hare.o
 	@mkdir -p $(BINOUT)
 	@printf 'LD\t%s\n' "$@"
-	@$(LD) --gc-sections -T $(rtscript) -o $@ \
+	@$(LD) $(LDFLAGS) --gc-sections -T $(rtscript) -o $@ \
 		$(HARECACHE)/hare.o $(stdlib_deps_any) $(stdlib_deps_$(PLATFORM))
 
 $(BINOUT)/hare-tests: $(TESTCACHE)/hare.o
 	@mkdir -p $(BINOUT)
 	@printf 'LD\t%s\n' "$@"
-	@$(LD) -T $(rtscript) -o $@ \
+	@$(LD) $(LDFLAGS) -T $(rtscript) -o $@ \
 		$(TESTCACHE)/hare.o $(testlib_deps_any) $(testlib_deps_$(PLATFORM))
 
 $(BINOUT)/harec2: $(BINOUT)/hare $(harec_srcs)
-- 
2.39.2

