[PATCH] D96753: [lld][ELF] Don't consider C identifier-named sections as GC roots

Roland McGrath via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 13:14:59 PST 2021


mcgrathr accepted this revision.
mcgrathr added a comment.
This revision is now accepted and ready to land.

I think this clearly the correct semantics.  The whole purpose of groups really is for GC and de-dup behavior.  The "automatic" anchor semantics for identifier-named sections clearly only makes sense for sections outside groups where there is no other way to tell if they are meant to be referenced.  When such a section is in a group, it clearly is meant to go with the symbol-referenced entities defined in the group (i.e. the function or data object whose symbol is the group's signature symbol in the COMDAT case).  Group semantics require that the whole group be kept or discarded together, so if an identifier-named section within a group were always kept, then that whole group must always be kept--keeping the identifier named sections while discarding others in the same group would clearly be a bug by the spec.  Keeping the whole group because of the identifier-named section inside it is clearly not correct for GC or COMDAT cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96753



More information about the llvm-commits mailing list