2 ## Test ALIGN when specifying the output section address.
4 # RUN: echo '.globl _start; _start: ret; \
5 # RUN: .data.rel.ro; .balign 8; .byte 0; \
6 # RUN: .data; .byte 0; \
7 # RUN: .bss; .balign 32; .byte 0' | \
8 # RUN: llvm-mc -filetype=obj -triple=x86_64 - -o %t.o
9 # RUN: ld.lld -T %s %t.o -o %t 2>&1 | FileCheck --check-prefix=WARN %s --implicit-check-not=warning:
10 # RUN: llvm-readelf -S %t | FileCheck %s
12 # WARN: warning: address (0x10004) of section .data.rel.ro is not a multiple of alignment (8)
13 # WARN: warning: address (0x20008) of section .bss is not a multiple of alignment (32)
15 # CHECK: Name Type Address Off Size ES Flg Lk Inf Al
16 # CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 0
17 # CHECK-NEXT: .text PROGBITS 0000000000010000 001000 000001 00 AX 0 0 4
18 # CHECK-NEXT: .data.rel.ro PROGBITS 0000000000010004 001004 000005 00 WA 0 0 8
19 # CHECK-NEXT: .data PROGBITS 0000000000020000 002000 000001 00 WA 0 0 1
20 # CHECK-NEXT: .bss NOBITS 0000000000020008 002001 000019 00 WA 0 0 32
23 .text 0x10000 : { *(.text) }
24 ## The output .data.rel.ro starts at 0x10004.
25 ## The input .data.rel.ro starts at 0x10008 and ends at 0x10009.
26 ## sh_size(.data.rel.ro) = 0x10009-0x10004 = 0x5.
27 .data.rel.ro ALIGN(4) : { *(.data.rel.ro) }
29 .data 0x20000 : { *(.data) }
30 ## The output .bss starts at 0x20008.
31 ## The input .bss starts at 0x20020 and ends at 0x20021.
32 ## sh_size(.bss) = 0x20021-0x20008 = 0x19.
33 .bss ALIGN(8) : { *(.bss) }