https://sourceware.org/bugzilla/show_bug.cgi?id=26551
--- Comment #3 from Fangrui Song <i at maskray dot me> --- When --as-needed is in action, a shared object is added as a DT_NEEDED tag if it satisfies a non-weak undefined reference from a regular object (surviving under --gc-sections). This is the main use case of the option. Apparently in GNU ld, --as-needed is also used to decide whether a definition needs to be exported. I think it'd be good if this task can be detached from --as-needed (like gold). For an "unneeded" (in terms of --as-needed) shared object, it may be loaded by other shared objects. Adding the shared object on the command line is an explicit intention that the "unneeded" (unneeded by the executable, but may be needed by other shared objects) may require some definitions to be exported. (The definitions may be statically known (by transitive loading of shared objects; the behavior is related to --copy-dt-needed-entries) or dynamic (dlopen).) -- You are receiving this mail because: You are on the CC list for the bug.