summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorTheo Anderson <telans@posteo.de>2021-01-21 23:51:03 +1300
committerSergei Trofimovich <slyfox@gentoo.org>2021-01-23 09:01:27 +0000
commite93396171a39f4a46ebfc0ca9766b96466553e2f (patch)
tree429e0928fdfe149c544d2f1e206ca747662658cd /eclass
parentdev-python/smmap: Update remote-id (diff)
downloadgentoo-e93396171a39f4a46ebfc0ca9766b96466553e2f.tar.gz
gentoo-e93396171a39f4a46ebfc0ca9766b96466553e2f.tar.bz2
gentoo-e93396171a39f4a46ebfc0ca9766b96466553e2f.zip
toolchain-funcs.eclass: new function tc-ld-force-bfd()
No functions currently force ld.bfd usage when ld.lld is active. This function forces ld.bfd when either ld.gold or ld.lld is active. tc-ld-disable-gold() now calls this new function only if ld.gold is active. Package-Manager: Portage-3.0.14, Repoman-3.0.2 Signed-off-by: Theo Anderson <telans@posteo.de> Closes: https://github.com/gentoo/gentoo/pull/19116 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass21
1 files changed, 15 insertions, 6 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 4a4bb27fc084..267cf5cfce34 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
@@ -505,12 +505,21 @@ tc-ld-is-lld() {
# 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-is-gold "$@" && 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 +529,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 +557,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
}