1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/MC/AArch64/adr.s
Fangrui Song 04f2a7afd9 [AArch64InstPrinter] Change printADRPLabel to print the target address in hexadecimal form
Similar to D77853. Change ADRP to print the target address in hex, instead of the raw immediate.
The behavior is similar to GNU objdump but we also include `0x`.

Note: GNU objdump is not consistent whether or not to emit `0x` for different architectures. We try emitting 0x consistently for all targets.

```
GNU objdump:       adrp x16, 10000000
Old llvm-objdump:  adrp x16, #0
New llvm-objdump:  adrp x16, 0x10000000
```

`adrp Xd, 0x...` assembles to a relocation referencing `*ABS*+0x10000` which is not intended. We need to use a linker or use yaml2obj.
The main test is `test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml`

Differential Revision: https://reviews.llvm.org/D93241
2020-12-16 09:20:55 -08:00

38 lines
1.3 KiB
ArmAsm

// RUN: llvm-mc -triple aarch64-elf -filetype=obj %s -o - | llvm-objdump -d -r - | FileCheck %s
// CHECK: adr x0, #100
// CHECK-NEXT: adr x2, #0
// CHECK-NEXT: R_AARCH64_ADR_PREL_LO21 Symbol
// CHECK-NEXT: adr x3, #0
// CHECK-NEXT: R_AARCH64_ADR_PREL_LO21 Symbol
// CHECK-NEXT: adr x4, #0
// CHECK-NEXT: R_AARCH64_ADR_PREL_LO21 Symbol+0xf1000
// CHECK-NEXT: adr x5, #0
// CHECK-NEXT: R_AARCH64_ADR_PREL_LO21 Symbol+0xf1000
// CHECK-NEXT: adr x6, #0
// CHECK-NEXT: R_AARCH64_ADR_PREL_LO21 Symbol+0xf1000
adr x0, 100
adr x2, Symbol
adr x3, Symbol + 0
adr x4, Symbol + 987136
adr x5, (0xffffffff000f1000 - 0xffffffff00000000 + Symbol)
adr x6, Symbol + (0xffffffff000f1000 - 0xffffffff00000000)
// CHECK-NEXT: adrp x0, 0x0
// CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21 Symbol
// CHECK-NEXT: adrp x2, 0x0
// CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21 Symbol
// CHECK-NEXT: adrp x3, 0x0
// CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21 Symbol+0xf1000
// CHECK-NEXT: adrp x4, 0x0
// CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21 Symbol+0xf1000
// CHECK-NEXT: adrp x5, 0x0
// CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21 Symbol+0xf1000
adrp x0, Symbol
adrp x2, Symbol + 0
adrp x3, Symbol + 987136
adrp x4, (0xffffffff000f1000 - 0xffffffff00000000 + Symbol)
adrp x5, Symbol + (0xffffffff000f1000 - 0xffffffff00000000)