[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 05:33:11 PDT 2016

> I would probably try to produce multiple output sections then.
> My consern is that for non script case we currently have Alignment as a part of key for these sections:
>   // For SHF_MERGE we create different output sections for each alignment.
>   // This makes each output section simple and keeps a single level mapping from
>   // input to output.
>   uintX_t Alignment = 0;
>   if (isa<MergeInputSection<ELFT>>(C))
>     Alignment = std::max(H->sh_addralign, H->sh_entsize);
> 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.


More information about the llvm-commits mailing list