[PATCH] D28481: Respect section groups in GC

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 16:56:03 PST 2017


ruiu added a comment.

At first this seems like a good change, but after thinking for a while, it started feeling that this is not a good one, as this is effectively extending the ELF format by adding a new meaning to SHT_GROUP. As per the ELF spec, SHT_GROUP is a mechanism to group and uniquify sections, and the spec doesn't say anything about GC. Even GNU linkers don't agree with each other. You could argue that it implies that sections in a SHT_GROUP need to be handled as one unit by GC, but you could also argue that it has no business with GC as it doesn't violate any specifications. So it's a dark corner, and I don't think we should rely on such thing.

I wonder if there's a different way to keep them alive. One thing I can think of is to add a dummy relocation (something like R_X86_64_NONE) to a section so that if the section is alive, the other sections will become alive, without actually doing any relocations. Does it work?


Repository:
  rL LLVM

https://reviews.llvm.org/D28481





More information about the llvm-commits mailing list