[lld] 8e297c7 - [ELF] Improve --ro-rosegment tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 19:06:00 PST 2024
Author: Fangrui Song
Date: 2024-02-08T19:05:55-08:00
New Revision: 8e297c779635d7f22626c1a9dd1cb9dc86ea6540
URL: https://github.com/llvm/llvm-project/commit/8e297c779635d7f22626c1a9dd1cb9dc86ea6540
DIFF: https://github.com/llvm/llvm-project/commit/8e297c779635d7f22626c1a9dd1cb9dc86ea6540.diff
LOG: [ELF] Improve --ro-rosegment tests
Added:
Modified:
lld/test/ELF/segments.s
Removed:
################################################################################
diff --git a/lld/test/ELF/segments.s b/lld/test/ELF/segments.s
index 614f6e72dc43c..ee171174ac7ca 100644
--- a/lld/test/ELF/segments.s
+++ b/lld/test/ELF/segments.s
@@ -9,11 +9,24 @@
# ROSEGMENT: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
# ROSEGMENT-NEXT: PHDR 0x000040 0x0000000000200040 0x0000000000200040 0x000118 0x000118 R 0x8
-# ROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x00015a 0x00015a R 0x1000
+# ROSEGMENT-NEXT: LOAD 0x000000 0x0000000000200000 0x0000000000200000 0x00015b 0x00015b R 0x1000
# ROSEGMENT-NEXT: LOAD 0x00015c 0x000000000020115c 0x000000000020115c 0x000003 0x000003 R E 0x1000
# ROSEGMENT-NEXT: LOAD 0x00015f 0x000000000020215f 0x000000000020215f 0x000002 0x000002 RW 0x1000
# ROSEGMENT-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
+# RUN: ld.lld --rosegment a.o -T a.lds -o ro1
+# RUN: llvm-readelf -l ro1 | FileCheck --check-prefix=ROSEGMENT1 %s
+
+# ROSEGMENT1: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
+# ROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000001 0x000001 R 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x001004 0x0000000000000004 0x0000000000000004 0x000002 0x000002 R E 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x001006 0x0000000000000006 0x0000000000000006 0x000001 0x000001 RW 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000001 0x000001 R E 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x001008 0x0000000000000008 0x0000000000000008 0x000001 0x000001 R 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000
+# ROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R 0x1000
+# ROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
+
# RUN: ld.lld --no-rosegment a.o -o noro
# RUN: llvm-readelf -l noro | FileCheck --check-prefix=NOROSEGMENT %s
@@ -27,10 +40,11 @@
# RUN: llvm-readelf -l noro1 | FileCheck --check-prefix=NOROSEGMENT1 %s
# NOROSEGMENT1: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# NOROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000007 0x000007 R E 0x1000
-# NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000001 0x000001 RW 0x1000
-# NOROSEGMENT1-NEXT: LOAD 0x001008 0x0000000000000008 0x0000000000000008 0x000001 0x000001 R E 0x1000
+# NOROSEGMENT1-NEXT: LOAD 0x001000 0x0000000000000000 0x0000000000000000 0x000006 0x000006 R E 0x1000
+# NOROSEGMENT1-NEXT: LOAD 0x001006 0x0000000000000006 0x0000000000000006 0x000001 0x000001 RW 0x1000
+# NOROSEGMENT1-NEXT: LOAD 0x001007 0x0000000000000007 0x0000000000000007 0x000002 0x000002 R E 0x1000
# NOROSEGMENT1-NEXT: LOAD 0x001009 0x0000000000000009 0x0000000000000009 0x000001 0x000001 RW 0x1000
+# NOROSEGMENT1-NEXT: LOAD 0x00100a 0x000000000000000a 0x000000000000000a 0x000001 0x000001 R E 0x1000
# NOROSEGMENT1-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
# RUN: ld.lld -N a.o -o omagic
@@ -46,7 +60,7 @@
# RUN: ld.lld --nmagic a.o -o - | cmp nmagic -
# NMAGIC: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
-# NMAGIC-NEXT: LOAD 0x000120 0x0000000000200120 0x0000000000200120 0x000002 0x000002 R 0x1
+# NMAGIC-NEXT: LOAD 0x000120 0x0000000000200120 0x0000000000200120 0x000003 0x000003 R 0x1
# NMAGIC-NEXT: LOAD 0x000124 0x0000000000200124 0x0000000000200124 0x000003 0x000003 R E 0x4
# NMAGIC-NEXT: LOAD 0x000127 0x0000000000200127 0x0000000000200127 0x000002 0x000002 RW 0x1
# NMAGIC-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0
@@ -64,12 +78,16 @@ _start:
.section .rw2,"aw"; .byte 3
.section .rx2,"ax"; .byte 2
+.section .ro3,"a"; .byte 1
+
#--- a.lds
SECTIONS {
.ro1 : {}
.text : {}
- .rx : { *(.rx*) }
+ .rx1 : {}
.rw1 : {}
+ .rx2 : {}
.ro2 : {}
.rw2 : {}
+ .ro3 : {}
}
More information about the llvm-commits
mailing list