[PATCH] D103815: [LLD][ELF] Fix PT_LOAD program header creation for NO_LOAD sections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 10 17:46:48 PDT 2021
MaskRay added inline comments.
================
Comment at: lld/test/ELF/linkerscript/noload.s:13
# CHECK: Type Offset VirtAddr PhysAddr
+# CHECK-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000
# CHECK-NEXT: LOAD 0x001000 0x0000000000020000 0x0000000000020000
----------------
kschwarz wrote:
> GNU ld creates the following program headers:
>
> ```
> LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x001000 RW 0x1000
> LOAD 0x000000 0x0000000000010000 0x0000000000010000 0x000000 0x001001 RW 0x1000
> LOAD 0x001000 0x0000000000020000 0x0000000000020000 0x000001 0x000001 R E 0x1000
> ```
>
> Should we create a new header whenever a section has an `addrExpr` set, similar to our condition for lmaExpr?
>
> GNU ld will only create a new header if the current section is placed at a discontiguous address.
Try merging PT_LOAD with same flags and contiguous address ranges.
Doing this rigidly can make the code more complex. In such cases we may trade the merged behavior for simpler implementation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103815/new/
https://reviews.llvm.org/D103815
More information about the llvm-commits
mailing list