mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 05:56:36 +00:00

This permits an AArch64AbsLongThunk to be used in an environment where unaligned accesses are disabled. The AArch64AbsLongThunk does a load of an 8-byte address. When unaligned accesses are disabled this address must be 8-byte aligned. The vast majority of AArch64 systems will have unaligned accesses enabled in userspace. However, after a reset, before the MMU has been enabled, all memory accesses are to "device" memory, which requires aligned accesses. In systems with multi-stage boot loaders a thunk may be required to a later stage before the MMU has been enabled. As we only want to increase the alignment when the ldr is used we delay the increase in thunk alignment until we know we are going to write an ldr. We also need to account for the ThunkSection alignment increase when this happens. In some of the test updates, particularly those with shared CHECK lines with position independent thunks it was easier to ensure that the thunks started at an 8-byte aligned address in all cases.
43 lines
1.7 KiB
ArmAsm
43 lines
1.7 KiB
ArmAsm
// REQUIRES: aarch64
|
|
// RUN: llvm-mc -filetype=obj -triple=aarch64 %s -o %t
|
|
// RUN: ld.lld -Ttext=0x12000 -defsym long=0x10000000 -defsym short=0x8012004 -defsym short2=0x8012008 -defsym short3=0x801200c %t -o %t.exe
|
|
// RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck %s
|
|
|
|
/// The AArch64AbsLongThunk requires 8-byte alignment just in case unaligned
|
|
/// accesses are disabled. This increases the thunk section alignment to 8,
|
|
/// and the alignment of the AArch64AbsLongThunk to 8. The short thunk form
|
|
/// can still use 4-byte alignment.
|
|
.text
|
|
.type _start, %function
|
|
.globl _start
|
|
_start:
|
|
b short
|
|
b short2
|
|
b short3
|
|
b long
|
|
nop
|
|
|
|
// CHECK-LABEL: <_start>:
|
|
// CHECK-NEXT: 12000: b 0x12018 <__AArch64AbsLongThunk_short>
|
|
// CHECK-NEXT: b 0x1201c <__AArch64AbsLongThunk_short2>
|
|
// CHECK-NEXT: b 0x12020 <__AArch64AbsLongThunk_short3>
|
|
// CHECK-NEXT: b 0x12028 <__AArch64AbsLongThunk_long>
|
|
// CHECK-NEXT: nop
|
|
// CHECK-NEXT: udf #0x0
|
|
// CHECK-EMPTY:
|
|
// CHECK-LABEL: <__AArch64AbsLongThunk_short>:
|
|
// CHECK-NEXT: 12018: b 0x8012004 <__AArch64AbsLongThunk_long+0x7ffffdc>
|
|
// CHECK-EMPY:
|
|
// CHECK-LABEL: <__AArch64AbsLongThunk_short2>:
|
|
// CHECK-NEXT: 1201c: b 0x8012008 <__AArch64AbsLongThunk_long+0x7ffffe0>
|
|
// CHECK-EMPTY:
|
|
// CHECK-LABEL: <__AArch64AbsLongThunk_short3>:
|
|
// CHECK-NEXT: 12020: b 0x801200c <__AArch64AbsLongThunk_long+0x7ffffe4>
|
|
// CHECK-NEXT: udf #0x0
|
|
// CHECK-EMPTY:
|
|
// CHECK-LABEL: <__AArch64AbsLongThunk_long>:
|
|
// CHECK-NEXT: 12028: ldr x16, 0x12030 <__AArch64AbsLongThunk_long+0x8>
|
|
// CHECK-NEXT: br x16
|
|
// CHECK-NEXT: 00 00 00 10 .word 0x10000000
|
|
// CHECK-NEXT: 00 00 00 00 .word 0x00000000
|