2 # RUN: echo '.globl _start; _start: ret; .data.rel.ro; .balign 16; .byte 0; \
3 # RUN: .data; .balign 32; .byte 0; .bss; .byte 0' | \
4 # RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
5 # RUN: ld.lld -T %s %t.o -o %t 2>&1 | FileCheck --check-prefix=WARN %s --implicit-check-not=warning:
6 # RUN: llvm-readelf -S -l %t | FileCheck %s
8 # WARN: warning: address (0x11001) of section .data is not a multiple of alignment (32)
9 # WARN: warning: address (0x11021) of section .bss is not a multiple of alignment (64)
11 # CHECK: Name Type Address Off Size ES Flg Lk Inf Al
12 # CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 0
13 # CHECK-NEXT: .text PROGBITS 0000000000001000 001000 000001 00 AX 0 0 4
14 # CHECK-NEXT: .data.rel.ro PROGBITS 0000000000011000 002000 000001 00 WA 0 0 16
15 # CHECK-NEXT: .data PROGBITS 0000000000011001 002001 000020 00 WA 0 0 32
16 # CHECK-NEXT: .bss NOBITS 0000000000011021 002021 000001 00 WA 0 0 64
18 # CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
19 # CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000001 0x000001 R E 0x1000
20 # CHECK-NEXT: LOAD 0x002000 0x0000000000011000 0x0000000000001010 0x000001 0x000001 RW 0x1000
21 # CHECK-NEXT: LOAD 0x002001 0x0000000000011001 0x0000000000001020 0x000020 0x000020 RW 0x1000
22 # CHECK-NEXT: LOAD 0x002021 0x0000000000011021 0x0000000000011021 0x000000 0x000001 RW 0x1000
25 ROM : ORIGIN = 0x1000, LENGTH = 1K
26 RAM : ORIGIN = 0x11000, LENGTH = 1K
29 .text 0x1000 : { *(.text*) } >ROM
30 ## Input section alignment decides output section alignment.
31 .data.rel.ro 0x11000 : { *(.data.rel.ro) } >RAM AT>ROM
32 ## ALIGN decides output section alignment.
33 .data . : ALIGN(16) { *(.data*) } >RAM AT>ROM
34 ## Start a new PT_LOAD because the LMA region is different from the previous one.
35 .bss . : ALIGN(64) { *(.bss*) } >RAM