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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id BE06415852A for ; Fri, 16 Aug 2024 17:21:49 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DFE522BC057; Fri, 16 Aug 2024 17:21:48 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id B96312BC055 for ; Fri, 16 Aug 2024 17:21:48 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B25E3342FA1 for ; Fri, 16 Aug 2024 17:21:47 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1D5B51EBA for ; Fri, 16 Aug 2024 17:21:46 +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: <1723828878.2283662d49266d652f171cd6b75798166a86335b.sam@gentoo> Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/ X-VCS-Repository: repo/gentoo X-VCS-Files: eclass/toolchain-funcs.eclass X-VCS-Directories: eclass/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 2283662d49266d652f171cd6b75798166a86335b X-VCS-Branch: master Date: Fri, 16 Aug 2024 17:21:46 +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: 0dced90d-45e9-4989-80b7-490b2d52cf03 X-Archives-Hash: cc7ce50ed287704849204a4536ea90e0 commit: 2283662d49266d652f171cd6b75798166a86335b Author: Sam James gentoo org> AuthorDate: Mon Nov 21 03:59:08 2022 +0000 Commit: Sam James gentoo org> CommitDate: Fri Aug 16 17:21:18 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2283662d toolchain-funcs.eclass: add tc-ld-is-bfd This matches tc-ld-is-gold and tc-ld-is-lld. Signed-off-by: Sam James gentoo.org> eclass/toolchain-funcs.eclass | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 50eb310b4bf1..121280a7f11f 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -447,6 +447,41 @@ econf_build() { tc-env_build econf_env "$@" } +# @FUNCTION: tc-ld-is-bfd +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# Return true if the current linker is set to GNU bfd. +tc-ld-is-bfd() { + local out + + # Ensure ld output is in English. + local -x LC_ALL=C + + # First check the linker directly. + out=$($(tc-getLD "$@") --version 2>&1) + if [[ ${out} != "GNU ld"* ]] ; then + return 1 + fi + + # Then see if they're selecting bfd via compiler flags. + # Note: We're assuming they're using LDFLAGS to hold the + # options and not CFLAGS/CXXFLAGS. + local base="${T}/test-tc-bfd" + cat <<-EOF > "${base}.c" + int main(void) { return 0; } + EOF + out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1) + rm -f "${base}"* + if [[ ${out} != "GNU ld"* ]] ; then + return 1 + fi + + # It's bfd! + # We use positive logic here unlike tc-ld-is-gold and tc-ld-is-mold + # because LD might be bfd even if *FLAGS isn't. + return 0 +} + # @FUNCTION: tc-ld-is-gold # @USAGE: [toolchain prefix] # @DESCRIPTION: