[PATCH] D28481: Respect section groups in GC

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 17:06:52 PST 2017


rnk added a comment.

In https://reviews.llvm.org/D28481#640798, @ruiu wrote:

> 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?


Currently, linker GC retains all data in sections referenced by __start_$section __stop_$section. We need to suppress that retention in addition to establishing this inverse reference. How do you propose to do that?

This behavior should also already be suppressed for normal comdat section groups. Consider this assembly: https://ghostbin.com/paste/v5qrp The .init_array global is in a comdat section, and should not be retained by the linker if 'x' is unreferenced.


Repository:
  rL LLVM

https://reviews.llvm.org/D28481





More information about the llvm-commits mailing list