diff options
author | Sam James <sam@gentoo.org> | 2021-04-10 07:15:01 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2021-04-10 07:15:01 +0000 |
commit | 3a1668e93a4b74fc147f3664d890ece129446067 (patch) | |
tree | dd818c89c79e40acd31b09ddbb068b03151947b1 | |
parent | flag-o-matic.eclass: sync with ::gentoo (diff) | |
download | prefix-3a1668e93a4b74fc147f3664d890ece129446067.tar.gz prefix-3a1668e93a4b74fc147f3664d890ece129446067.tar.bz2 prefix-3a1668e93a4b74fc147f3664d890ece129446067.zip |
toolchain-funcs.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r-- | eclass/toolchain-funcs.eclass | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index d591c9574e..70709b96d6 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 @@ -73,6 +73,10 @@ tc-getCXX() { tc-getPROG CXX g++ "$@"; } # @USAGE: [toolchain prefix] # @RETURN: name of the linker tc-getLD() { tc-getPROG LD ld "$@"; } +# @FUNCTION: tc-getSTRINGS +# @USAGE: [toolchain prefix] +# @RETURN: name of the strings program +tc-getSTRINGS() { tc-getPROG STRINGS strings "$@"; } # @FUNCTION: tc-getSTRIP # @USAGE: [toolchain prefix] # @RETURN: name of the strip program @@ -83,8 +87,12 @@ tc-getSTRIP() { tc-getPROG STRIP strip "$@"; } tc-getNM() { tc-getPROG NM nm "$@"; } # @FUNCTION: tc-getRANLIB # @USAGE: [toolchain prefix] -# @RETURN: name of the archiver indexer +# @RETURN: name of the archive indexer tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getREADELF +# @USAGE: [toolchain prefix] +# @RETURN: name of the ELF reader +tc-getREADELF() { tc-getPROG READELF readelf "$@"; } # @FUNCTION: tc-getOBJCOPY # @USAGE: [toolchain prefix] # @RETURN: name of the object copier @@ -146,6 +154,10 @@ tc-getBUILD_CXX() { tc-getBUILD_PROG CXX g++ "$@"; } # @USAGE: [toolchain prefix] # @RETURN: name of the linker for building binaries to run on the build machine tc-getBUILD_LD() { tc-getBUILD_PROG LD ld "$@"; } +# @FUNCTION: tc-getBUILD_STRINGS +# @USAGE: [toolchain prefix] +# @RETURN: name of the strings program for building binaries to run on the build machine +tc-getBUILD_STRINGS() { tc-getBUILD_PROG STRINGS strings "$@"; } # @FUNCTION: tc-getBUILD_STRIP # @USAGE: [toolchain prefix] # @RETURN: name of the strip program for building binaries to run on the build machine @@ -156,8 +168,12 @@ tc-getBUILD_STRIP() { tc-getBUILD_PROG STRIP strip "$@"; } tc-getBUILD_NM() { tc-getBUILD_PROG NM nm "$@"; } # @FUNCTION: tc-getBUILD_RANLIB # @USAGE: [toolchain prefix] -# @RETURN: name of the archiver indexer for building binaries to run on the build machine +# @RETURN: name of the archive indexer for building binaries to run on the build machine tc-getBUILD_RANLIB() { tc-getBUILD_PROG RANLIB ranlib "$@"; } +# @FUNCTION: tc-getBUILD_READELF +# @USAGE: [toolchain prefix] +# @RETURN: name of the ELF reader for building binaries to run on the build machine +tc-getBUILD_READELF() { tc-getBUILD_PROG READELF readelf "$@"; } # @FUNCTION: tc-getBUILD_OBJCOPY # @USAGE: [toolchain prefix] # @RETURN: name of the object copier for building binaries to run on the build machine @@ -378,6 +394,7 @@ tc-env_build() { NM=$(tc-getBUILD_NM) \ PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) \ RANLIB=$(tc-getBUILD_RANLIB) \ + READELF=$(tc-getBUILD_READELF) \ "$@" } @@ -490,12 +507,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 @@ -505,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 "$@") @@ -533,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 } @@ -665,7 +691,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; } mips*) echo mips;; nios2*) echo nios2;; nios*) echo nios;; - or1k|or32*) echo openrisc;; + or1k*|or32*) echo openrisc;; powerpc*) # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees # have been unified into simply 'powerpc', but until 2.6.16, |