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 F2E8F158089 for ; Thu, 2 Nov 2023 15:34:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7B62E2BC01F; Thu, 2 Nov 2023 15:34:50 +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 306162BC013 for ; Thu, 2 Nov 2023 15:34:50 +0000 (UTC) From: Mike Gilbert To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH] toolchain-funcs.eclass: tc-ld-force-bfd: unset LD before calling tc-getLD Date: Thu, 2 Nov 2023 11:34:46 -0400 Message-ID: <20231102153446.13056-1-floppym@gentoo.org> X-Mailer: git-send-email 2.42.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Archives-Salt: 40f45a16-a1de-4abc-b6cb-2d4b6b40b592 X-Archives-Hash: f3b92192a3a9e3f90e240fa3fe7943ff The previous logic would fail with common values of LD set by the user: LD="ld.lld" -> LD="ld.lld.bfd" LD="ld.gold" -> LD="ld.gold.bfd" LD="mold" -> LD="mold.bfd" It makes more sense to ignore the user's LD setting and use the default value given by tc-getLD. If the user doesn't have binutils installed, the "type -P" check will still fail and LD will be unaltered. Closes: https://github.com/gentoo/gentoo/pull/33650 Signed-off-by: Mike Gilbert --- eclass/toolchain-funcs.eclass | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass index 4559894ca04a..8fef764ad597 100644 --- a/eclass/toolchain-funcs.eclass +++ b/eclass/toolchain-funcs.eclass @@ -534,10 +534,9 @@ tc-ld-force-bfd() { ewarn "Forcing usage of the BFD linker" # Set up LD to point directly to bfd if it's available. - local ld=$(tc-getLD "$@") - # We need to extract the first word in case there are flags appended - # to its value (like multilib), bug #545218. - local bfd_ld="${ld%% *}.bfd" + # Unset LD first so we get the default value from tc-getLD. + local ld=$(unset LD; tc-getLD "$@") + local bfd_ld="${ld}.bfd" local path_ld=$(type -P "${bfd_ld}" 2>/dev/null) [[ -e ${path_ld} ]] && export LD=${bfd_ld} -- 2.42.0