1# REQUIRES: x86
2# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
3# RUN: echo "SECTIONS {       \
4# RUN:  .text : { *(.text) }  \
5# RUN:  .rw1 : { *(.rw1) }    \
6# RUN:  .rw2 : { *(.rw2) }    \
7# RUN:  .rw3 : { *(.rw3) }    \
8# RUN: }" > %t.script
9# RUN: ld.lld -o %t1 --script %t.script %t
10# RUN: llvm-objdump --section-headers %t1 | FileCheck %s
11
12## .jcr is a relro section and should be placed before other RW sections.
13## .bss is SHT_NOBITS section and should be last RW section, so some space
14## in ELF file could be saved.
15# CHECK:       0               00000000 0000000000000000
16# CHECK-NEXT:  1 .text         00000000 0000000000000000 TEXT
17# CHECK-NEXT:  2 .jcr          00000008 0000000000000000 DATA
18# CHECK-NEXT:  3 .rw1          00000008 0000000000000008 DATA
19# CHECK-NEXT:  4 .rw2          00000008 0000000000000010 DATA
20# CHECK-NEXT:  5 .rw3          00000008 0000000000000018 DATA
21# CHECK-NEXT:  6 .bss          00000008 0000000000000020 BSS
22
23.section .rw1, "aw"
24 .quad 0
25
26.section .rw2, "aw"
27 .quad 0
28
29.section .rw3, "aw"
30 .quad 0
31
32.section .jcr, "aw"
33 .quad 0
34
35.section .bss, "aw",@nobits
36 .quad 0
37