eclass/toolchain-funcs: Sync with Gentoo

It's from Gentoo commit 3dae41abc9ea4c6d642ece7ce5bc54c0548b56a5.
This commit is contained in:
Flatcar Buildbot 2023-11-06 07:12:04 +00:00
parent ebab24c42e
commit a6ce47f1b1

View File

@ -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}