[PATCH] D38790: [ELF] Do not keep symbols if they referenced only from discarded sections.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 14 00:21:13 PST 2017
ruiu added inline comments.
================
Comment at: ELF/MarkLive.cpp:65
+ // For non-weak DSO symbols, mark the file to be added to a DT_NEEDED entry.
+ if (S->isWeak())
+ return;
----------------
Why do you have to exclude weak symbols? Please expand (or replace) the comment to explain why this code should be like this.
================
Comment at: ELF/MarkLive.cpp:281
+ for (InputFile *F : ObjectFiles)
+ for (Symbol *S : cast<ObjFile<ELFT>>(F)->getLocalSymbols())
+ markSymbolLive<ELFT>(S);
----------------
Can't you just use getSymbols instead of getLocalSymbols?
================
Comment at: ELF/MarkLive.cpp:310-312
+ // Set Live flag for all symbols which survived.
+ // We already marked some of them in resolveReloc(), but if a symbol just
+ // points to a section and is not used in any relocation we haven't seen it.
----------------
Why do you need to keep such symbols? It seems like practically you can just ignore such symbols.
https://reviews.llvm.org/D38790
More information about the llvm-commits
mailing list