Similar to the approach being discussed for libLTO in D18346,
optimize the ThinLTO backend compilations and object files by converting
preempted weak and linkonce symbols to available_externally when
possible. This ensures that they are dropped and don't unnecessarily
show up in the object file.
Details
- Reviewers
• rafael mehdi_amini
Diff Detail
Event Timeline
As discussed in D18346, alias/aliasee cannot be available_externally. Augmented test with alias case.
tools/gold/gold-plugin.cpp | ||
---|---|---|
779 | It is OK to have available_externally to a comdat member, no? I mean, it is equivalent to a declaration, and we can have a declaration to a comdat member. |
tools/gold/gold-plugin.cpp | ||
---|---|---|
779 | You can't have a declaration or available_externally in a comdat. From Verifier.cpp: if (GV.isDeclarationForLinker()) Assert(!GV.hasComdat(), "Declaration may not be in a Comdat!", &GV); |
Thanks for the review. I'm going to abandon these however and instead use the support I just refactored out of ThinLTOCodeGenerator in r270698, which will do the same using a callback to get info about prevailing symbols.
test/tools/gold/X86/thinlto_linkonceresolution.ll | ||
---|---|---|
28 | Yes, this line was changed in r266752 after Mehdi changed this in the ModuleLinker, but I hadn't rebased for awhile. | |
tools/gold/gold-plugin.cpp | ||
785 | True, but that would prevent inlining. Probably better to keep the inlining opportunity intact. |
It just be just extern, not extern_weak, no?