[lld] r231545 - PECOFF: Do not add extraneous symbols to the dead strip root.
Rui Ueyama
ruiu at google.com
Fri Mar 6 17:35:50 PST 2015
Author: ruiu
Date: Fri Mar 6 19:35:50 2015
New Revision: 231545
URL: http://llvm.org/viewvc/llvm-project?rev=231545&view=rev
Log:
PECOFF: Do not add extraneous symbols to the dead strip root.
Previously we added all undefined symbols found in object files to
the dead strip root. This patch makes the linker to stop doing that.
Undefined symbols would be resolved anyway, so this patch doesn't
change the linker behavior. It should slightly improve performance
but it's really marginal. This is a cleanup.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=231545&r1=231544&r2=231545&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Fri Mar 6 19:35:50 2015
@@ -375,8 +375,10 @@ void FileCOFF::beforeLink() {
// Add /INCLUDE'ed symbols to the file as if they existed in the
// file as undefined symbols.
- for (StringRef sym : undefSyms)
+ for (StringRef sym : undefSyms) {
addUndefinedSymbol(sym);
+ _ctx.addDeadStripRoot(sym);
+ }
// One can define alias symbols using /alternatename:<sym>=<sym> option.
// The mapping for /alternatename is in the context object. This helper
@@ -387,10 +389,6 @@ void FileCOFF::beforeLink() {
// SEH. Disable SEH if the file being read is not compatible.
if (!isCompatibleWithSEH())
_ctx.setSafeSEH(false);
-
- if (_ctx.deadStrip())
- for (const UndefinedAtom *undef : undefined())
- _ctx.addDeadStripRoot(undef->name());
}
/// Iterate over the symbol table to retrieve all symbols.
More information about the llvm-commits
mailing list