-
-
Notifications
You must be signed in to change notification settings - Fork 470
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mold links more libraries than necessary with --as-needed
#1036
Comments
Right, mold behaves exactly as you explained in this bug. It's not exactly the same as GNU ld, but in practice it didn't seem to cause any practical issues, so I settled with it. Is it causing an issue on your side? |
Consider ABI change in
|
I was going to open a new issue with regards to a similar behavior when using |
Yeah, sorry for the trouble. Let me take a look. It's a bit risky to change this fundamental behavior at this point, but it's indeed an unnecessary churn compared to GNU ld. |
I have the same problem, which makes Mold not practical in many cases as @jpalus explained, please consider fixing it |
If an as-needed DSO is referenced only by other DSOs and not by the output file we are creating, we won't mark it as "needed". Fixes rui314#1036
Consider following chain of dependencies (
libbar
<-libfoo
<-libtest
):libbar
is standalone and has no dependencies:libfoo
needslibbar
:libtest
needslibfoo
but has no direct dependency onlibbar
:Result for
mold 1.11.0
:$ readelf -a libtest.so|grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libfoo.so] 0x0000000000000001 (NEEDED) Shared library: [libbar.so] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [ld-linux-aarch64.so.1]
Result for both
bfd
andlld
:Since
libtest
does not have dependencies onlibbar
andlibfoo
requireslibbar
already I considerbfd
andlld
output to be correct.The text was updated successfully, but these errors were encountered: