Commit
1a3f3a3fa17909aa22958a4f06b1a357a75b1bb4
by phosek
[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.