From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 586CE13835A for ; Sat, 10 Apr 2021 07:15:16 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3008CE0872; Sat, 10 Apr 2021 07:15:15 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0C369E0872 for ; Sat, 10 Apr 2021 07:15:15 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 18300335C6F for ; Sat, 10 Apr 2021 07:15:14 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5E1F5646 for ; Sat, 10 Apr 2021 07:15:12 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1618038901.3a1668e93a4b74fc147f3664d890ece129446067.sam@gentoo> Subject: [gentoo-commits] repo/proj/prefix:master commit in: eclass/ X-VCS-Repository: repo/proj/prefix X-VCS-Files: eclass/toolchain-funcs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 3a1668e93a4b74fc147f3664d890ece129446067 X-VCS-Branch: master Date: Sat, 10 Apr 2021 07:15:12 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: d8a10867-9f19-4e54-9002-7f2ad5ad728f X-Archives-Hash: 16054a5f6d567715f870ebaa303b5a00 commit: 3a1668e93a4b74fc147f3664d890ece129446067 Author: Sam James gentoo org> AuthorDate: Sat Apr 10 07:15:01 2021 +0000 Commit: Sam James gentoo org> CommitDate: Sat Apr 10 07:15:01 2021 +0000 URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=3a1668e9 toolchain-funcs.eclass: sync with ::gentoo Signed-off-by: Sam James gentoo.org> eclass/toolchain-funcs.eclass | 44 ++++++++++++++++++++++++++++++++++--------- 1 file 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,