[PATCH] D67761: [ELF] Error if the linked-to section of a SHF_LINK_ORDER section is discarded

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 01:57:57 PDT 2019


grimar added a comment.

In D67761#1675371 <https://reviews.llvm.org/D67761#1675371>, @MaskRay wrote:

> >> If sh_link(a)=b && a has SHF_LINK_ORDER, we currently place a in b's dependentSections list
> > 
> > I need to check for tests and previous commits on this.
>
> If we drop the rule, we'll have to tune the SHF_LINK_ORDER rule a bit in MarkLive.cpp. As a plus(?), we'll improve compatibility with ld.bfd.
>
> For linkerscript/discard-section-metadata.s (4 sections formed as an rooted tree via sh_link), ld.bfd errors:
>
>   % ld.bfd -T a.script a -o b
>   ld.bfd: b: sh_link of section `.bar' points to discarded section `.foo' of `a'
>


Switching to ld.bfd behavior looks OK to me. It is a bit more strict and would simplify this patch it seems.
Interesting what other people think.


Repository:
  rLLD LLVM Linker

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

https://reviews.llvm.org/D67761





More information about the llvm-commits mailing list