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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 11 20:22:42 PST 2019


ruiu added inline comments.


================
Comment at: lld/ELF/InputFiles.cpp:500
 
 template <class ELFT>
+static void handleSectionGroup(ArrayRef<InputSectionBase *> sections,
----------------
MaskRay wrote:
> 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.
It's more like

Record the membership of a section group so that in the garbage collection pass,
section group members are kept or discarded as a unit.

?


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