2 # RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/align.s -o %t.o
3 # RUN: ld.lld -o %t --script %s %t.o
4 # RUN: llvm-objdump --section-headers %t | FileCheck %s
16 # CHECK-NEXT: Idx Name Size VMA Type
17 # CHECK-NEXT: 0 00000000 0000000000000000
18 # CHECK-NEXT: 1 .aaa 00000008 0000000000010000 DATA
19 # CHECK-NEXT: 2 .bbb 00000008 0000000000011000 DATA
20 # CHECK-NEXT: 3 .ccc 00000008 0000000000014000 DATA
22 ## Check that ALIGN zero do nothing and does not crash #1.
23 # RUN: echo "SECTIONS { . = ALIGN(0x123, 0); .aaa : { *(.aaa) } }" > %t.script
24 # RUN: ld.lld -o %t4 --script %t.script %t.o
25 # RUN: llvm-objdump --section-headers %t4 | FileCheck %s --check-prefix=ZERO
28 # ZERO-NEXT: Idx Name Size VMA Type
29 # ZERO-NEXT: 0 00000000 0000000000000000
30 # ZERO-NEXT: 1 .aaa 00000008 0000000000000123 DATA
32 ## Check that ALIGN zero do nothing and does not crash #2.
33 # RUN: echo "SECTIONS { . = 0x123; . = ALIGN(0); .aaa : { *(.aaa) } }" > %t.script
34 # RUN: ld.lld -o %t5 --script %t.script %t.o
35 # RUN: llvm-objdump --section-headers %t5 | FileCheck %s --check-prefix=ZERO
37 ## Test we fail gracefully when alignment value is not a power of 2 (#1).
38 # RUN: echo "SECTIONS { . = 0x123; . = ALIGN(0x123, 3); .aaa : { *(.aaa) } }" > %t.script
39 # RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
41 # RUN: echo "SECTIONS { . = 0x123; . = ALIGN(3); .aaa : { *(.aaa) } }" > %t.script
42 # RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s
44 # ERR: {{.*}}.script:1: alignment must be power of 2