[PATCH] [ELF] Set up initial live symbol(s) to avoid incorrect reclaim of atoms
Davide Italiano
davide at freebsd.org
Thu Feb 26 17:25:58 PST 2015
Hi ruiu, shankarke, Bigcheese, kledzik,
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 (quite a few tests failing), so the option can't be enabled by default.
P.S. This particular change depends on --gc-section so can't be tested easily. I would like to commit it as is and start looking at the test failures. I'll eventually add an unit test for this when --gc-sections will be enabled.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D7926
Files:
lib/ReaderWriter/ELF/ELFLinkingContext.cpp
Index: lib/ReaderWriter/ELF/ELFLinkingContext.cpp
===================================================================
--- lib/ReaderWriter/ELF/ELFLinkingContext.cpp
+++ lib/ReaderWriter/ELF/ELFLinkingContext.cpp
@@ -106,6 +106,11 @@
_writer = createWriterELF(this->targetHandler());
break;
}
+
+ // If -dead_strip, set up initial live symbols.
+ if (deadStrip())
+ // Entry point is live.
+ addDeadStripRoot(entrySymbolName());
return true;
}
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D7926.20812.patch
Type: text/x-patch
Size: 469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150227/07366741/attachment.bin>
More information about the llvm-commits
mailing list