[PATCH] D65909: ELF: Move sections referred to by __start_/__stop_ symbols into the main partition.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 8 01:02:08 PDT 2019


ruiu added inline comments.


================
Comment at: lld/ELF/MarkLive.cpp:299
 template <class ELFT> void MarkLive<ELFT>::moveToMain() {
-  for (InputFile *file : objectFiles)
-    for (Symbol *s : file->getSymbols())
+  StringSet<> startStopSymbolNames;
+  for (InputFile *file : objectFiles) {
----------------
MaskRay wrote:
> `DenseSet<StringRef>` can avoid allocation for strings.
In this patch you scan over all input files and their symbol tables to see if there's a symbol starting with "__start_" or "__stop_", but do you have to do this that way? I mean

1. most section names are not a valid C identifier in the first place,
2. if section whose name "foo" exists, look up the symbol table with "__start_foo" and "__end_foo" to see if there's a symbol that refer to the start/end of the sectoin

Am I missing somehting?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D65909/new/

https://reviews.llvm.org/D65909





More information about the llvm-commits mailing list