37 lines · plain
1# REQUIRES: x862# RUN: echo '.globl _start; _start: ret; .section .data.rel.ro,"aw"; .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.o5# 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 %s7 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)10 11# CHECK: Name Type Address Off Size ES Flg Lk Inf Al12# CHECK-NEXT: NULL 0000000000000000 000000 000000 00 0 0 013# CHECK-NEXT: .text PROGBITS 0000000000001000 001000 000001 00 AX 0 0 414# CHECK-NEXT: .data.rel.ro PROGBITS 0000000000011000 002000 000001 00 WA 0 0 1615# CHECK-NEXT: .data PROGBITS 0000000000011001 002001 000020 00 WA 0 0 3216# CHECK-NEXT: .bss NOBITS 0000000000011021 002021 000001 00 WA 0 0 6417 18# CHECK: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align19# CHECK-NEXT: LOAD 0x001000 0x0000000000001000 0x0000000000001000 0x000001 0x000001 R E 0x100020# CHECK-NEXT: LOAD 0x002000 0x0000000000011000 0x0000000000001010 0x000001 0x000001 RW 0x100021# CHECK-NEXT: LOAD 0x002001 0x0000000000011001 0x0000000000001020 0x000020 0x000020 RW 0x100022# CHECK-NEXT: LOAD 0x002021 0x0000000000011021 0x0000000000011021 0x000000 0x000001 RW 0x100023 24MEMORY {25 ROM : ORIGIN = 0x1000, LENGTH = 1K26 RAM : ORIGIN = 0x11000, LENGTH = 1K27}28SECTIONS {29 .text 0x1000 : { *(.text*) } >ROM30 ## Input section alignment decides output section alignment.31 .data.rel.ro 0x11000 : { *(.data.rel.ro) } >RAM AT>ROM32 ## ALIGN decides output section alignment.33 .data . : ALIGN(16) { *(.data*) } >RAM AT>ROM34 ## Start a new PT_LOAD because the LMA region is different from the previous one.35 .bss . : ALIGN(64) { *(.bss*) } >RAM36}37