xref: /llvm-project/lld/test/MachO/invalid/arm64-unaligned-load.s (revision 1b65d20961d3f7c30fe2fc75aac0e924e902cca3)
1# REQUIRES: aarch64
2# RUN: llvm-mc -filetype=obj -triple=arm64-apple-darwin %s -o %t.o
3# RUN: not %lld -arch arm64 %t.o -o %t 2>&1 | FileCheck %s --implicit-check-not=_byte \
4# RUN:   --implicit-check-not=_correct
5
6# CHECK-DAG: error: {{.*}}:(symbol _main+0x4): 16-bit LDR/STR to 0x[[#%X,]] (_half) is not 2-byte aligned
7# CHECK-DAG: error: {{.*}}:(symbol _main+0xc): 32-bit LDR/STR to 0x[[#%X,]] (_word) is not 4-byte aligned
8# CHECK-DAG: error: {{.*}}:(symbol _main+0x14): 64-bit LDR/STR to 0x[[#%X,]] (_double) is not 8-byte aligned
9# CHECK-DAG: error: {{.*}}:(symbol _main+0x1c): 128-bit LDR/STR to 0x[[#%X,]] (_quad) is not 16-byte aligned
10
11.globl _main
12_main:
13  adrp x0, _half@PAGE
14  ldrh w0, [x0, _half@PAGEOFF]
15
16  adrp x1, _word@PAGE
17  ldr  w1, [x1, _word@PAGEOFF]
18
19  adrp x2, _double@PAGE
20  ldr  x2, [x2, _double@PAGEOFF]
21
22  adrp x3, _quad@PAGE
23  ldr  q0, [x3, _quad@PAGEOFF]
24
25  adrp x4, _byte@PAGE
26  ldrb w4, [x4, _byte@PAGEOFF]
27
28  adrp x5, _correct@PAGE
29  ldr  x5, [x5, _correct@PAGEOFF]
30
31.data
32.p2align 4
33_correct:
34.8byte 0
35.byte 0
36_half:
37.2byte 0
38_word:
39.4byte 0
40_double:
41.8byte 0
42_quad:
43.8byte 0
44.8byte 0
45_byte:
46.byte 0
47