public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] toolchain-funcs.eclass: new function tc-ld-force-bfd()
@ 2021-01-20 21:00 Theo Anderson
  2021-01-21  2:41 ` Manoj Gupta
  0 siblings, 1 reply; 5+ messages in thread
From: Theo Anderson @ 2021-01-20 21:00 UTC (permalink / raw
  To: gentoo-dev

Hello, please see the below patch to support disabling ld.lld like
ld.gold. This has not been split into a separate function
such as tc-ld-disable-lld(), as I do not believe there is a use case
where ld.gold is supported and ld.lld is not.

Thanks.

Pull-request: https://github.com/gentoo/gentoo/pull/19116

From c0894e304cbd209ab2cf6b3754f75d9bfd93634a Mon Sep 17 00:00:00 2001
From: Theo Anderson <telans@posteo.de>
Date: Thu, 21 Jan 2021 09:59:09 +1300
Subject: [PATCH] toolchain-funcs.eclass: new function tc-ld-force-bfd()

No functions currently force bfd usage when lld is active.
This function takes over tc-ld-disable-gold so that any current
 calls to tc-ld-disable-gold will also disable lld. With ld.ldd
 this fixes configure for packages like sys-libs/db where
 --default-symver is added to ldflags.
tc-ld-disable-gold has been marked as deprecated and should be
 replaced by tc-ld-force-bfd within ebuilds.

Package-Manager: Portage-3.0.14, Repoman-3.0.2
Signed-off-by: Theo Anderson <telans@posteo.de>
---
 eclass/toolchain-funcs.eclass | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/eclass/toolchain-funcs.eclass
b/eclass/toolchain-funcs.eclass index 4a4bb27fc08..2cf7ddfb790 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2019 Gentoo Authors
+# Copyright 2002-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-funcs.eclass
@@ -502,15 +502,26 @@ tc-ld-is-lld() {
 # @FUNCTION: tc-ld-disable-gold
 # @USAGE: [toolchain prefix]
 # @DESCRIPTION:
+# Deprecated in favor of tc-ld-force-bfd.
+#
 # If the gold linker is currently selected, configure the compilation
 # settings so that we use the older bfd linker instead.
 tc-ld-disable-gold() {
-	if ! tc-ld-is-gold "$@" ; then
-		# They aren't using gold, so nothing to do!
+	tc-ld-force-bfd "$@"
+}
+
+# @FUNCTION: tc-ld-force-bfd
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# If the gold or lld linker is currently selected, configure the
compilation +# settings so that we use the bfd linker instead.
+tc-ld-force-bfd() {
+	if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@" ; then
+		# They aren't using gold or lld, so nothing to do!
 		return
 	fi
 
-	ewarn "Forcing usage of the BFD linker instead of GOLD"
+	ewarn "Forcing usage of the BFD linker"
 
 	# Set up LD to point directly to bfd if it's available.
 	# We need to extract the first word in case there are flags
appended @@ -520,7 +531,7 @@ tc-ld-disable-gold() {
 	local path_ld=$(which "${bfd_ld}" 2>/dev/null)
 	[[ -e ${path_ld} ]] && export LD=${bfd_ld}
 
-	# Set up LDFLAGS to select gold based on the gcc / clang
version.
+	# Set up LDFLAGS to select bfd based on the gcc / clang
version. local fallback="true"
 	if tc-is-gcc; then
 		local major=$(gcc-major-version "$@")
@@ -548,7 +559,7 @@ tc-ld-disable-gold() {
 			ln -sf "${path_ld}" "${d}"/ld
 			export LDFLAGS="${LDFLAGS} -B${d}"
 		else
-			die "unable to locate a BFD linker to bypass
gold"
+			die "unable to locate a BFD linker"
 		fi
 	fi
 }
-- 
2.30.0



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-01-21 10:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-20 21:00 [gentoo-dev] [PATCH] toolchain-funcs.eclass: new function tc-ld-force-bfd() Theo Anderson
2021-01-21  2:41 ` Manoj Gupta
2021-01-21  5:10   ` Mike Gilbert
2021-01-21  7:50     ` Arfrever Frehtes Taifersar Arahesis
2021-01-21 10:44     ` Theo Anderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox