[PATCH] D14140: [ELF2] SECTIONS command basic support

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 31 08:48:22 PDT 2015


I think this falls in the category of undefined behaviors if there was a
spec of the linker script. Since there's no standard or specification for
the linker script, we need to do something that we think reasonable. A
pitfall we want to avoid is to copy every detail of the GNU linker. So can
you please minimize the impact of the patch to the regular flow? I'd
restore code for __start/__stop symbols and for RegularSections, and
reorder "non-regular" sections if instructed to do so.

On Fri, Oct 30, 2015 at 2:53 AM, Denis Protivensky <
dprotivensky at accesssoftek.com> wrote:

> denis-protivensky added a comment.
>
> > I don't think we need that protection. If users try to reorder such
>
> >  sections, we should do that as instructed, no?
>
>
> First of all, I reproduced the case when defining 'specific' section in
> the SECTIONS command affects its ordering in the resulting file without the
> check, so this check works as I expected.
>
> Concerning ordering of 'specific' sections:
> The goal of the SECTIONS command is to layout sections from input files to
> the corresponding output sections. 'Specific' sections as .got, .plt,
> .interp and most others don't have input sections at all and are generated
> by the linker logic. This means that we cannot affect the contents of such
> sections, and the output section description command of format
>
>   .interp : { *(.interp) }
>
> is void because there are no input .interp sections, and such empty output
> sections are discarded by linker rules. The only way this format of command
> worked is to define custom .interp section (possibly of
> SHT_PROGBITS/_NOBITS type). Then it will be considered during layout, but
> that's a specific case and it's checked in tests (with .shstrtab custom
> section).
> I conclude that output section descriptions affect only PROGBITS/NOBITS
> section types, which are represented as OutputSection/MergeOutputSection in
> lld, and we currently create only these sections from output section
> descriptions.
> That's why I think the ordering should also affect only these sections,
> which are stored in `RegularSections` map in code.
>
> Just as a note: ld doesn't seem as well to reorder 'specific' sections
> even if defined in linker script.
>
>
> http://reviews.llvm.org/D14140
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151031/a6a57f63/attachment.html>


More information about the llvm-commits mailing list