[all-commits] [llvm/llvm-project] 1a3f3a: [lld][ELF] __start_/__stop_ refs don't retain C-id...

Petr Hosek via All-commits all-commits at lists.llvm.org
Sat Feb 20 22:22:55 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1a3f3a3fa17909aa22958a4f06b1a357a75b1bb4
      https://github.com/llvm/llvm-project/commit/1a3f3a3fa17909aa22958a4f06b1a357a75b1bb4
  Author: Petr Hosek <phosek at google.com>
  Date:   2021-02-20 (Sat, 20 Feb 2021)

  Changed paths:
    M lld/ELF/MarkLive.cpp
    A lld/test/ELF/gc-sections-startstop.s
    R lld/test/ELF/startstop-gccollect.s

  Log Message:
  -----------
  [lld][ELF] __start_/__stop_ refs don't retain C-ident named group sections

The special root semantics for identifier-named sections is meant
specifically for the metadata sections. In the context of group
semantics, where group members are always retained or discarded as a
unit, it's natural not to have this semantics apply to a section in a
group, otherwise we would never discard the group defeating the purpose
of using the group in the first place.

This change modifies the GC behavior so that __start_/__stop_ references
don't retain C identifier named sections in section groups which allows
for these groups to be collected. This matches the behavior of BFD ld.

The only kind of existing case that might break is interdependent
metadata sections that are all in a group together, but that group
doesn't contain any other sections referenced by anything except
implicit inclusion in a `__start_` and/or `__stop_`-referenced
identifier-named section, but such cases should be unlikely.

Differential Revision: https://reviews.llvm.org/D96753




More information about the All-commits mailing list