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

Rui Ueyama ruiu at google.com
Mon Aug 12 15:34:41 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:
> 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 ?
Well, is that going to be cleaner than this? When we call setEntrySymbolName() we haven't read any file, so we can't make an atom or defined symbol for the given symbol name. We could find an atom for the given name after files are read, but that's what Resolver.cpp does, I think?


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



More information about the llvm-commits mailing list