61 lines · plain
1# REQUIRES: x862# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t1.o3 4# RUN: echo "SECTIONS { .aaa : { *(.aaa.*) } }" > %t1.script5# RUN: ld.lld -o %t1 --script %t1.script %t1.o6# RUN: llvm-objdump -s %t1 | FileCheck --check-prefix=NOALIGN %s7# NOALIGN: Contents of section .aaa:8# NOALIGN-NEXT: 01000000 00000000 00000000 000000009# NOALIGN-NEXT: 00000000 00000000 00000000 0000000010# NOALIGN-NEXT: 02000000 00000000 00000000 0000000011# NOALIGN-NEXT: 00000000 00000000 00000000 0000000012# NOALIGN-NEXT: 03000000 00000000 00000000 0000000013# NOALIGN-NEXT: 00000000 00000000 00000000 0000000014# NOALIGN-NEXT: 00000000 00000000 00000000 0000000015# NOALIGN-NEXT: 00000000 00000000 00000000 0000000016# NOALIGN-NEXT: 04000000 0000000017 18# RUN: echo "SECTIONS { .aaa : SUBALIGN(1) { *(.aaa.*) } }" > %t2.script19# RUN: ld.lld -o %t2 --script %t2.script %t1.o20# RUN: llvm-objdump -s %t2 | FileCheck --check-prefix=SUBALIGN %s21# SUBALIGN: Contents of section .aaa:22# SUBALIGN: 01000000 00000000 02000000 0000000023# SUBALIGN: 03000000 00000000 04000000 0000000024 25## Test we do not assert or crash when dot(.) is used inside SUBALIGN.26## Value of dot is undefined. Some versions of ld.bfd do not allow to use dot27## in such expressions.28# RUN: echo "SECTIONS { . = 0x32; .aaa : SUBALIGN(.) { *(.aaa*) } }" > %t3.script29# RUN: not ld.lld %t1.o --script %t3.script -o /dev/null 2>&1 | FileCheck --check-prefix=ERR1 %s30# ERR1: {{.*}}.script:1: unable to get location counter value31 32## Test we are able to link with zero alignment, this is consistent with bfd 2.26.1.33# RUN: echo "SECTIONS { .aaa : SUBALIGN(0) { *(.aaa*) } }" > %t4.script34# RUN: ld.lld %t1.o --script %t4.script -o %t435# RUN: llvm-objdump -s %t4 | FileCheck --check-prefix=SUBALIGN %s36 37## Test we fail gracefully when alignment value is not a power of 2.38# RUN: echo "SECTIONS { .aaa : SUBALIGN(3) { *(.aaa*) } }" > %t5.script39# RUN: not ld.lld %t1.o --script %t5.script -o /dev/null 2>&1 | FileCheck --check-prefix=ERR2 %s40# ERR2: {{.*}}.script:1: alignment must be power of 241 42.global _start43_start:44 nop45 46.section .aaa.1, "a"47.align 1648.quad 149 50.section .aaa.2, "a"51.align 3252.quad 253 54.section .aaa.3, "a"55.align 6456.quad 357 58.section .aaa.4, "a"59.align 12860.quad 461