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

Rui Ueyama ruiu at google.com
Mon Aug 12 15:16:55 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;
----------------
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.


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



More information about the llvm-commits mailing list