blob: 821e4d910f825d534798eb82840601ac8d45f852 [file] [log] [blame]
Andrew Geissler517393d2023-01-13 08:55:19 -06001From 32386c13420f676bd938a8b1ceaeab8a5da46d17 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Tue, 3 Jan 2023 11:00:09 -0800
4Subject: [PATCH] Pass LD_GOLD=1 via makefile to enable gold linker
5
6Current logic prefers gold if a toolchain has gold linker installed and
7does not offer any option to chose default linker which might not be
8gold linker. Its better to pass this control to user instead of auto
9detecting and deciding.
10
11Upstream-Status: Submitted [https://github.com/ColinIanKing/stress-ng/pull/251]
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13---
14 Makefile | 7 +++++++
15 Makefile.config | 9 +--------
16 2 files changed, 8 insertions(+), 8 deletions(-)
17
18diff --git a/Makefile b/Makefile
19index f2fd4b6c..bff6b8ac 100644
20--- a/Makefile
21+++ b/Makefile
22@@ -69,6 +69,13 @@ endif
23 #CFLAGS += -Weverything
24 #endif
25
26+#
27+# Use gold linker
28+#
29+ifeq ($(LD_GOLD),1)
30+LDFLAGS += -fuse-ld=gold
31+endif
32+
33 GREP = grep
34 #
35 # SunOS requires special grep for -e support
36diff --git a/Makefile.config b/Makefile.config
37index 394ed20d..48c94fa1 100644
38--- a/Makefile.config
39+++ b/Makefile.config
40@@ -241,7 +241,7 @@ define check_ld
41 $(call check_ld_tmp,$1,$2,$3)
42 endef
43
44-all: linkers libraries headers cpufeatures types functions
45+all: libraries headers cpufeatures types functions
46 @for I in $$(ls $(CONFIGS)); do \
47 if [ -s $(CONFIGS)/$$I ]; then \
48 echo "#define $$I"; \
49@@ -262,13 +262,6 @@ configdir:
50 clean:
51 @rm -rf $(CONFIGS) config config.h
52
53-linkers: \
54- configdir \
55- LD_GOLD
56-
57-LD_GOLD:
58- $(call check_ld,test-ld,HAVE_LD_GOLD,gold)
59-
60 libraries: \
61 configdir \
62 LIB_AIO LIB_APPARMOR LIB_BSD LIB_CRYPT LIB_DL \
63--
642.39.0
65