[PATCH] D33485: [ELF] - Do not allow -r to eat comdats.

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 25 02:52:17 PDT 2017


grimar added a comment.

In https://reviews.llvm.org/D33485#763648, @ruiu wrote:

> In general, I think we pass through all input sections to an output when the -r option is given. But in this patch you deduplicates comdat groups. Do you need that?


I was need it for relocatable-eh-frame.s

It has next code:

  .section .foo,"aG", at progbits,bar,comdat
  .cfi_startproc
  .cfi_endproc

And uses this file twice with -r:

  # RUN: ld.lld -r %t.o %t.o -o %t

Content inside a single object is something like .group (SHT_GROUP) + .foo sections.
Now if we do not do deduplication then 2 .group input sections will be merged into single output .group and
have content like [flag, section index, flag, section index] which is just broken. .foo's will be merged too.
We probably, like Rafael mentioned, can have 2 group sections with same signature and do emit separate sections for .foo's as well,
but deduplication seems much easier solution and itself works as some cheap output optimization.


https://reviews.llvm.org/D33485





More information about the llvm-commits mailing list