[PATCH] D65909: ELF: Move sections referred to by __start_/__stop_ symbols into the main partition.
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 7 19:06:57 PDT 2019
MaskRay added a comment.
Makes sense. A couple of nits:
================
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) {
----------------
`DenseSet<StringRef>` can avoid allocation for strings.
================
Comment at: lld/ELF/MarkLive.cpp:308
+ StringRef name = s->getName();
+ if (name.startswith("__start_"))
+ startStopSymbolNames.insert(name.substr(8));
----------------
```
if (name.consume_front("__start_") || name.consume_front("__stop_"))
startStopSymbolNames.insert(name);
```
================
Comment at: lld/test/ELF/partition-move-to-main-startstop.s:17
+
+// CHECK-NOT: has_startstop
+// CHECK: no_startstop
----------------
You can also use `FileCheck %s --implicit-check-not=has_startstop` and delete `CHECK-NOT:`
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