The following tests fail when 'ld' is set to gold: * Testing tc-ld-is-gold (bfd selected) ... [ !! ] * Testing tc-ld-disable-gold (bfd selected) ... [ !! ] This is because of a bug in tc-ld-is-gold. The test is called with LD=ld.bfd override. However, the function does the test in two parts: 1. It tests '$(tc-getLD "$@") --version' for gold, 2. If the above fails, it tests '$(tc-getCC "$@") [...] -Wl,--version' for gold. Now, the LD override works only for the former but the latter apparently doesn't care for it. Therefore, if system linker is set to gold, the second test comes positive independently of LD value.
tc-ld-is-gold() checks if any of $LD of $CC are using gold linker. It's arguably a problematic user configuration (or problematic test in this case) when one does not match another. In test we'll need to convince CC to use bfd as well. One of ways to replicate it it to do an equivalent of tc-ld-disable-gold(). For example setting LDFLAGS to -fuse-ld=bfd should have the desired effect for at least gcc and clang. Or calling tc-ld-disable-gold() directly.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=063d79790a2c0ee4542552f76334f511aaced319 commit 063d79790a2c0ee4542552f76334f511aaced319 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2019-12-13 22:22:11 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2019-12-13 22:37:12 +0000 eclass/tests/toolchain-funcs.sh: fix gold tests, bug #700812 As written tests assumed that $CC always called ld.bfd as a linker. The assumption fails when default linker is not ld.bfd, (for example sys-devel/binutils[default-gold]). The change uses LDFLAGS=-fuse-ld=bfd explicitly. Fixes the following tests: * Testing tc-ld-is-gold (bfd selected) ... [ !! ] * Testing tc-ld-disable-gold (bfd selected) ... [ !! ] Reported-by: Michał Górny Closes: https://bugs.gentoo.org/700812 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> eclass/tests/toolchain-funcs.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)