diff mbox series

[v2,2/5] stress-ng: Do not enforce gold linker

Message ID 20230103200553.52973-2-raj.khem@gmail.com
State Accepted, archived
Commit 089cc4b036e370bf82973ca6ced038578e4682cf
Headers show
Series [v2,1/5] rust: Fix build with 64bit time_t | expand

Commit Message

Khem Raj Jan. 3, 2023, 8:05 p.m. UTC
This can then be controlled by yocto environment through LDFLAGS if
needed since we support multiple linkers and distro policy may want a
different linker, moreover gold fails on ppc32 to link since its missing

Fixes errors like below on ppc/gold + clang

/usr/lib/clang/15.0.6/lib/linux/libclang_rt.builtins-powerpc.a(mulsc3.c.o): unsupported -mbss-plt code

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...1-via-makefile-to-enable-gold-linker.patch | 65 +++++++++++++++++++
 .../stress-ng/stress-ng_0.15.01.bb            |  3 +-
 2 files changed, 67 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch
diff mbox series

Patch

diff --git a/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch b/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch
new file mode 100644
index 0000000000..821e4d910f
--- /dev/null
+++ b/meta/recipes-extended/stress-ng/stress-ng/0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch
@@ -0,0 +1,65 @@ 
+From 32386c13420f676bd938a8b1ceaeab8a5da46d17 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 3 Jan 2023 11:00:09 -0800
+Subject: [PATCH] Pass LD_GOLD=1 via makefile to enable gold linker
+
+Current logic prefers gold if a toolchain has gold linker installed and
+does not offer any option to chose default linker which might not be
+gold linker. Its better to pass this control to user instead of auto
+detecting and deciding.
+
+Upstream-Status: Submitted [https://github.com/ColinIanKing/stress-ng/pull/251]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ Makefile        | 7 +++++++
+ Makefile.config | 9 +--------
+ 2 files changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index f2fd4b6c..bff6b8ac 100644
+--- a/Makefile
++++ b/Makefile
+@@ -69,6 +69,13 @@ endif
+ #CFLAGS += -Weverything
+ #endif
+ 
++#
++# Use gold linker
++#
++ifeq ($(LD_GOLD),1)
++LDFLAGS += -fuse-ld=gold
++endif
++
+ GREP = grep
+ #
+ # SunOS requires special grep for -e support
+diff --git a/Makefile.config b/Makefile.config
+index 394ed20d..48c94fa1 100644
+--- a/Makefile.config
++++ b/Makefile.config
+@@ -241,7 +241,7 @@ define check_ld
+ 	$(call check_ld_tmp,$1,$2,$3)
+ endef
+ 
+-all: linkers libraries headers cpufeatures types functions
++all: libraries headers cpufeatures types functions
+ 	@for I in $$(ls $(CONFIGS)); do \
+ 		if [ -s $(CONFIGS)/$$I ]; then \
+ 			echo "#define $$I"; \
+@@ -262,13 +262,6 @@ configdir:
+ clean:
+ 	@rm -rf $(CONFIGS) config config.h
+ 
+-linkers: \
+-	configdir \
+-	LD_GOLD
+-
+-LD_GOLD:
+-	$(call check_ld,test-ld,HAVE_LD_GOLD,gold)
+-
+ libraries: \
+ 	configdir \
+ 	LIB_AIO LIB_APPARMOR LIB_BSD LIB_CRYPT LIB_DL \
+-- 
+2.39.0
+
diff --git a/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb b/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb
index 38fd6698b3..0d95cad69f 100644
--- a/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb
+++ b/meta/recipes-extended/stress-ng/stress-ng_0.15.01.bb
@@ -5,7 +5,8 @@  HOMEPAGE = "https://github.com/ColinIanKing/stress-ng#readme"
 LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-SRC_URI = "git://github.com/ColinIanKing/stress-ng.git;protocol=https;branch=master"
+SRC_URI = "git://github.com/ColinIanKing/stress-ng.git;protocol=https;branch=master \
+           file://0001-Pass-LD_GOLD-1-via-makefile-to-enable-gold-linker.patch"
 SRCREV = "8c7c3d95555c50148470553b55477db895a4f1ad"
 S = "${WORKDIR}/git"