diff options
| author | Davide Italiano <davide@freebsd.org> | 2015-02-27 06:41:46 +0000 |
|---|---|---|
| committer | Davide Italiano <davide@freebsd.org> | 2015-02-27 06:41:46 +0000 |
| commit | b65719ae7812e0403c98a6aa46443e2052a882a2 (patch) | |
| tree | 7ef75c0e494b909262e8236cdad516593ef99031 | |
| parent | b832926176b7d533f9cb3f0406275551bc0a4a90 (diff) | |
| download | bcm5719-llvm-b65719ae7812e0403c98a6aa46443e2052a882a2.tar.gz bcm5719-llvm-b65719ae7812e0403c98a6aa46443e2052a882a2.zip | |
[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
llvm-svn: 230737
| -rw-r--r-- | lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp index f458a809c55..eb7734c6739 100644 --- a/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp +++ b/lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp @@ -106,6 +106,10 @@ bool ELFLinkingContext::validateImpl(raw_ostream &diagnostics) { _writer = createWriterELF(this->targetHandler()); break; } + + // If -dead_strip, set up initial live symbols. + if (deadStrip()) + addDeadStripRoot(entrySymbolName()); return true; } |

