Skip to content

Commit 73e07e9

Browse files
committed
[ELF] Add RW then text test
Currently, lld assigns RF_NOT_SPECIAL so that orphan .interp and SHT_NOTE are always before other sections. GNU ld doesn't do so. The next change will remove RF_NOT_SPECIAL.
1 parent 692ae54 commit 73e07e9

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lld/test/ELF/linkerscript/orphan.s

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@
5353
# ONLY-RW-NEXT: .rw3 PROGBITS 0000000000001{{...}} 0
5454
# ONLY-RW-NEXT: .bss NOBITS 0000000000001{{...}} 0
5555

56+
# RUN: ld.lld a.o -T rw-text.lds -o rw-text
57+
# RUN: llvm-readelf -S rw-text | FileCheck %s --check-prefix=RW-TEXT
58+
# RW-TEXT: .interp PROGBITS 00000000000002{{..}} 0
59+
# RW-TEXT-NEXT: .note.my NOTE 00000000000002{{..}} 0
60+
# RW-TEXT-NEXT: .jcr PROGBITS 00000000000002{{..}} 0
61+
# RW-TEXT-NEXT: .rw1 PROGBITS 00000000000002{{..}} 0
62+
# RW-TEXT-NEXT: .rw2 PROGBITS 00000000000002{{..}} 0
63+
# RW-TEXT-NEXT: .rw3 PROGBITS 00000000000002{{..}} 0
64+
# RW-TEXT-NEXT: .bss NOBITS 00000000000002{{..}} 0
65+
# RW-TEXT-NEXT: .text PROGBITS 0000000000001{{...}} 0
66+
# RW-TEXT-NEXT: .mytext PROGBITS 0000000000001{{...}} 0
67+
5668
#--- a.s
5769
.section .rw1, "aw"; .byte 0
5870
.section .rw2, "aw"; .byte 0
@@ -92,3 +104,11 @@ SECTIONS {
92104
.rw1 : { *(.rw1) }
93105
. = ALIGN(CONSTANT(MAXPAGESIZE));
94106
}
107+
108+
#--- rw-text.lds
109+
SECTIONS {
110+
. = SIZEOF_HEADERS;
111+
.rw1 : { *(.rw1) }
112+
. = ALIGN(CONSTANT(MAXPAGESIZE));
113+
.text : { *(.text) }
114+
}

0 commit comments

Comments
 (0)