[PATCH] D23924: [ELF] - Linkerscript: allow add MergeInputSection to regular OutputSection.

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 09:03:22 PDT 2016


>> Following above logic we can have many of them.
>> That returns us to the point where 7 .rodata sections was produced by lld fro FreeBSD kernel.
>> So is it fine ?
>
> Yes, I think it is fine. The main reason being that anything using
> sections at runtime with ELF is doing something odd. Sections are a
> static link time concept and are optional at runtime. Given that it is
> important that we produce symbols that point to the correct bits, but
> we can produce any number of output sections.

I was able to write a script that shows that symbols in merge sections
are already pretty broken:

.abc : { zed0 = .; *(.foo); zed1 = .; *(.bar);  zed2 = .; *(.zed); zed3 = .; }

running it on

        .section        .foo,"aMS", at progbits,1
        .asciz  "abc123"

        .section        .bar,"aMS", at progbits,1
        .asciz  "aabc123"

        .section        .zed,"aMS", at progbits,1
        .asciz  "x"

causes the symbols to point to pretty much arbitrary places when the
strings are merged. Given that, I am pretty sure we  can produce
multiple output sections and just error if there is a symbol
definition in a SHF_MERGE output section.

Cheers,
Rafael


More information about the llvm-commits mailing list