Index: lld/ELF/Driver.cpp =================================================================== --- lld/ELF/Driver.cpp +++ lld/ELF/Driver.cpp @@ -1914,10 +1914,11 @@ // Replace common symbols with regular symbols. replaceCommonSymbols(); - // Do size optimizations: garbage collection, merging of SHF_MERGE sections - // and identical code folding. + // Do size optimizations: splitting of sections and garbage collection. splitSections(); markLive(); + + // Demote shared symbols to prevent dangling references to non-DT_NEEDED DSOs. demoteSharedSymbols(); // Make copies of any input sections that need to be copied into each