[PATCH] D35339: Delay removal of pubtypes and pubnames

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 03:31:35 PDT 2017


grimar added a comment.

This looks fine for me as is too, but have few ideas to share.



================
Comment at: ELF/InputFiles.cpp:511
-      (Name == ".debug_gnu_pubnames" || Name == ".debug_gnu_pubtypes"))
-    return &InputSection::Discarded;
-
----------------
What about leaving it here (for consistency with others discarded sections), but marking as dead from start ?

```
  if (Config->GdbIndex &&
      (Name == ".debug_gnu_pubnames" || Name == ".debug_gnu_pubtypes")) {
   InputSectionBase *Sec = make<InputSection>(this, &Sec, Name);
   Script->discard({Sec});
   return Sec;
}
```



================
Comment at: ELF/SyntheticSections.cpp:1763
 
-static std::vector<InputSection *> getDebugInfoSections() {
+static std::vector<InputSection *> filterForGdbIndex() {
   std::vector<InputSection *> Ret;
----------------
Then this can remain `getDebugInfoSections`.

Or even we can have
`GdbIndexSection::addDebugInfo()` and call it during `createInputSection()` to
avoid scanning over input sections at all (though not sure how much iterating over
all input sections hits perfomance).


https://reviews.llvm.org/D35339





More information about the llvm-commits mailing list