Skip to content

Commit

Permalink
[ELF] Set up initial live symbol(s) to avoid incorrect reclaim of atoms.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dcci committed Feb 27, 2015
1 parent b832926 commit b65719a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lld/lib/ReaderWriter/ELF/ELFLinkingContext.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit b65719a

Please sign in to comment.