diff options
author | Fangrui Song <i@maskray.me> | 2024-05-30 11:12:54 -0700 |
---|---|---|
committer | Fangrui Song <i@maskray.me> | 2024-05-30 11:12:55 -0700 |
commit | 73e07e924470ebab76a634e41fadf425a859e0ea (patch) | |
tree | 6c6f6597fa87a9c3bc799f6f346002fa0ffa4210 | |
parent | 692ae5443b1778e138527ef55d799a4b535a36f9 (diff) | |
download | llvm-73e07e924470ebab76a634e41fadf425a859e0ea.zip llvm-73e07e924470ebab76a634e41fadf425a859e0ea.tar.gz llvm-73e07e924470ebab76a634e41fadf425a859e0ea.tar.bz2 |
[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.
-rw-r--r-- | lld/test/ELF/linkerscript/orphan.s | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lld/test/ELF/linkerscript/orphan.s b/lld/test/ELF/linkerscript/orphan.s index a929d52..cff6a3e 100644 --- a/lld/test/ELF/linkerscript/orphan.s +++ b/lld/test/ELF/linkerscript/orphan.s @@ -53,6 +53,18 @@ # ONLY-RW-NEXT: .rw3 PROGBITS 0000000000001{{...}} 0 # ONLY-RW-NEXT: .bss NOBITS 0000000000001{{...}} 0 +# RUN: ld.lld a.o -T rw-text.lds -o rw-text +# RUN: llvm-readelf -S rw-text | FileCheck %s --check-prefix=RW-TEXT +# RW-TEXT: .interp PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .note.my NOTE 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .jcr PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .rw1 PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .rw2 PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .rw3 PROGBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .bss NOBITS 00000000000002{{..}} 0 +# RW-TEXT-NEXT: .text PROGBITS 0000000000001{{...}} 0 +# RW-TEXT-NEXT: .mytext PROGBITS 0000000000001{{...}} 0 + #--- a.s .section .rw1, "aw"; .byte 0 .section .rw2, "aw"; .byte 0 @@ -92,3 +104,11 @@ SECTIONS { .rw1 : { *(.rw1) } . = ALIGN(CONSTANT(MAXPAGESIZE)); } + +#--- rw-text.lds +SECTIONS { + . = SIZEOF_HEADERS; + .rw1 : { *(.rw1) } + . = ALIGN(CONSTANT(MAXPAGESIZE)); + .text : { *(.text) } +} |