[PATCH] D64880: ELF: Allow forward references to linked sections.

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 17 19:19:29 PDT 2019


MaskRay added a comment.

The latest semantics of SHF_LINK_ORDER agreed by several parties on generic-abi has the following wording:

  SHF_LINK_ORDER 
  
  This flag adds special ordering requirements for link editors. The 
  requirements apply to the referenced section identified by the sh_link 
  field of this section's header.  If this section is combined with other 
  sections in the output file, the section must appear in the same 
  relative order with respect to those sections, as the referenced 
  section appears with respect to sections the referenced section is 
  combined with. 
  
  A typical use of this flag is to build a table that references 
  text or data sections in address order. 
  
  In addition to adding ordering requirements, SHF_LINK_ORDER indicates 
  that the section contains metadata describing the referenced section. 
  When performing unused section elimination, the link editor should 
  ensure that both the section and the referenced section are retained 
  or discarded together. Furthermore, relocations from this section 
  into the referenced section should not be taken as evidence that the 
  referenced section should be retained. 

Allowing forward references is natural and does not conflict with the wording. LGTM.



================
Comment at: lld/test/ELF/linkorder-forward-ref.test:5
+# RUN: llvm-readelf -S %t | FileCheck %s
+
+# CHECK: .linkorder
----------------
This test needs a comment explaining what it intends to test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64880





More information about the llvm-commits mailing list