[PATCH] D61186: [LLD][ELF] /DISCARD/ output sections should not be orphans

Andrew Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 09:05:13 PDT 2019


andrewng added a comment.

In D61186#1482564 <https://reviews.llvm.org/D61186#1482564>, @peter.smith wrote:

> Just to clarify my understanding, are you referring to (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/4/html/Using_ld_the_GNU_Linker/sections.html#OUTPUT-SECTION-PHDR)
>
> >   If a section is assigned to one or more segments, then all subsequent allocated sections will be assigned to those segments as well, unless they use an explicitly :phdr modifier. You can use :NONE to tell the linker to not put the section in any segment at all.
>
> Something like:
>
>   /DISCARD/ : { *(.comment) } :my_phdr
>    .name : { *(.name) }
>   ...
>
>
> Where we'd want .name to to be assigned to my_phdr and any following OutputSections? I can see that this is how ld.bfd and ld.gold behave, although as you say this is somewhat of a contrived example.


Yes, very unlikely but unfortunately possible.

> I'm with George in that we shouldn't output the /DISCARD/ as a SectionHeader as it isn't really an OutputSection, although as I understand it this is not a correctness problem. If we don't fix it in this patch can we add a FIXME ann/or raise a PR so that we know that we have a problem?

I think a PR would be the way to go.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61186/new/

https://reviews.llvm.org/D61186





More information about the llvm-commits mailing list