[PATCH] Entry point function should never be dead-stripped.

Shankar Kalpathi Easwaran shankarke at gmail.com
Mon Aug 12 15:23:42 PDT 2013



================
Comment at: include/lld/Core/LinkingContext.h:181-182
@@ +180,4 @@
+  void setEntrySymbolName(StringRef name) {
+    // Entry function should never be dead-stripped.
+    _deadStripRoots.push_back(name);
+    _entrySymbolName = name;
----------------
Rui Ueyama wrote:
> Shankar Kalpathi Easwaran wrote:
> > Why is this done by default ? This should be only if we are deadstripping. I think a more cleaner interface would be to add a list of atoms that we dont want to deadstrip and add the entry symbol name in that by default. 
> We can't do this only when dead stripping is enabled. If we do in that way, the result will depend on the order of method call. That means, if we set an entry symbol name and then call setDeadStripping(true) the entry symbol won't be added to dead strip root, and vice versa.
> 
> _deadStripRoots is used only when dead stripping is enabled, and the cost of adding this to the hash table should be negligible.
I was thinking to add the symbols to a deadRootSet and post-process them one at a time. This way the linker could take in a list of symbols/atoms that need to be added to the deadStripRoot set.

What do you think ?


http://llvm-reviews.chandlerc.com/D1366



More information about the llvm-commits mailing list