ld,gold: Need help with --as-needed
Matwey V. Kornilov
matwey.kornilov@gmail.com
Sun Oct 6 11:15:24 GMT 2024
Hello,
I have C++ sources which I build with -Wl,--as-needed -Wl,-znow and
-flto. I use gcc 14.2, and I've tried both ld and gold with the same
behaviour.
I've found that some unused shared object library is still marked as
NEEDED in the resulting ELF. I've double checked that no symbols are
used from the SO using objdump and Ghidra.
Then I've tried to craft a minimal reproducible example to learn what
prevents --as-needed from removing this specific SO, however I've
failed: linker had always removed the unused library whatever I tried.
Now I would like to know if it is possible to increase the linker
verbosity to learn its behaviour on my real sources. I hope this will
give me some insights.
--
With best regards,
Matwey V. Kornilov
More information about the Binutils
mailing list