[PATCH] D103815: [LLD][ELF] Fix PT_LOAD program header creation for NO_LOAD sections
Konstantin Schwarz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 9 06:53:37 PDT 2021
kschwarz updated this revision to Diff 350886.
kschwarz added a comment.
Remove the check for noload, adapt existing tests
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103815/new/
https://reviews.llvm.org/D103815
Files:
lld/ELF/Writer.cpp
lld/test/ELF/linkerscript/nobits-offset.s
lld/test/ELF/linkerscript/noload.s
Index: lld/test/ELF/linkerscript/noload.s
===================================================================
--- lld/test/ELF/linkerscript/noload.s
+++ lld/test/ELF/linkerscript/noload.s
@@ -10,8 +10,12 @@
# CHECK-NEXT: .no_input_sec_noload NOBITS 0000000000011000 [[OFF]] 000001
# CHECK: Type Offset VirtAddr PhysAddr
+# CHECK-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000
# CHECK-NEXT: LOAD 0x001000 0x0000000000020000 0x0000000000020000
+# CHECK: 00 .data_noload_a .data_noload_b .no_input_sec_noload {{$}}
+# CHECK: 01 .text {{$}}
+
#--- asm
.section .text,"ax", at progbits
nop
Index: lld/test/ELF/linkerscript/nobits-offset.s
===================================================================
--- lld/test/ELF/linkerscript/nobits-offset.s
+++ lld/test/ELF/linkerscript/nobits-offset.s
@@ -14,14 +14,16 @@
# CHECK: Name Type Address Off Size
# CHECK-NEXT: NULL 0000000000000000 000000 000000
-# CHECK-NEXT: .text PROGBITS 0000000000000000 000158 000000
-# CHECK-NEXT: .sec1 NOBITS 0000000000000000 000158 000001
-# CHECK-NEXT: .bss NOBITS 0000000000000400 000400 000001
+# CHECK-NEXT: .text PROGBITS 0000000000000000 000190 000000
+# CHECK-NEXT: .sec1 NOBITS 0000000000000000 001000 000001
+# CHECK-NEXT: .bss NOBITS 0000000000000400 001400 000001
# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# CHECK-NEXT: LOAD 0x000400 0x0000000000000400 0x0000000000000400 0x000000 0x000001 RW 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000000 0x000001 R 0x1000
+# CHECK-NEXT: LOAD 0x001400 0x0000000000000400 0x0000000000000400 0x000000 0x000001 RW 0x1000
-# CHECK: 00 .bss {{$}}
+# CHECK: 00 .sec1 {{$}}
+# CHECK: 01 .bss {{$}}
.bss
.p2align 10
Index: lld/ELF/Writer.cpp
===================================================================
--- lld/ELF/Writer.cpp
+++ lld/ELF/Writer.cpp
@@ -2296,7 +2296,7 @@
}
static bool needsPtLoad(OutputSection *sec) {
- if (!(sec->flags & SHF_ALLOC) || sec->noload)
+ if (!(sec->flags & SHF_ALLOC))
return false;
// Don't allocate VA space for TLS NOBITS sections. The PT_TLS PHDR is
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103815.350886.patch
Type: text/x-patch
Size: 2255 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210609/62cc197b/attachment.bin>
More information about the llvm-commits
mailing list