[PATCH] D19530: ModuleLinker: Import linkonce even when they have no use
Mehdi AMINI via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 26 03:44:13 PDT 2016
joker.eph created this revision.
joker.eph added a reviewer: rafael.
joker.eph added a subscriber: llvm-commits.
If the linker decided that LTO is supposed to provide the
"Prevailing" definition for a symbol, and ask the symbol
to be "preserved", then we should honor it and make sure
the symbol is emitted.
Here we import useless definition in some cases, but we
can rely on GlobalDCE to delete them after (unless the
linker requested us to preserve them).
A bunch of tests are failing:
Failing Tests (5):
LLVM :: Linker/comdat12.ll
LLVM :: Linker/internalize-lazy.ll
LLVM :: Linker/only-needed-named-metadata.ll
LLVM :: Linker/pr21494.ll
LLVM :: tools/lto/hide-linkonce-odr.ll
So I'm not sure at this point this is the right fix, but I'm
eager to get feedback on how to solve this.
http://reviews.llvm.org/D19530
Files:
lib/Linker/LinkModules.cpp
Index: lib/Linker/LinkModules.cpp
===================================================================
--- lib/Linker/LinkModules.cpp
+++ lib/Linker/LinkModules.cpp
@@ -392,8 +392,7 @@
if (!doImportAsDefinition(&GV))
return false;
} else if (!DGV && !shouldOverrideFromSrc() &&
- (GV.hasLocalLinkage() || GV.hasLinkOnceLinkage() ||
- GV.hasAvailableExternallyLinkage()))
+ (GV.hasAvailableExternallyLinkage()))
return false;
if (GV.isDeclaration())
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19530.54989.patch
Type: text/x-patch
Size: 510 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/c6a9a56f/attachment.bin>
More information about the llvm-commits
mailing list