brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.8 KiB · 62dfdbf Raw
45 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %p/Inputs/align.s -o %t.o3# RUN: ld.lld -o %t --script %s %t.o4# RUN: llvm-objdump --section-headers %t | FileCheck %s5 6SECTIONS {7  . = 0x10000;8  .aaa : { *(.aaa) }9  . = ALIGN(4096);10  .bbb : { *(.bbb) }11  . = ALIGN(4096 * 4);12  .ccc : { *(.ccc) }13}14 15# CHECK:      Sections:16# CHECK-NEXT: Idx Name          Size     VMA              Type17# CHECK-NEXT:   0               00000000 000000000000000018# CHECK-NEXT:   1 .aaa          00000008 0000000000010000 DATA19# CHECK-NEXT:   2 .bbb          00000008 0000000000011000 DATA20# CHECK-NEXT:   3 .ccc          00000008 0000000000014000 DATA21 22## Check that ALIGN zero do nothing and does not crash #1.23# RUN: echo "SECTIONS { . = ALIGN(0x123, 0); .aaa : { *(.aaa) } }" > %t.script24# RUN: ld.lld -o %t4 --script %t.script %t.o25# RUN: llvm-objdump --section-headers %t4 | FileCheck %s --check-prefix=ZERO26 27# ZERO:      Sections:28# ZERO-NEXT: Idx Name          Size     VMA              Type29# ZERO-NEXT:   0               00000000 000000000000000030# ZERO-NEXT:   1 .aaa          00000008 0000000000000123 DATA31 32## Check that ALIGN zero do nothing and does not crash #2.33# RUN: echo "SECTIONS { . = 0x123; . = ALIGN(0); .aaa : { *(.aaa) } }" > %t.script34# RUN: ld.lld -o %t5 --script %t.script %t.o35# RUN: llvm-objdump --section-headers %t5 | FileCheck %s --check-prefix=ZERO36 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.script39# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s40 41# RUN: echo "SECTIONS { . = 0x123; . = ALIGN(3); .aaa : { *(.aaa) } }" > %t.script42# RUN: not ld.lld -o /dev/null --script %t.script %t.o 2>&1 | FileCheck -check-prefix=ERR %s43 44# ERR: {{.*}}.script:1: alignment must be power of 245