44 lines · plain
1# REQUIRES: aarch642## Test ALIGN and its interaction with explicit output section addresses.3 4# RUN: echo '.globl _start; _start: ret; .section .data.rel.ro,"aw"; .balign 8; .byte 0; .data; .byte 0; \5# RUN: .section .data2,"aw"; .balign 8; .byte 0; \6# RUN: .section .data3,"aw"; .balign 32; .byte 0; \7# RUN: .bss; .balign 32; .byte 0' | \8# RUN: llvm-mc -filetype=obj -triple=aarch64 - -o %t.o9# 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 %s11 12## Check we don't warn in the absence of SECTIONS.13# RUN: ld.lld --fatal-warnings -Ttext=0x10000 --image-base=0x10000 %t.o -o /dev/null14 15# WARN: warning: address (0x10004) of section .data.rel.ro is not a multiple of alignment (16)16# WARN: warning: address (0x20001) of section .data2 is not a multiple of alignment (8)17# WARN: warning: address (0x20021) of section .bss is not a multiple of alignment (32)18 19# CHECK: Name Type Address Off Size ES Flg Lk Inf Al20# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 021# CHECK-NEXT: .text PROGBITS 0000000000010000 010000 000004 00 AX 0 0 422# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000010004 010004 000005 00 WA 0 0 1623# CHECK-NEXT: .data PROGBITS 0000000000020000 020000 000001 00 WA 0 0 124# CHECK-NEXT: .data2 PROGBITS 0000000000020001 020001 000008 00 WA 0 0 825# CHECK-NEXT: .data3 PROGBITS 0000000000020020 020020 000001 00 WA 0 0 3226# CHECK-NEXT: .bss NOBITS 0000000000020021 020021 000020 00 WA 0 0 3227 28SECTIONS {29 .text 0x10000 : { *(.text) }30 ## sh_addr is aligned to 16.31 .data.rel.ro . : ALIGN(16) { *(.data.rel.ro) }32 33 .data 0x20000 : { *(.data) }34 ## The output section address is set without ALIGN. sh_addr is set to Dot, ignoring alignment.35 ## sh_addralign is the maximum of input section alignments, 8.36 .data2 . : { *(.data2) }37 ## sh_addr is aligned to 32.38 ## The input section has a larger alignment and is thus preceded by a gap.39 .data3 : ALIGN(16) { *(.data3) }40 ## sh_addr is aligned to 16.41 ## The input section has a larger alignment and is thus preceded by a gap.42 .bss . : ALIGN(16) { *(.bss) }43}44