Bug 470634 still reproduces here because '-Wl,-default-symver' is appended to LDFLAGS before calling tc-ld-disable-gold. As a result ${out} will not match *"GNU gold"* because it actually contains: collect2 version 4.9.3 /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld.gold -plugin /usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.3/liblto_plugin.so -plugin-opt=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.9.3/lto-wrapper -plugin-opt=-fresolution=/var/tmp/portage/sys-libs/db-6.0.35/temp/ccGbTSLC.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /var/tmp/portage/sys-libs/db-6.0.35/temp/test-tc-gold /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib32/crt1.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib32/crti.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32/crtbegin.o -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib32 -L/lib/../lib32 -L/usr/lib/../lib32 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3 -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/lib -L/usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../.. -O1 --default-symver --version /var/tmp/portage/sys-libs/db-6.0.35/temp/cc2SRQqP.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/32/crtend.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../lib32/crtn.o /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld.gold: --default-symver: unknown option /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.3/../../../../x86_64-pc-linux-gnu/bin/ld.gold: use the --help option for usage information collect2: error: ld returned 1 exit status Reproducible: Always
Made it build by changing the condition to: if [[ ${out} == *"GNU gold"* ]] || [[ ${out} == *"ld.gold"* ]] ; then
tc-ld-disable-gold is written as intended -- we use user flags first (in case they change ABI or linker paths) before requesting the version info the fact that db adds the invalid flag before trying to change the linker is a bug in the db ebuild
this was changed here i think and it looks like by accident: https://sources.gentoo.org/sys-libs/db/db-6.0.30-r1.ebuild fixed here: http://gitweb.gentoo.org/repo/gentoo.git/commit/?id=db548619f2d5a39f8bb523c60e99d20cf84ef513