Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 23 Jan 2021 09:01:36
Message-Id: 1611392487.e93396171a39f4a46ebfc0ca9766b96466553e2f.slyfox@gentoo
1 commit: e93396171a39f4a46ebfc0ca9766b96466553e2f
2 Author: Theo Anderson <telans <AT> posteo <DOT> de>
3 AuthorDate: Thu Jan 21 10:51:03 2021 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 23 09:01:27 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9339617
7
8 toolchain-funcs.eclass: new function tc-ld-force-bfd()
9
10 No functions currently force ld.bfd usage when ld.lld is active.
11 This function forces ld.bfd when either ld.gold or ld.lld is active.
12 tc-ld-disable-gold() now calls this new function
13 only if ld.gold is active.
14
15 Package-Manager: Portage-3.0.14, Repoman-3.0.2
16 Signed-off-by: Theo Anderson <telans <AT> posteo.de>
17 Closes: https://github.com/gentoo/gentoo/pull/19116
18 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
19
20 eclass/toolchain-funcs.eclass | 21 +++++++++++++++------
21 1 file changed, 15 insertions(+), 6 deletions(-)
22
23 diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
24 index 4a4bb27fc08..267cf5cfce3 100644
25 --- a/eclass/toolchain-funcs.eclass
26 +++ b/eclass/toolchain-funcs.eclass
27 @@ -1,4 +1,4 @@
28 -# Copyright 2002-2019 Gentoo Authors
29 +# Copyright 2002-2021 Gentoo Authors
30 # Distributed under the terms of the GNU General Public License v2
31
32 # @ECLASS: toolchain-funcs.eclass
33 @@ -505,12 +505,21 @@ tc-ld-is-lld() {
34 # If the gold linker is currently selected, configure the compilation
35 # settings so that we use the older bfd linker instead.
36 tc-ld-disable-gold() {
37 - if ! tc-ld-is-gold "$@" ; then
38 - # They aren't using gold, so nothing to do!
39 + tc-ld-is-gold "$@" && tc-ld-force-bfd "$@"
40 +}
41 +
42 +# @FUNCTION: tc-ld-force-bfd
43 +# @USAGE: [toolchain prefix]
44 +# @DESCRIPTION:
45 +# If the gold or lld linker is currently selected, configure the compilation
46 +# settings so that we use the bfd linker instead.
47 +tc-ld-force-bfd() {
48 + if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@" ; then
49 + # They aren't using gold or lld, so nothing to do!
50 return
51 fi
52
53 - ewarn "Forcing usage of the BFD linker instead of GOLD"
54 + ewarn "Forcing usage of the BFD linker"
55
56 # Set up LD to point directly to bfd if it's available.
57 # We need to extract the first word in case there are flags appended
58 @@ -520,7 +529,7 @@ tc-ld-disable-gold() {
59 local path_ld=$(which "${bfd_ld}" 2>/dev/null)
60 [[ -e ${path_ld} ]] && export LD=${bfd_ld}
61
62 - # Set up LDFLAGS to select gold based on the gcc / clang version.
63 + # Set up LDFLAGS to select bfd based on the gcc / clang version.
64 local fallback="true"
65 if tc-is-gcc; then
66 local major=$(gcc-major-version "$@")
67 @@ -548,7 +557,7 @@ tc-ld-disable-gold() {
68 ln -sf "${path_ld}" "${d}"/ld
69 export LDFLAGS="${LDFLAGS} -B${d}"
70 else
71 - die "unable to locate a BFD linker to bypass gold"
72 + die "unable to locate a BFD linker"
73 fi
74 fi
75 }