Closed kostadinsh closed 1 year ago
It works with these:
-fuse-ld=bfd
-fuse-ld=gold
-fuse-ld=lld
In these cases the symbols are there:
$ readelf -W --dyn-syms src/liblzma/.libs/liblzma.so.5 \
| grep lzma_stream_encoder_mt_memusage
127: 000000000000db90 222 FUNC GLOBAL DEFAULT 13 lzma_stream_encoder_mt_memusage@@XZ_5.2
128: 000000000000db90 222 FUNC GLOBAL DEFAULT 13 lzma_stream_encoder_mt_memusage@XZ_5.1.2alpha
129: 000000000000db90 222 FUNC GLOBAL DEFAULT 13 lzma_stream_encoder_mt_memusage@XZ_5.2.2
Omitting -Wl,--fatal-warnings
makes the build succeed with -fuse-ld=mold
but the symbols are wrong:
$ readelf -W --dyn-syms src/liblzma/.libs/liblzma.so.5 \
| grep lzma_stream_encoder_mt_memusage
49: 000000000001c690 222 FUNC GLOBAL DEFAULT 20 lzma_stream_encoder_mt_memusage@@XZ_5.2
56: 000000000001c690 222 FUNC GLOBAL DEFAULT 20 lzma_stream_encoder_mt_memusage@XZ_5.2.2@XZ_5.2.2
104: 000000000001c690 222 FUNC GLOBAL DEFAULT 20 lzma_stream_encoder_mt_memusage@XZ_5.1.2alpha@XZ_5.1.2alpha
Note how the non-default symbols (the last two) have a duplicated suffix. It happens with both GCC and Clang with -fuse-ld=mold
, mold version 1.11.0. Disabling LTO makes it work. This makes me wonder if mold has a problem when LTO and symbol versioning are used at the same time.
Can you test a git snapshot of mold and if it still doesn't work then discuss it with the mold developers? As far as I understand it, the symbol versioning in liblzma doesn't do anything weird so the problem may affect many other packages too.
Thanks!
I am testing a git snapshot of mold at the commit mentioned in the original report. And you are indeed right it affects other packages too, I am reporting bugs for those too. Thanks for taking your time and testing this. Going to open a bug on mold's tracker and link it here.
Describe the bug
When building with the mold linker and -flto added to CFLAGS, this package seems to have some issues in the linking phase regarding symbols not being found. I've turned mold's warnings into errors with
-Wl,--fatal-warnings
, so I can catch them more easily.GCC version used is gcc (Gentoo 13.1.1_p20230527 p3) 13.1.1 20230527 Mold is built from git at commit
b04aba89d3a1931470983212925443e7aefca1e1
Steps to reproduce:
export CFLAGS="-O2 -pipe -flto=auto"
andexport LDFLAGS="-fuse-ld=mold -Wl,--fatal-warnings"
autoreconf -vfi
./configure --enable-threads --prefix=/usr
make V=1
In the log output I am only going to only add the last few lines of the log as I think the entire log would be way too much, and then add the full logs from
./configure
andmake
as an attachmentxz-configure.log xz-make.log
Version
commit 66bdcfa85fef2911cc80f5f30fed3f9610faccb4
Operating System
Gentoo Linux
Relevant log output