[PATCH] D27415: [ELF] - Replace MergeOutputSection with synthetic input section MergeSection.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 28 05:40:32 PST 2017


>OK, so my understanding is this.
>
>Assume you have four mergeable string input sections .foo.1, .foo.2, .bar.1 and .bar.2, where .foo.{1,2} are writable but .bar.{1,2} are not. Also assume you have this >linker script.
>
>  .rodata : { *(.foo.*) *(.bar.*); }
>
>LLD currently creates two .rodata sections for those inputs. One for .foo.{1,2} and the other for .bar.{1,2}. This is because mergeable sections are merged based on >section attributes.
>
>Is this correct? What do you think is a correct behavior?

In addition to my previou answer:
for your example we assume foo* is "aMS" and bar* is "aM" then yes, we create 2 different output sections now,
but correct is to create one.

Latest diff of D27415 will create 4 different mergeable sections and place it into single output. Therefore we lose possible optimization, we can not merge synthetic sections foo.1 with .foo2 and bar.1 with .bar.2 after them were are created.

D29223<https://reviews.llvm.org/D29223> based on diff2 of patch above on opposite will create synthetic sections much later and is able to create 2 of them and place into single output.
And that is what I believe is the most correct way.

George.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170128/47b9c5d1/attachment.html>


More information about the llvm-commits mailing list