You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like I found an inconsistency between mold and binutils ld when it comes to keeping static archive symbols in an executable when they are required by a shared library.
In the attached reproducer a shared library is setup to require an imported symbol which can be provided by a static archive. Then both the shared library and that static archive are linked into an executable. The behavior difference is as follows,
ld shoves the symbol from the static archive into the executable
mold does not include the symbol from the static archive
I'm not sure which behavior is more correct, but this creates an incompatibility between the two linkers.
I tested the reproducer with using both gcc 8.3.0, and clang 9.0.0, as well as using ld.bfs, ld.gold from binutils 2.37, and mold 1.0.1
An interesting note is that mold behaves consistent to ld when the executable is linked with object files directly rather than a static archive.
The text was updated successfully, but these errors were encountered:
Thank you for your report and providing me the reproducer. I recently made a change in ce5749c to rewrite our symbol resolution algorithm, and now mold pulls out object files from archives if they can resolve undefined symbols in shared objects, which is more consistent with GNU ld.
It looks like I found an inconsistency between mold and binutils ld when it comes to keeping static archive symbols in an executable when they are required by a shared library.
In the attached reproducer a shared library is setup to require an imported symbol which can be provided by a static archive. Then both the shared library and that static archive are linked into an executable. The behavior difference is as follows,
I'm not sure which behavior is more correct, but this creates an incompatibility between the two linkers.
I tested the reproducer with using both gcc 8.3.0, and clang 9.0.0, as well as using ld.bfs, ld.gold from binutils 2.37, and mold 1.0.1
An interesting note is that mold behaves consistent to ld when the executable is linked with object files directly rather than a static archive.
The text was updated successfully, but these errors were encountered: