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

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 09:02:46 PDT 2019


MaskRay added a comment.

>> 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'

In the SHF_LINK_ORDER area, we seem to have some extensions that haven't been discussed with GNU developers. I am happy with the extensions but I think GNU developers should be informed.

1. non-alloc SHF_LINK_ORDER  https://sourceware.org/bugzilla/show_bug.cgi?id=25021
2. If A has the SHF_LINK_ORDER flag && sh_link(A)=B,   retained B implies retained A. The converse is not clear. https://sourceware.org/bugzilla/show_bug.cgi?id=24526 posted in May but no comments yet.


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