[PATCH] D71157: [ELF] Refine section group --gc-sections rules to not discard .debug_types

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 10 23:47:34 PST 2019


MaskRay marked an inline comment as done.
MaskRay added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:500
 
 template <class ELFT>
+static void handleSectionGroup(ArrayRef<InputSectionBase *> sections,
----------------
ruiu wrote:
> Could you add a function comment to explain what the section group is and what this function is supposed to do?
How about

```
--- i/lld/ELF/InputFiles.cpp
+++ w/lld/ELF/InputFiles.cpp
@@ -498,4 +498,5 @@ static void addDependentLibrary(StringRef specifier, const InputFile *f) {
 }
 
+// Check if members of the section group can be discarded.
 template <class ELFT>
 static void handleSectionGroup(ArrayRef<InputSectionBase *> sections,
```

? The most useful comment is below

  // If any member has the SHF_ALLOC flag, the whole group is subject to garbage
  // collection. See the comment in markLive(). This rule retains .debug_types
  // and .rela.debug_types.

So the function comment probably should not repeat that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71157





More information about the llvm-commits mailing list