1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/MC/AArch64/macho-addend-range.s
Tim Northover ebd705668f AArch64: diagnose out of range relocation addends on MachO.
MachO only has 24-bit addends for most relocations, small enough that it can
overflow in semi-reasonable functions and cause insidious bugs if compiled
without assertions enabled. Switch it to an actual error instead.

The condition isn't quite identical because ld64 treats the addend as a signed
number.
2020-07-27 13:01:22 +01:00

15 lines
591 B
ArmAsm

// RUN: not llvm-mc -triple arm64-apple-ios -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s
.global _foo
adrp x0, (_foo + 1)@PAGE
adrp x0, (_foo - 1)@PAGE
adrp x0, (_foo + 0x7fffff)@PAGE
adrp x0, (_foo - 0x800000)@PAGE
// CHECK-NOT: error:
// CHECK: error: addend too big for relocation
// CHECK: adrp x0, (_foo + 0x800000)@PAGE
// CHECK: error: addend too big for relocation
// CHECK: adrp x0, (_foo - 0x800001)@PAGE
adrp x0, (_foo + 0x800000)@PAGE
adrp x0, (_foo - 0x800001)@PAGE