[lld] 9220e0e - [ELF][test] Improve flag propagation when an output section does not contain input sections
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 1 09:29:39 PDT 2023
Author: Fangrui Song
Date: 2023-11-01T09:29:33-07:00
New Revision: 9220e0e647a1e4fbfb0f990117f88f171f9f2f65
URL: https://github.com/llvm/llvm-project/commit/9220e0e647a1e4fbfb0f990117f88f171f9f2f65
DIFF: https://github.com/llvm/llvm-project/commit/9220e0e647a1e4fbfb0f990117f88f171f9f2f65.diff
LOG: [ELF][test] Improve flag propagation when an output section does not contain input sections
Added:
Modified:
lld/test/ELF/linkerscript/Inputs/extend-pt-load.s
lld/test/ELF/linkerscript/extend-pt-load1.test
lld/test/ELF/linkerscript/extend-pt-load2.test
lld/test/ELF/linkerscript/extend-pt-load3.test
Removed:
################################################################################
diff --git a/lld/test/ELF/linkerscript/Inputs/extend-pt-load.s b/lld/test/ELF/linkerscript/Inputs/extend-pt-load.s
index 8993fb163346abd..3f4b37d47a8a4ba 100644
--- a/lld/test/ELF/linkerscript/Inputs/extend-pt-load.s
+++ b/lld/test/ELF/linkerscript/Inputs/extend-pt-load.s
@@ -1,3 +1,6 @@
nop
.section .data.rel.ro, "aw"
.byte 0
+
+.section .rodata,"a"
+.byte 0
diff --git a/lld/test/ELF/linkerscript/extend-pt-load1.test b/lld/test/ELF/linkerscript/extend-pt-load1.test
index 63c6f0d9ca8e063..9bec025a26adf47 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load1.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load1.test
@@ -11,6 +11,7 @@ SECTIONS {
.dynsym : {}
.hash : {}
.dynstr : {}
+ .rodata : { *(.rodata) }
.text : { *(.text) }
. = ALIGN(0x1000);
.data.rel.ro : { *(.data.rel.ro) }
@@ -19,5 +20,6 @@ SECTIONS {
# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f2 0x0001f2 R 0x1000
# CHECK-NEXT: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000001 0x000001 R E 0x1000
+# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW 0x1000
diff --git a/lld/test/ELF/linkerscript/extend-pt-load2.test b/lld/test/ELF/linkerscript/extend-pt-load2.test
index 3e91f3b4f162d07..3be94a5670d8cfe 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load2.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load2.test
@@ -11,15 +11,20 @@ SECTIONS {
.dynsym : {}
.hash : {}
.dynstr : {}
+ .rodata : { *(.rodata) }
+ foo : { sym = .; }
+
.text : { *(.text) }
bar : { . = ALIGN(0x1000); }
.data.rel.ro : { *(.data.rel.ro) }
}
-# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
-# CHECK-NEXT: bar PROGBITS 00000000000001f5 0001f5 000e0b 00 AX
-# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
+# CHECK: .rodata PROGBITS 0000000000000215 000215 000001 00 A 0
+# CHECK-NEXT: foo PROGBITS 0000000000000216 000216 000000 00 A 0
+# CHECK-NEXT: .text PROGBITS 0000000000000218 000218 000001 00 AX 0
+# CHECK-NEXT: bar PROGBITS 0000000000000219 000219 000de7 00 AX 0
+# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA 0
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
-# CHECK: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000e0c 0x000e0c R E 0x1000
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x000216 0x000216 R 0x1000
+# CHECK: LOAD 0x000218 0x0000000000000218 0x0000000000000218 0x000de8 0x000de8 R E 0x1000
# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW 0x1000
diff --git a/lld/test/ELF/linkerscript/extend-pt-load3.test b/lld/test/ELF/linkerscript/extend-pt-load3.test
index 072fe90a6461c1f..5fbeab7924303f8 100644
--- a/lld/test/ELF/linkerscript/extend-pt-load3.test
+++ b/lld/test/ELF/linkerscript/extend-pt-load3.test
@@ -11,15 +11,17 @@ SECTIONS {
.dynsym : {}
.hash : {}
.dynstr : {}
+ .rodata : { *(.rodata) }
.text : { *(.text) }
. = ALIGN(0x1000);
HIDDEN(bar_sym = .);
.data.rel.ro : { *(.data.rel.ro) }
}
-# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX
-# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA
+# CHECK: .rodata PROGBITS 00000000000001f1 0001f1 000001 00 A 0
+# CHECK: .text PROGBITS 00000000000001f4 0001f4 000001 00 AX 0
+# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000001000 001000 000001 00 WA 0
-# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f1 0x0001f1 R 0x1000
+# CHECK: LOAD 0x000000 0x0000000000000000 0x0000000000000000 0x0001f2 0x0001f2 R 0x1000
# CHECK-NEXT: LOAD 0x0001f4 0x00000000000001f4 0x00000000000001f4 0x000001 0x000001 R E 0x1000
# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000068 0x000068 RW 0x1000
More information about the llvm-commits
mailing list