-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
Description
Several packages (e.g. m4-1.4.20, elfutils-0.193, pam-1.7.1, libdrm-2.4.125, procps-4.0.5, ctags-6.2.0) fail to link with LLD with these "ld.lld: error: undefined symbol: _restfpr_XX" errors when built with -Os:
[...]
powerpc64-unknown-linux-musl-gcc -I../lib -I../lib -Os -fno-ipa-icf -fno-ipa-vrp -fno-tree-pre -fno-tree-tail-merge -falign-jumps -falign-labels -freorder-blocks-algorithm=simple -fpredictive-commoning -ftree-vectorize -fvect-cost-model=cheap -mcpu=970 -mtune=970 -maltivec -mabi=altivec -pipe -Wno-error=format-security -c -o symtab.o symtab.c
powerpc64-unknown-linux-musl-gcc -Os -fno-ipa-icf -fno-ipa-vrp -fno-tree-pre -fno-tree-tail-merge -falign-jumps -falign-labels -freorder-blocks-algorithm=simple -fpredictive-commoning -ftree-vectorize -fvect-cost-model=cheap -mcpu=970 -mtune=970 -maltivec -mabi=altivec -pipe -Wno-error=format-security -fuse-ld=lld -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -o m4 m4.o builtin.o debug.o eval.o format.o freeze.o input.o macro.o output.o path.o symtab.o ../lib/libm4.a -lpthread
ld.lld: error: undefined symbol: _restfpr_31
>>> referenced by format.c
>>> format.o:(expand_format)
>>> referenced by strtod.c
>>> libm4_a-strtod.o:(rpl_strtod) in archive ../lib/libm4.a
ld.lld: error: undefined symbol: _restfpr_30
>>> referenced by hash.c
>>> libm4_a-hash.o:(hash_insert_if_absent) in archive ../lib/libm4.a
>>> referenced by hash.c
>>> libm4_a-hash.o:(hash_remove) in archive ../lib/libm4.a
ld.lld: error: undefined symbol: _savefpr_29
>>> referenced by strtod.c
>>> libm4_a-strtod.o:(parse_number) in archive ../lib/libm4.a
ld.lld: error: undefined symbol: _restfpr_29
>>> referenced by strtod.c
>>> libm4_a-strtod.o:(parse_number) in archive ../lib/libm4.a
collect2: error: ld returned 1 exit status
make[2]: *** [Makefile:2526: m4] Error 1
make[2]: Leaving directory '/var/tmp/portage/sys-devel/m4-1.4.20/work/m4-1.4.20/src'
make[1]: *** [Makefile:2530: all-recursive] Error 1
make[1]: Leaving directory '/var/tmp/portage/sys-devel/m4-1.4.20/work/m4-1.4.20'
make: *** [Makefile:2486: all] Error 2
* ERROR: sys-devel/m4-1.4.20::gentoo failed (compile phase):
* emake failed
Same packages link fine with LLD when -O2 is used for building. Binutils BFD links both -Os/-O2 built packages fine. The issue shows up with LLD 20.1.8 and LLD 21.1.0, didn't try other versions.
This is on powerpc64-unknown-linux-musl (where LLD can be used for linking due to ELFv2) when LDFLAGS="-fuse-ld=lld ${LDFLAGS}" is used. The issue might also show up on powerpc64le-unknown-linux-gnu (also ELFv2).
This is Gentoo downstream bug report 960798.
m4-1.4.20:20250907-234546.log
libdrm-2.4.125:20250907-212718.log
emerge--info.txt