46 lines · plain
1// REQUIRES: aarch642// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t3// RUN: not ld.lld %t -o /dev/null 2>&1 | FileCheck %s4 5// Test derived from a typical ODR violation where a global is declared6// extern int but defined as a half or byte sized type.7 .section .text8 .globl _start9 .type _start, %function10// Access foo2 as if it were an aligned 32-bit int, expect an error as11// foo is not aligned12 13_start:14 ldrb w2, [x0, #:lo12:foo1] // Ok as no shift involved15 ldrh w2, [x0, #:lo12:foo1] // Error foo1 is not 2-byte aligned16 ldrh w2, [x0, #:lo12:foo2] // Ok as foo2 is 2-byte aligned17 ldr w2, [x0, #:lo12:foo2] // Error foo2 is not 4-byte aligned18 ldr w2, [x0, #:lo12:foo4] // Ok as foo4 is 4-byte aligned19 ldr x3, [x0, #:lo12:foo4] // Error foo4 is not 8-byte aligned20 ldr x3, [x0, #:lo12:foo8] // Ok as foo8 is 8-byte aligned21 ldr q0, [x0, #:lo12:foo8] // Error foo8 is not 16-byte aligned22 ldr q0, [x0, #:lo12:foo16] // Ok as foo16 is 16-byte aligned23 24 .section .data.bool, "a", @nobits25 .balign 1626 .globl foo1627 .globl foo128 .globl foo229 .globl foo430 .globl foo831foo16:32 .space 133foo1:34 .space 135foo2:36 .space 237foo4:38 .space 439foo8:40 .space 841 42// CHECK: improper alignment for relocation R_AARCH64_LDST16_ABS_LO12_NC: 0x220181 is not aligned to 2 bytes43// CHECK-NEXT: improper alignment for relocation R_AARCH64_LDST32_ABS_LO12_NC: 0x220182 is not aligned to 4 bytes44// CHECK-NEXT: improper alignment for relocation R_AARCH64_LDST64_ABS_LO12_NC: 0x220184 is not aligned to 8 bytes45// CHECK-NEXT: improper alignment for relocation R_AARCH64_LDST128_ABS_LO12_NC: 0x220188 is not aligned to 16 bytes46