[ELF] Make SyntheticSection parameter order match InputSection
[llvm-project.git] / lld / test / ELF / relro-bss.s
blobf15aff36872df5cca91689e65cae3e6aa6e6e360
1 # REQUIRES: x86
2 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
3 # RUN: ld.lld %t.o -o %t
4 # RUN: llvm-readelf -l %t | FileCheck --check-prefix=SEG %s
5 # RUN: llvm-readelf -S %t | FileCheck %s
7 # We have 2 RW PT_LOAD segments. p_offset p_vaddr p_paddr p_filesz of the first
8 # should match PT_GNU_RELRO.
9 # Because .bss.rel.ro (nobits) doesn't take space, p_filesz < p_memsz.
11 # Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
12 # SEG: LOAD 0x0001c8 0x00000000002011c8 0x00000000002011c8 0x000001 0x000001 R E 0x1000
13 # SEG-NEXT: LOAD 0x0001c9 0x00000000002021c9 0x00000000002021c9 0x000001 0x002e37 RW 0x1000
14 # SEG-NEXT: LOAD 0x0001ca 0x00000000002051ca 0x00000000002051ca 0x000001 0x000002 RW 0x1000
15 # SEG-NEXT: GNU_RELRO 0x0001c9 0x00000000002021c9 0x00000000002021c9 0x000001 0x002e37 R 0x1
16 # SEG-NEXT: GNU_STACK 0x000000 0x0000000000000000 0x0000000000000000 0x000000 0x000000 RW 0x0
18 # SEG: .text
19 # SEG-NEXT: .data.rel.ro .bss.rel.ro
20 # SEG-NEXT: .data .bss
22 # And .data is placed in the next page (sh_offset = alignTo(0x2001, 4096) = 0x3000).
24 # [Nr] Name Type Address Off Size
25 # CHECK: .data.rel.ro PROGBITS 00000000002021c9 0001c9 000001
26 # CHECK-NEXT: .bss.rel.ro NOBITS 00000000002021ca 0001ca 002000
27 # CHECK-NEXT: .relro_padding NOBITS 00000000002041ca 0001ca 000e36
28 # CHECK-NEXT: .data PROGBITS 00000000002051ca 0001ca 000001
29 # CHECK-NEXT: .bss NOBITS 00000000002051cb 0001cb 000001
31 .globl _start
32 _start:
33 ret
35 .section .data.rel.ro, "aw"
36 .space 1
38 .section .bss.rel.ro, "aw", @nobits
39 .space 8192
41 .section .data, "aw"
42 .space 1
44 .section .bss, "aw"
45 .space 1