[PATCH] D95199: [ELF] Write output sections in PT_LOAD segment order

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 17 10:17:37 PDT 2021


MaskRay added a comment.

The summary does not convey the motivation clearly. Can you avoid referring to D95198 <https://reviews.llvm.org/D95198> but make the description of this patch self-contained?

It should mention why we need to do the sorting. More specifically, I want the two questions to be answered:

  .text 0x2000 : {*(.text*)} :ph1
  .bar 0x1000 : {*(.bar*)} :ph1

Shall we support sections with decreasing addresses within the same program header?

  .text 0x2000 : {*(.text*)} :ph1
  .foo 0 : {*(.foo*)} :ph2
  .bar 0x1000 : {*(.bar*)} :ph1

Shall we support interleaving ph1 and ph2?



================
Comment at: lld/test/ELF/linkerscript/out-of-order-sections.s:2
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo "PHDRS { \
----------------
Use `.o` for object files and prefer split-file to echo + output redirection.

See newer tests like symbol-assign-type.s


================
Comment at: lld/test/ELF/linkerscript/out-of-order-sections.s:15
+
+# CHECK:     ProgramHeaders [
+# CHECK-NEXT:  ProgramHeader {
----------------
Prefer `llvm-readelf -l` to `llvm-readobj -l`. See newer tests.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D95199



More information about the llvm-commits mailing list