[lld] r230737 - [ELF] Set up initial live symbol(s) to avoid incorrect reclaim of atoms.
Davide Italiano
davide at freebsd.org
Thu Feb 26 22:41:47 PST 2015
Author: davide
Date: Fri Feb 27 00:41:46 2015
New Revision: 230737
URL: http://llvm.org/viewvc/llvm-project?rev=230737&view=rev
Log:
[ELF] Set up initial live symbol(s) to avoid incorrect reclaim of atoms.
If no initial live symbols are set up, and deadStrip() == true,
the Resolver ends up reclaiming all the symbols that aren't absolute. This is wrong.
This patch fixes the issue by setting entrySymbolName() as live, and this allows
us to self-host lld when --gc-sections is enabled. There are still quite a few problems
with --gc-sections (test failures), so the option can't be enabled by default.
Differential Revision: D7926
Reviewed by: ruiu, shankarke
Modified:
lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
Modified: lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp?rev=230737&r1=230736&r2=230737&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp (original)
+++ lld/trunk/lib/ReaderWriter/ELF/ELFLinkingContext.cpp Fri Feb 27 00:41:46 2015
@@ -106,6 +106,10 @@ bool ELFLinkingContext::validateImpl(raw
_writer = createWriterELF(this->targetHandler());
break;
}
+
+ // If -dead_strip, set up initial live symbols.
+ if (deadStrip())
+ addDeadStripRoot(entrySymbolName());
return true;
}
More information about the llvm-commits
mailing list