[llvm-branch-commits] [lld] 66bcbdb - [AArch64InstPrinter] Change printADRPLabel to print the target address in hexadecimal form

Fangrui Song via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Dec 16 09:25:50 PST 2020


Author: Fangrui Song
Date: 2020-12-16T09:20:55-08:00
New Revision: 66bcbdbc9c584becff35f6795cd2836a7a0141b2

URL: https://github.com/llvm/llvm-project/commit/66bcbdbc9c584becff35f6795cd2836a7a0141b2
DIFF: https://github.com/llvm/llvm-project/commit/66bcbdbc9c584becff35f6795cd2836a7a0141b2.diff

LOG: [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

Added: 
    llvm/test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml

Modified: 
    lld/test/COFF/arm64-delayimport.yaml
    lld/test/COFF/arm64-import2.test
    lld/test/COFF/arm64-relocs-imports.test
    lld/test/COFF/arm64-thunks.s
    lld/test/ELF/aarch64-condb-reloc.s
    lld/test/ELF/aarch64-copy.s
    lld/test/ELF/aarch64-cortex-a53-843419-address.s
    lld/test/ELF/aarch64-cortex-a53-843419-large.s
    lld/test/ELF/aarch64-cortex-a53-843419-recognize.s
    lld/test/ELF/aarch64-cortex-a53-843419-thunk.s
    lld/test/ELF/aarch64-feature-bti.s
    lld/test/ELF/aarch64-feature-btipac.s
    lld/test/ELF/aarch64-feature-pac.s
    lld/test/ELF/aarch64-fpic-got.s
    lld/test/ELF/aarch64-gnu-ifunc-address.s
    lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
    lld/test/ELF/aarch64-gnu-ifunc-plt.s
    lld/test/ELF/aarch64-gnu-ifunc.s
    lld/test/ELF/aarch64-gnu-ifunc2.s
    lld/test/ELF/aarch64-hi21-nc.s
    lld/test/ELF/aarch64-ifunc-bti.s
    lld/test/ELF/aarch64-plt.s
    lld/test/ELF/aarch64-relocs.s
    lld/test/ELF/aarch64-thunk-pi.s
    lld/test/ELF/aarch64-tls-gdie.s
    lld/test/ELF/aarch64-tls-ie.s
    lld/test/ELF/aarch64-tlsdesc.s
    lld/test/ELF/aarch64-tstbr14-reloc.s
    lld/test/ELF/aarch64-undefined-weak.s
    llvm/lib/Target/AArch64/AArch64InstrFormats.td
    llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
    llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
    llvm/test/MC/AArch64/adr.s
    llvm/test/MC/AArch64/coff-relocations.s
    llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test

Removed: 
    


################################################################################
diff  --git a/lld/test/COFF/arm64-delayimport.yaml b/lld/test/COFF/arm64-delayimport.yaml
index 6b16a54dfa11..583103f064a0 100644
--- a/lld/test/COFF/arm64-delayimport.yaml
+++ b/lld/test/COFF/arm64-delayimport.yaml
@@ -5,7 +5,7 @@
 # RUN: llvm-objdump -d %t.exe | FileCheck %s --check-prefix DISASM
 # RUN: llvm-readobj --coff-imports %t.exe | FileCheck %s -check-prefix IMPORTS
 
-# DISASM:  140001014:      11 00 00 d0     adrp    x17, #8192
+# DISASM:  140001014:      11 00 00 d0     adrp    x17, 0x140003000
 # DISASM:  140001018:      31 22 00 91     add     x17, x17, #8
 # DISASM:  14000101c:      01 00 00 14     b       0x140001020 <.text+0x20>
 # DISASM:  140001020:      fd 7b b3 a9     stp     x29, x30, [sp, #-208]!
@@ -19,7 +19,7 @@
 # DISASM:  140001040:      e4 97 04 ad     stp     q4, q5, [sp, #144]
 # DISASM:  140001044:      e6 9f 05 ad     stp     q6, q7, [sp, #176]
 # DISASM:  140001048:      e1 03 11 aa     mov     x1, x17
-# DISASM:  14000104c:      00 00 00 b0     adrp    x0, #4096
+# DISASM:  14000104c:      00 00 00 b0     adrp    x0, 0x140002000
 # DISASM:  140001050:      00 00 00 91     add     x0, x0, #0
 # DISASM:  140001054:      eb ff ff 97     bl      0x140001000 <.text>
 # DISASM:  140001058:      f0 03 00 aa     mov     x16, x0

diff  --git a/lld/test/COFF/arm64-import2.test b/lld/test/COFF/arm64-import2.test
index b3fa6382642f..1122ab8e0dbc 100644
--- a/lld/test/COFF/arm64-import2.test
+++ b/lld/test/COFF/arm64-import2.test
@@ -19,10 +19,10 @@
 # AFTER:  140001004:      06 00 00 94     bl      0x14000101c
 # AFTER:  140001008:      c0 03 5f d6     ret
 # AFTER:  14000100c:      ff cc cc cc     <unknown>
-# AFTER:  140001010:      10 00 00 b0     adrp    x16, #4096
+# AFTER:  140001010:      10 00 00 b0     adrp    x16, 0x140002000
 # AFTER:  140001014:      10 32 40 f9     ldr     x16, [x16, #96]
 # AFTER:  140001018:      00 02 1f d6     br      x16
-# AFTER:  14000101c:      10 00 00 b0     adrp    x16, #4096
+# AFTER:  14000101c:      10 00 00 b0     adrp    x16, 0x140002000
 # AFTER:  140001020:      10 3a 40 f9     ldr     x16, [x16, #112]
 # AFTER:  140001024:      00 02 1f d6     br      x16
 

diff  --git a/lld/test/COFF/arm64-relocs-imports.test b/lld/test/COFF/arm64-relocs-imports.test
index 8682088bf465..bdad54b2159d 100644
--- a/lld/test/COFF/arm64-relocs-imports.test
+++ b/lld/test/COFF/arm64-relocs-imports.test
@@ -8,7 +8,7 @@
 # BEFORE: Disassembly of section .text:
 # BEFORE-EMPTY:
 # BEFORE:        0:       fe 0f 1f f8     str     x30, [sp, #-16]!
-# BEFORE:        4:       00 00 00 90     adrp    x0, #0
+# BEFORE:        4:       00 00 00 90     adrp    x0, 0x0
 # BEFORE:        8:       00 08 00 91     add     x0, x0, #2
 # BEFORE:        c:       00 00 00 94     bl      0xc
 # BEFORE:       10:       00 01 40 39     ldrb    w0, [x8]
@@ -30,7 +30,7 @@
 # BEFORE:       50:       00 01 00 fd     str     d0, [x8]
 # BEFORE:       54:       00 01 80 3d     str     q0, [x8]
 # BEFORE:       58:       00 05 40 f9     ldr     x0, [x8, #8]
-# BEFORE:       5c:       20 1a 01 b0     adrp    x0, #36982784
+# BEFORE:       5c:       20 1a 01 b0     adrp    x0, 0x2345000
 # BEFORE:       60:       00 fc 4f f9     ldr     x0, [x0, #8184]
 # BEFORE:       64:       e0 03 1f 2a     mov      w0, wzr
 # BEFORE:       68:       fe 07 41 f8     ldr     x30, [sp], #16
@@ -51,7 +51,7 @@
 # AFTER: Disassembly of section .text:
 # AFTER-EMPTY:
 # AFTER:  140001000:      fe 0f 1f f8     str     x30, [sp, #-16]!
-# AFTER:  140001004:      00 00 00 b0     adrp    x0, #4096
+# AFTER:  140001004:      00 00 00 b0     adrp    x0, 0x140002000
 # AFTER:  140001008:      00 18 00 91     add     x0, x0, #6
 # AFTER:  14000100c:      25 00 00 94     bl      0x1400010a0
 # AFTER:  140001010:      00 21 40 39     ldrb    w0, [x8, #8]
@@ -73,7 +73,7 @@
 # AFTER:  140001050:      00 09 00 fd     str     d0, [x8, #16]
 # AFTER:  140001054:      00 05 80 3d     str     q0, [x8, #16]
 # AFTER:  140001058:      00 09 40 f9     ldr     x0, [x8, #16]
-# AFTER:  14000105c:      00 00 00 f0     adrp    x0, #12288
+# AFTER:  14000105c:      00 00 00 f0     adrp    x0, 0x140004000
 # AFTER:  140001060:      00 fc 47 f9     ldr     x0, [x0, #4088]
 # AFTER:  140001064:      e0 03 1f 2a     mov      w0, wzr
 # AFTER:  140001068:      fe 07 41 f8     ldr     x30, [sp], #16
@@ -90,7 +90,7 @@
 # AFTER:  140001094:      61 00 00 54     b.ne    0x1400010a0
 # AFTER:  140001098:      40 00 00 36     tbz     w0, #0, 0x1400010a0
 # AFTER:  14000109c:      61 ff ff ff     <unknown>
-# AFTER:  1400010a0:      10 00 00 b0     adrp    x16, #4096
+# AFTER:  1400010a0:      10 00 00 b0     adrp    x16, 0x140002000
 # AFTER:  1400010a4:      10 2a 40 f9     ldr     x16, [x16, #80]
 # AFTER:  1400010a8:      00 02 1f d6     br      x16
 

diff  --git a/lld/test/COFF/arm64-thunks.s b/lld/test/COFF/arm64-thunks.s
index 9ddae6281d72..4428bf79ae9e 100644
--- a/lld/test/COFF/arm64-thunks.s
+++ b/lld/test/COFF/arm64-thunks.s
@@ -29,14 +29,14 @@ func2:
 // DISASM: 0000000140001000 <.text>:
 // DISASM: 140001000:      40 00 00 36     tbz     w0, #0, 0x140001008 <.text+0x8>
 // DISASM: 140001004:      c0 03 5f d6     ret
-// DISASM: 140001008:      50 00 00 90     adrp    x16, #32768
+// DISASM: 140001008:      50 00 00 90     adrp    x16, 0x140009000
 // DISASM: 14000100c:      10 52 00 91     add     x16, x16, #20
 // DISASM: 140001010:      00 02 1f d6     br      x16
 
 // DISASM: 140009014:      60 00 00 36     tbz     w0, #0, 0x140009020 <.text+0x8020>
 // DISASM: 140009018:      c0 03 5f d6     ret
 
-// DISASM: 140009020:      50 00 00 90     adrp    x16, #32768
+// DISASM: 140009020:      50 00 00 90     adrp    x16, 0x140011000
 // DISASM: 140009024:      10 b2 00 91     add     x16, x16, #44
 // DISASM: 140009028:      00 02 1f d6     br      x16
 

diff  --git a/lld/test/ELF/aarch64-condb-reloc.s b/lld/test/ELF/aarch64-condb-reloc.s
index 06c7b0a82210..0b90d5c9937a 100644
--- a/lld/test/ELF/aarch64-condb-reloc.s
+++ b/lld/test/ELF/aarch64-condb-reloc.s
@@ -76,7 +76,7 @@
 #DSO-EMPTY:
 #DSO-NEXT: <.plt>:
 #DSO-NEXT:     10370: stp x16, x30, [sp, #-16]!
-#DSO-NEXT:     10374: adrp x16, #131072
+#DSO-NEXT:     10374: adrp x16, 0x30000
 #DSO-NEXT:     10378: ldr x17, [x16, #1152]
 #DSO-NEXT:     1037c: add x16, x16, #1152
 #DSO-NEXT:     10380: br x17
@@ -85,19 +85,19 @@
 #DSO-NEXT:     1038c: nop
 #DSO-EMPTY:
 #DSO-NEXT:   <_foo at plt>:
-#DSO-NEXT:     10390: adrp x16, #131072
+#DSO-NEXT:     10390: adrp x16, 0x30000
 #DSO-NEXT:     10394: ldr x17, [x16, #1160]
 #DSO-NEXT:     10398: add x16, x16, #1160
 #DSO-NEXT:     1039c: br x17
 #DSO-EMPTY:
 #DSO-NEXT:   <_bar at plt>:
-#DSO-NEXT:     103a0: adrp x16, #131072
+#DSO-NEXT:     103a0: adrp x16, 0x30000
 #DSO-NEXT:     103a4: ldr x17, [x16, #1168]
 #DSO-NEXT:     103a8: add x16, x16, #1168
 #DSO-NEXT:     103ac: br x17
 #DSO-EMPTY:
 #DSO-NEXT:   <_dah at plt>:
-#DSO-NEXT:     103b0: adrp x16, #131072
+#DSO-NEXT:     103b0: adrp x16, 0x30000
 #DSO-NEXT:     103b4: ldr x17, [x16, #1176]
 #DSO-NEXT:     103b8: add x16, x16, #1176
 #DSO-NEXT:     103bc: br x17

diff  --git a/lld/test/ELF/aarch64-copy.s b/lld/test/ELF/aarch64-copy.s
index ba7c8afd5ee1..591186f1470f 100644
--- a/lld/test/ELF/aarch64-copy.s
+++ b/lld/test/ELF/aarch64-copy.s
@@ -67,7 +67,7 @@ _start:
 // S + A - P = 0x2303f0 + 0 - 0x21031c = 131284
 // CODE-NEXT:  21031c: adr  x1, #131284
 // Page(S + A) - Page(P) = Page(0x230400) - Page(0x210320) = 131072
-// CODE-NEXT:  210320: adrp x2, #131072
+// CODE-NEXT:  210320: adrp x2, 0x230000
 // (S + A) & 0xFFF = (0x230400 + 0) & 0xFFF = 1024
 // CODE-NEXT:  210324: add  x2, x2, #1024
 

diff  --git a/lld/test/ELF/aarch64-cortex-a53-843419-address.s b/lld/test/ELF/aarch64-cortex-a53-843419-address.s
index 186ff550aa88..fcf5f407c142 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-address.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-address.s
@@ -38,7 +38,7 @@
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at FF8 in unpatched output.
 // CHECK: <t3_ff8_ldr>:
-// CHECK-NEXT:      ff8:        20 00 00 d0     adrp    x0, #24576
+// CHECK-NEXT:      ff8:        20 00 00 d0     adrp    x0, 0x6000
 // CHECK-NEXT:      ffc:        21 00 40 f9     ldr             x1, [x1]
 // CHECK-NEXT:     1000:        f9 0f 00 14     b       0x4fe4
 // CHECK-NEXT:     1004:        c0 03 5f d6     ret
@@ -60,7 +60,7 @@ t3_ff8_ldr:
 $x.999:
 // CHECK-PRINT-NEXT: detected cortex-a53-843419 erratum sequence starting at 1FFC in unpatched output.
 // CHECK: <t3_ffc_ldrsimd>:
-// CHECK-NEXT:     1ffc:        20 00 00 b0     adrp    x0, #20480
+// CHECK-NEXT:     1ffc:        20 00 00 b0     adrp    x0, 0x6000
 // CHECK-NEXT:     2000:        21 00 40 bd     ldr             s1, [x1]
 // CHECK-NEXT:     2004:        fa 0b 00 14     b       0x4fec
 // CHECK-NEXT:     2008:        c0 03 5f d6     ret
@@ -97,7 +97,7 @@ t3_ff8_ldralldata:
 
 // CHECK-PRINT-NEXT: detected cortex-a53-843419 erratum sequence starting at 3FF8 in unpatched output.
 // CHECK: <t3_ffc_ldr>:
-// CHECK-NEXT:     3ff8:        00 00 00 f0     adrp    x0, #12288
+// CHECK-NEXT:     3ff8:        00 00 00 f0     adrp    x0, 0x6000
 // CHECK-NEXT:     3ffc:        21 00 40 f9     ldr             x1, [x1]
 // CHECK-NEXT:     4000:        fd 03 00 14     b       0x4ff4
 // CHECK-NEXT:     4004:        c0 03 5f d6     ret
@@ -129,7 +129,7 @@ t3_ff8_ldralldata:
 
 // CHECK-PRINT-NEXT: detected cortex-a53-843419 erratum sequence starting at 4FFC in unpatched output
 // CHECK: <t3_ffc_str>:
-// CHECK-NEXT:     4ffc:        00 00 00 d0     adrp    x0, #8192
+// CHECK-NEXT:     4ffc:        00 00 00 d0     adrp    x0, 0x6000
 // CHECK-NEXT:     5000:        21 00 00 f9     str             x1, [x1]
 // CHECK-NEXT:     5004:        fb 03 00 14     b       0x5ff0
 // CHECK-NEXT:     5008:        c0 03 5f d6     ret
@@ -154,7 +154,7 @@ t3_ffc_str:
 
 //CHECK-PRINT-NEXT: detected cortex-a53-843419 erratum sequence starting at 5FF8 in unpatched output
 // CHECK: <t3_ff8_str>:
-// CHECK-NEXT:     5ff8:        00 00 00 b0     adrp    x0, #4096
+// CHECK-NEXT:     5ff8:        00 00 00 b0     adrp    x0, 0x6000
 // CHECK-NEXT:     5ffc:        21 00 00 f9     str             x1, [x1]
 // CHECK-NEXT:     6000:        03 00 00 14     b       0x600c
 // CHECK-NEXT:     6004:        c0 03 5f d6     ret

diff  --git a/lld/test/ELF/aarch64-cortex-a53-843419-large.s b/lld/test/ELF/aarch64-cortex-a53-843419-large.s
index 35b25323d415..a1aafbaaff68 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-large.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-large.s
@@ -43,7 +43,7 @@ t3_ff8_ldr:
         ret
 
 // CHECK3: <t3_ff8_ldr>:
-// CHECK3-NEXT:    211ff8:       e0 00 04 f0     adrp    x0, #134344704
+// CHECK3-NEXT:    211ff8:       e0 00 04 f0     adrp    x0, 0x8230000
 // CHECK3-NEXT:    211ffc:       21 00 40 f9     ldr     x1, [x1]
 // CHECK3-NEXT:    212000:       02 08 80 15     b       0x6214008
 // CHECK3-NEXT:    212004:       c0 03 5f d6     ret
@@ -64,7 +64,7 @@ t3_ff8_str:
         ret
 
 // CHECK4: <t3_ff8_str>:
-// CHECK4-NEXT:  4213ff8:       e0 00 02 b0     adrp    x0, #67227648
+// CHECK4-NEXT:  4213ff8:       e0 00 02 b0     adrp    x0, 0x8230000
 // CHECK4-NEXT:  4213ffc:       21 00 40 f9     ldr     x1, [x1]
 // CHECK4-NEXT:  4214000:       04 00 80 14     b       0x6214010
 // CHECK4-NEXT:  4214004:       c0 03 5f d6     ret
@@ -103,7 +103,7 @@ t3_ffc_ldr:
         ret
 
 // CHECK7: <t3_ffc_ldr>:
-// CHECK7-NEXT:  8211ffc:       e0 00 00 f0     adrp    x0, #126976
+// CHECK7-NEXT:  8211ffc:       e0 00 00 f0     adrp    x0, 0x8230000
 // CHECK7-NEXT:  8212000:       21 00 40 f9     ldr     x1, [x1]
 // CHECK7-NEXT:  8212004:       02 00 00 14     b       0x821200c
 // CHECK7-NEXT:  8212008:       c0 03 5f d6     ret

diff  --git a/lld/test/ELF/aarch64-cortex-a53-843419-recognize.s b/lld/test/ELF/aarch64-cortex-a53-843419-recognize.s
index 823c7525ab2e..3d7aef78a689 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-recognize.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-recognize.s
@@ -30,13 +30,13 @@
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 211FF8 in unpatched output.
 // CHECK: <t3_ff8_ldr>:
-// CHECK-NEXT:    211ff8:        60 02 00 f0     adrp    x0, #323584
+// CHECK-NEXT:    211ff8:        60 02 00 f0     adrp    x0, 0x260000
 // CHECK-NEXT:    211ffc:        21 00 40 f9     ldr             x1, [x1]
 // CHECK-FIX:     212000:        03 c8 00 14     b       0x24400c
 // CHECK-NOFIX:   212000:        00 00 40 f9     ldr             x0, [x0]
 // CHECK-NEXT:    212004:        c0 03 5f d6     ret
 // CHECK-RELOCATABLE: <t3_ff8_ldr>:
-// CHECK-RELOCATABLE-NEXT:    ff8:        00 00 00 90     adrp    x0, #0
+// CHECK-RELOCATABLE-NEXT:    ff8:        00 00 00 90     adrp    x0, 0x0
 // CHECK-RELOCATABLE-NEXT:    ffc:        21 00 40 f9     ldr             x1, [x1]
 // CHECK-RELOCATABLE-NEXT:   1000:        00 00 40 f9     ldr             x0, [x0]
 // CHECK-RELOCATABLE-NEXT:   1004:        c0 03 5f d6     ret
@@ -54,7 +54,7 @@ t3_ff8_ldr:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 213FF8 in unpatched output.
 // CHECK: <t3_ff8_ldrsimd>:
-// CHECK-NEXT:    213ff8:        60 02 00 b0     adrp    x0, #315392
+// CHECK-NEXT:    213ff8:        60 02 00 b0     adrp    x0, 0x260000
 // CHECK-NEXT:    213ffc:        21 00 40 bd     ldr             s1, [x1]
 // CHECK-FIX:     214000:        05 c0 00 14     b       0x244014
 // CHECK-NOFIX:   214000:        02 04 40 f9     ldr     x2, [x0, #8]
@@ -72,7 +72,7 @@ t3_ff8_ldrsimd:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 215FFC in unpatched output.
 // CHECK: <t3_ffc_ldrpost>:
-// CHECK-NEXT:    215ffc:        40 02 00 f0     adrp    x0, #307200
+// CHECK-NEXT:    215ffc:        40 02 00 f0     adrp    x0, 0x260000
 // CHECK-NEXT:    216000:        21 84 40 bc     ldr     s1, [x1], #8
 // CHECK-FIX:     216004:        06 b8 00 14     b       0x24401c
 // CHECK-NOFIX:   216004:        03 08 40 f9     ldr     x3, [x0, #16]
@@ -90,7 +90,7 @@ t3_ffc_ldrpost:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 217FF8 in unpatched output.
 // CHECK: <t3_ff8_strpre>:
-// CHECK-NEXT:    217ff8:        40 02 00 b0     adrp    x0, #299008
+// CHECK-NEXT:    217ff8:        40 02 00 b0     adrp    x0, 0x260000
 // CHECK-NEXT:    217ffc:        21 8c 00 bc     str     s1, [x1, #8]!
 // CHECK-FIX:     218000:        09 b0 00 14     b       0x244024
 // CHECK-NOFIX:   218000:        02 0c 40 f9     ldr     x2, [x0, #24]
@@ -108,7 +108,7 @@ t3_ff8_strpre:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 219FFC in unpatched output.
 // CHECK: <t3_ffc_str>:
-// CHECK-NEXT:    219ffc:        3c 02 00 f0     adrp    x28, #290816
+// CHECK-NEXT:    219ffc:        3c 02 00 f0     adrp    x28, 0x260000
 // CHECK-NEXT:    21a000:        42 00 00 f9     str             x2, [x2]
 // CHECK-FIX:     21a004:        0a a8 00 14     b       0x24402c
 // CHECK-NOFIX:   21a004:        9c 13 00 f9     str     x28, [x28, #32]
@@ -126,7 +126,7 @@ t3_ffc_str:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 21BFFC in unpatched output.
 // CHECK: <t3_ffc_strsimd>:
-// CHECK-NEXT:    21bffc:        3c 02 00 b0     adrp    x28, #282624
+// CHECK-NEXT:    21bffc:        3c 02 00 b0     adrp    x28, 0x260000
 // CHECK-NEXT:    21c000:        44 00 00 b9     str             w4, [x2]
 // CHECK-FIX:     21c004:        0c a0 00 14     b       0x244034
 // CHECK-NOFIX:   21c004:        84 17 00 f9     str     x4, [x28, #40]
@@ -144,7 +144,7 @@ t3_ffc_strsimd:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 21DFF8 in unpatched output.
 // CHECK: <t3_ff8_ldrunpriv>:
-// CHECK-NEXT:    21dff8:        1d 02 00 f0     adrp    x29, #274432
+// CHECK-NEXT:    21dff8:        1d 02 00 f0     adrp    x29, 0x260000
 // CHECK-NEXT:    21dffc:        41 08 40 38     ldtrb           w1, [x2]
 // CHECK-FIX:     21e000:        0f 98 00 14     b       0x24403c
 // CHECK-NOFIX:   21e000:        bd 03 40 f9     ldr             x29, [x29]
@@ -162,7 +162,7 @@ t3_ff8_ldrunpriv:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 21FFFC in unpatched output.
 // CHECK: <t3_ffc_ldur>:
-// CHECK-NEXT:    21fffc:        1d 02 00 b0     adrp    x29, #266240
+// CHECK-NEXT:    21fffc:        1d 02 00 b0     adrp    x29, 0x260000
 // CHECK-NEXT:    220000:        42 40 40 b8     ldur    w2, [x2, #4]
 // CHECK-FIX:     220004:        10 90 00 14     b       0x244044
 // CHECK-NOFIX:   220004:        bd 07 40 f9     ldr     x29, [x29, #8]
@@ -179,7 +179,7 @@ t3_ffc_ldur:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 221FFC in unpatched output.
 // CHECK: <t3_ffc_sturh>:
-// CHECK-NEXT:    221ffc:        f2 01 00 f0     adrp    x18, #258048
+// CHECK-NEXT:    221ffc:        f2 01 00 f0     adrp    x18, 0x260000
 // CHECK-NEXT:    222000:        43 40 00 78     sturh   w3, [x2, #4]
 // CHECK-FIX:     222004:        12 88 00 14     b       0x24404c
 // CHECK-NOFIX:   222004:        41 0a 40 f9     ldr     x1, [x18, #16]
@@ -197,7 +197,7 @@ t3_ffc_sturh:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 223FF8 in unpatched output.
 // CHECK: <t3_ff8_literal>:
-// CHECK-NEXT:    223ff8:        f2 01 00 b0     adrp    x18, #249856
+// CHECK-NEXT:    223ff8:        f2 01 00 b0     adrp    x18, 0x260000
 // CHECK-NEXT:    223ffc:        e3 ff ff 58     ldr     x3, 0x223ff8
 // CHECK-FIX:     224000:        15 80 00 14     b       0x244054
 // CHECK-NOFIX:   224000:        52 0e 40 f9     ldr     x18, [x18, #24]
@@ -215,7 +215,7 @@ t3_ff8_literal:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 225FFC in unpatched output.
 // CHECK: <t3_ffc_register>:
-// CHECK-NEXT:    225ffc:        cf 01 00 f0     adrp    x15, #241664
+// CHECK-NEXT:    225ffc:        cf 01 00 f0     adrp    x15, 0x260000
 // CHECK-NEXT:    226000:        43 68 61 f8     ldr             x3, [x2, x1]
 // CHECK-FIX:     226004:        16 78 00 14     b       0x24405c
 // CHECK-NOFIX:   226004:        ea 11 40 f9     ldr     x10, [x15, #32]
@@ -233,7 +233,7 @@ t3_ffc_register:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 227FF8 in unpatched output.
 // CHECK: <t3_ff8_stp>:
-// CHECK-NEXT:    227ff8:        d0 01 00 b0     adrp    x16, #233472
+// CHECK-NEXT:    227ff8:        d0 01 00 b0     adrp    x16, 0x260000
 // CHECK-NEXT:    227ffc:        61 08 00 a9     stp             x1, x2, [x3]
 // CHECK-FIX:     228000:        19 70 00 14     b       0x244064
 // CHECK-NOFIX:   228000:        0d 16 40 f9     ldr     x13, [x16, #40]
@@ -251,7 +251,7 @@ t3_ff8_stp:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 229FFC in unpatched output.
 // CHECK: <t3_ffc_stnp>:
-// CHECK-NEXT:    229ffc:        a7 01 00 f0     adrp    x7, #225280
+// CHECK-NEXT:    229ffc:        a7 01 00 f0     adrp    x7, 0x260000
 // CHECK-NEXT:    22a000:        61 08 00 a8     stnp            x1, x2, [x3]
 // CHECK-FIX:     22a004:        1a 68 00 14     b       0x24406c
 // CHECK-NOFIX:   22a004:        e9 0c 40 f9     ldr             x9, [x7, #24]
@@ -269,7 +269,7 @@ t3_ffc_stnp:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 22BFFC in unpatched output.
 // CHECK: <t3_ffc_st1singlepost>:
-// CHECK-NEXT:    22bffc:        b7 01 00 b0     adrp    x23, #217088
+// CHECK-NEXT:    22bffc:        b7 01 00 b0     adrp    x23, 0x260000
 // CHECK-NEXT:    22c000:        20 04 82 0d     st1 { v0.b }[1], [x1], x2
 // CHECK-FIX:     22c004:        1c 60 00 14     b       0x244074
 // CHECK-NOFIX:   22c004:        f6 12 40 f9     ldr     x22, [x23, #32]
@@ -287,7 +287,7 @@ t3_ffc_st1singlepost:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 22DFF8 in unpatched output.
 // CHECK: <t3_ff8_st1multiple>:
-// CHECK-NEXT:    22dff8:        97 01 00 f0     adrp    x23, #208896
+// CHECK-NEXT:    22dff8:        97 01 00 f0     adrp    x23, 0x260000
 // CHECK-NEXT:    22dffc:        20 a0 00 4c     st1     { v0.16b, v1.16b }, [x1]
 // CHECK-FIX:     22e000:        1f 58 00 14     b       0x24407c
 // CHECK-NOFIX:   22e000:        f8 16 40 f9     ldr     x24, [x23, #40]
@@ -305,7 +305,7 @@ t3_ff8_st1multiple:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 22FFF8 in unpatched output.
 // CHECK: <t4_ff8_ldr>:
-// CHECK-NEXT:    22fff8:        80 01 00 b0     adrp    x0, #200704
+// CHECK-NEXT:    22fff8:        80 01 00 b0     adrp    x0, 0x260000
 // CHECK-NEXT:    22fffc:        21 00 40 f9     ldr             x1, [x1]
 // CHECK-NEXT:    230000:        42 00 00 8b     add             x2, x2, x0
 // CHECK-FIX:     230004:        20 50 00 14     b       0x244084
@@ -325,7 +325,7 @@ t4_ff8_ldr:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 231FFC in unpatched output.
 // CHECK: <t4_ffc_str>:
-// CHECK-NEXT:    231ffc:        7c 01 00 f0     adrp    x28, #192512
+// CHECK-NEXT:    231ffc:        7c 01 00 f0     adrp    x28, 0x260000
 // CHECK-NEXT:    232000:        42 00 00 f9     str             x2, [x2]
 // CHECK-NEXT:    232004:        20 00 02 cb     sub             x0, x1, x2
 // CHECK-FIX:     232008:        21 48 00 14     b       0x24408c
@@ -345,7 +345,7 @@ t4_ffc_str:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 233FF8 in unpatched output.
 // CHECK: <t4_ff8_stp>:
-// CHECK-NEXT:    233ff8:        70 01 00 b0     adrp    x16, #184320
+// CHECK-NEXT:    233ff8:        70 01 00 b0     adrp    x16, 0x260000
 // CHECK-NEXT:    233ffc:        61 08 00 a9     stp             x1, x2, [x3]
 // CHECK-NEXT:    234000:        03 7e 10 9b     mul             x3, x16, x16
 // CHECK-FIX:     234004:        24 40 00 14     b       0x244094
@@ -365,7 +365,7 @@ t4_ff8_stp:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 235FF8 in unpatched output.
 // CHECK: <t4_ff8_stppre>:
-// CHECK-NEXT:    235ff8:        50 01 00 f0     adrp    x16, #176128
+// CHECK-NEXT:    235ff8:        50 01 00 f0     adrp    x16, 0x260000
 // CHECK-NEXT:    235ffc:        61 08 81 a9     stp     x1, x2, [x3, #16]!
 // CHECK-NEXT:    236000:        03 7e 10 9b     mul             x3, x16, x16
 // CHECK-FIX:     236004:        26 38 00 14     b       0x24409c
@@ -385,7 +385,7 @@ t4_ff8_stppre:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 237FF8 in unpatched output.
 // CHECK: <t4_ff8_stppost>:
-// CHECK-NEXT:    237ff8:        50 01 00 b0     adrp    x16, #167936
+// CHECK-NEXT:    237ff8:        50 01 00 b0     adrp    x16, 0x260000
 // CHECK-NEXT:    237ffc:        61 08 81 a8     stp     x1, x2, [x3], #16
 // CHECK-NEXT:    238000:        03 7e 10 9b     mul             x3, x16, x16
 // CHECK-FIX:     238004:        28 30 00 14     b       0x2440a4
@@ -405,7 +405,7 @@ t4_ff8_stppost:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 239FFC in unpatched output.
 // CHECK: <t4_ffc_stpsimd>:
-// CHECK-NEXT:    239ffc:        30 01 00 f0     adrp    x16, #159744
+// CHECK-NEXT:    239ffc:        30 01 00 f0     adrp    x16, 0x260000
 // CHECK-NEXT:    23a000:        61 08 00 ad     stp             q1, q2, [x3]
 // CHECK-NEXT:    23a004:        03 7e 10 9b     mul             x3, x16, x16
 // CHECK-FIX:     23a008:        29 28 00 14     b       0x2440ac
@@ -425,7 +425,7 @@ t4_ffc_stpsimd:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 23BFFC in unpatched output.
 // CHECK: <t4_ffc_stnp>:
-// CHECK-NEXT:    23bffc:        27 01 00 b0     adrp    x7, #151552
+// CHECK-NEXT:    23bffc:        27 01 00 b0     adrp    x7, 0x260000
 // CHECK-NEXT:    23c000:        61 08 00 a8     stnp            x1, x2, [x3]
 // CHECK-NEXT:    23c004:        1f 20 03 d5     nop
 // CHECK-FIX:     23c008:        2b 20 00 14     b       0x2440b4
@@ -445,7 +445,7 @@ t4_ffc_stnp:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 23DFFC in unpatched output.
 // CHECK: <t4_ffc_st1>:
-// CHECK-NEXT:    23dffc:        18 01 00 f0     adrp    x24, #143360
+// CHECK-NEXT:    23dffc:        18 01 00 f0     adrp    x24, 0x260000
 // CHECK-NEXT:    23e000:        20 80 00 4d     st1 { v0.s }[2], [x1]
 // CHECK-NEXT:    23e004:        f6 06 40 f9     ldr     x22, [x23, #8]
 // CHECK-FIX:     23e008:        2d 18 00 14     b       0x2440bc
@@ -465,7 +465,7 @@ t4_ffc_st1:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 23FFF8 in unpatched output.
 // CHECK: <t3_ff8_ldr_once>:
-// CHECK-NEXT:    23fff8:        00 01 00 b0     adrp    x0, #135168
+// CHECK-NEXT:    23fff8:        00 01 00 b0     adrp    x0, 0x260000
 // CHECK-NEXT:    23fffc:        20 70 82 4c     st1     { v0.16b }, [x1], x2
 // CHECK-FIX:     240000:        31 10 00 14     b       0x2440c4
 // CHECK-NOFIX:   240000:        01 08 40 f9     ldr     x1, [x0, #16]
@@ -485,7 +485,7 @@ t3_ff8_ldr_once:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 241FF8 in unpatched output.
 // CHECK: <t3_ff8_ldxr>:
-// CHECK-NEXT:    241ff8:        e0 00 00 f0     adrp    x0, #126976
+// CHECK-NEXT:    241ff8:        e0 00 00 f0     adrp    x0, 0x260000
 // CHECK-NEXT:    241ffc:        03 7c 5f c8     ldxr    x3, [x0]
 // CHECK-FIX:     242000:        33 08 00 14     b       0x2440cc
 // CHECK-NOFIX:   242000:        01 08 40 f9     ldr     x1, [x0, #16]
@@ -505,7 +505,7 @@ t3_ff8_ldxr:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 243FF8 in unpatched output.
 // CHECK: <t3_ff8_stxr>:
-// CHECK-NEXT:    243ff8:        e0 00 00 b0     adrp    x0, #118784
+// CHECK-NEXT:    243ff8:        e0 00 00 b0     adrp    x0, 0x260000
 // CHECK-NEXT:    243ffc:        03 7c 04 c8     stxr    w4, x3, [x0]
 // CHECK-FIX:     244000:        35 00 00 14     b       0x2440d4
 // CHECK-NOFIX:   244000:        01 08 40 f9     ldr     x1, [x0, #16]

diff  --git a/lld/test/ELF/aarch64-cortex-a53-843419-thunk.s b/lld/test/ELF/aarch64-cortex-a53-843419-thunk.s
index 998175e39719..290fc712e070 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-thunk.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-thunk.s
@@ -39,7 +39,7 @@ t3_ff8_ldr:
 
 // CHECK-PRINT: detected cortex-a53-843419 erratum sequence starting at 10FF8 in unpatched output.
 // CHECK: 0000000000010ff8 <t3_ff8_ldr>:
-// CHECK-NEXT: adrp    x0, #134217728
+// CHECK-NEXT: adrp    x0, 0x8010000
 // CHECK-NEXT: ldr     x1, [x1]
 // CHECK-NEXT: b       0x11008
 // CHECK-NEXT: ret

diff  --git a/lld/test/ELF/aarch64-feature-bti.s b/lld/test/ELF/aarch64-feature-bti.s
index f4fb701cc77c..a66aced645ed 100644
--- a/lld/test/ELF/aarch64-feature-bti.s
+++ b/lld/test/ELF/aarch64-feature-bti.s
@@ -22,7 +22,7 @@
 # NOBTI: Disassembly of section .plt:
 # NOBTI: 00000000000102d0 <.plt>:
 # NOBTI-NEXT:    102d0: stp     x16, x30, [sp, #-16]!
-# NOBTI-NEXT:    102d4: adrp    x16, #131072
+# NOBTI-NEXT:    102d4: adrp    x16, 0x30000
 # NOBTI-NEXT:    102d8: ldr     x17, [x16, #960]
 # NOBTI-NEXT:    102dc: add     x16, x16, #960
 # NOBTI-NEXT:    102e0: br      x17
@@ -30,7 +30,7 @@
 # NOBTI-NEXT:    102e8: nop
 # NOBTI-NEXT:    102ec: nop
 # NOBTI: 00000000000102f0 <func3 at plt>:
-# NOBTI-NEXT:    102f0: adrp    x16, #131072
+# NOBTI-NEXT:    102f0: adrp    x16, 0x30000
 # NOBTI-NEXT:    102f4: ldr     x17, [x16, #968]
 # NOBTI-NEXT:    102f8: add     x16, x16, #968
 # NOBTI-NEXT:    102fc: br      x17
@@ -64,14 +64,14 @@
 # BTISO: 0000000000010360 <.plt>:
 # BTISO-NEXT:    10360: bti     c
 # BTISO-NEXT:           stp     x16, x30, [sp, #-16]!
-# BTISO-NEXT:           adrp    x16, #131072
+# BTISO-NEXT:           adrp    x16, 0x30000
 # BTISO-NEXT:           ldr     x17, [x16, #1136]
 # BTISO-NEXT:           add     x16, x16, #1136
 # BTISO-NEXT:           br      x17
 # BTISO-NEXT:           nop
 # BTISO-NEXT:           nop
 # BTISO: 0000000000010380 <func3 at plt>:
-# BTISO-NEXT:    10380: adrp    x16, #131072
+# BTISO-NEXT:    10380: adrp    x16, 0x30000
 # BTISO-NEXT:           ldr     x17, [x16, #1144]
 # BTISO-NEXT:           add     x16, x16, #1144
 # BTISO-NEXT:           br      x17
@@ -98,7 +98,7 @@
 # EXECBTI: 0000000000210350 <.plt>:
 # EXECBTI-NEXT:   210350: bti   c
 # EXECBTI-NEXT:           stp   x16, x30, [sp, #-16]!
-# EXECBTI-NEXT:           adrp  x16, #131072
+# EXECBTI-NEXT:           adrp  x16, 0x230000
 # EXECBTI-NEXT:           ldr   x17, [x16, #1160]
 # EXECBTI-NEXT:           add   x16, x16, #1160
 # EXECBTI-NEXT:           br    x17
@@ -106,7 +106,7 @@
 # EXECBTI-NEXT:           nop
 # EXECBTI: 0000000000210370 <func2 at plt>:
 # EXECBTI-NEXT:   210370: bti   c
-# EXECBTI-NEXT:           adrp  x16, #131072
+# EXECBTI-NEXT:           adrp  x16, 0x230000
 # EXECBTI-NEXT:           ldr   x17, [x16, #1168]
 # EXECBTI-NEXT:           add   x16, x16, #1168
 # EXECBTI-NEXT:           br    x17
@@ -126,7 +126,7 @@
 # PIE: 0000000000010350 <.plt>:
 # PIE-NEXT:    10350: bti    c
 # PIE-NEXT:           stp    x16, x30, [sp, #-16]!
-# PIE-NEXT:           adrp   x16, #131072
+# PIE-NEXT:           adrp   x16, 0x30000
 # PIE-NEXT:           ldr    x17, [x16, #1176]
 # PIE-NEXT:           add    x16, x16, #1176
 # PIE-NEXT:           br     x17
@@ -134,7 +134,7 @@
 # PIE-NEXT:           nop
 # PIE: 0000000000010370 <func2 at plt>:
 # PIE-NEXT:    10370: bti    c
-# PIE-NEXT:           adrp   x16, #131072
+# PIE-NEXT:           adrp   x16, 0x30000
 # PIE-NEXT:           ldr    x17, [x16, #1184]
 # PIE-NEXT:           add    x16, x16, #1184
 # PIE-NEXT:           br     x17
@@ -156,7 +156,7 @@
 # NOEX: Disassembly of section .plt:
 # NOEX: 00000000002102f0 <.plt>:
 # NOEX-NEXT:   2102f0: stp     x16, x30, [sp, #-16]!
-# NOEX-NEXT:           adrp    x16, #131072
+# NOEX-NEXT:           adrp    x16, 0x230000
 # NOEX-NEXT:           ldr     x17, [x16, #1024]
 # NOEX-NEXT:           add     x16, x16, #1024
 # NOEX-NEXT:           br      x17
@@ -164,7 +164,7 @@
 # NOEX-NEXT:           nop
 # NOEX-NEXT:           nop
 # NOEX: 0000000000210310 <func2 at plt>:
-# NOEX-NEXT:   210310: adrp    x16, #131072
+# NOEX-NEXT:   210310: adrp    x16, 0x230000
 # NOEX-NEXT:           ldr     x17, [x16, #1032]
 # NOEX-NEXT:           add     x16, x16, #1032
 # NOEX-NEXT:           br      x17
@@ -191,7 +191,7 @@
 # FORCE: 0000000000210380 <.plt>:
 # FORCE-NEXT:   210380: bti     c
 # FORCE-NEXT:           stp     x16, x30, [sp, #-16]!
-# FORCE-NEXT:           adrp    x16, #131072
+# FORCE-NEXT:           adrp    x16, 0x230000
 # FORCE-NEXT:           ldr     x17, [x16, #1192]
 # FORCE-NEXT:           add     x16, x16, #1192
 # FORCE-NEXT:           br      x17
@@ -199,7 +199,7 @@
 # FORCE-NEXT:           nop
 # FORCE: 00000000002103a0 <func2 at plt>:
 # FORCE-NEXT:   2103a0: bti     c
-# FORCE-NEXT:           adrp    x16, #131072
+# FORCE-NEXT:           adrp    x16, 0x230000
 # FORCE-NEXT:           ldr     x17, [x16, #1200]
 # FORCE-NEXT:           add     x16, x16, #1200
 # FORCE-NEXT:           br      x17

diff  --git a/lld/test/ELF/aarch64-feature-btipac.s b/lld/test/ELF/aarch64-feature-btipac.s
index e5d8abeaaf28..653bb05dc968 100644
--- a/lld/test/ELF/aarch64-feature-btipac.s
+++ b/lld/test/ELF/aarch64-feature-btipac.s
@@ -24,14 +24,14 @@
 # BTIPACSO: 0000000000010360 <.plt>:
 # BTIPACSO-NEXT:    10360:              bti     c
 # BTIPACSO-NEXT:                        stp     x16, x30, [sp, #-16]!
-# BTIPACSO-NEXT:                        adrp    x16, #131072
+# BTIPACSO-NEXT:                        adrp    x16, 0x30000
 # BTIPACSO-NEXT:                        ldr     x17, [x16, #1136]
 # BTIPACSO-NEXT:                        add     x16, x16, #1136
 # BTIPACSO-NEXT:                        br      x17
 # BTIPACSO-NEXT:                        nop
 # BTIPACSO-NEXT:                        nop
 # BTIPACSO: 0000000000010380 <func3 at plt>:
-# BTIPACSO-NEXT:    10380:              adrp    x16, #131072
+# BTIPACSO-NEXT:    10380:              adrp    x16, 0x30000
 # BTIPACSO-NEXT:                        ldr     x17, [x16, #1144]
 # BTIPACSO-NEXT:                        add     x16, x16, #1144
 # BTIPACSO-NEXT:                        br      x17
@@ -61,7 +61,7 @@
 # BTIPACEX: 0000000000210380 <.plt>:
 # BTIPACEX-NEXT:   210380:              bti     c
 # BTIPACEX-NEXT:                        stp     x16, x30, [sp, #-16]!
-# BTIPACEX-NEXT:                        adrp    x16, #131072
+# BTIPACEX-NEXT:                        adrp    x16, 0x230000
 # BTIPACEX-NEXT:                        ldr     x17, [x16, #1192]
 # BTIPACEX-NEXT:                        add     x16, x16, #1192
 # BTIPACEX-NEXT:                        br      x17
@@ -69,7 +69,7 @@
 # BTIPACEX-NEXT:                        nop
 # BTIPACEX: 00000000002103a0 <func2 at plt>:
 # BTIPACEX-NEXT:   2103a0:              bti     c
-# BTIPACEX-NEXT:                        adrp    x16, #131072
+# BTIPACEX-NEXT:                        adrp    x16, 0x230000
 # BTIPACEX-NEXT:                        ldr     x17, [x16, #1200]
 # BTIPACEX-NEXT:                        add     x16, x16, #1200
 # BTIPACEX-NEXT:                        br      x17
@@ -93,7 +93,7 @@
 # EX: Disassembly of section .plt:
 # EX: 00000000002102f0 <.plt>:
 # EX-NEXT:   2102f0: stp     x16, x30, [sp, #-16]!
-# EX-NEXT:           adrp    x16, #131072
+# EX-NEXT:           adrp    x16, 0x230000
 # EX-NEXT:           ldr     x17, [x16, #1024]
 # EX-NEXT:           add     x16, x16, #1024
 # EX-NEXT:           br      x17
@@ -101,7 +101,7 @@
 # EX-NEXT:           nop
 # EX-NEXT:           nop
 # EX: 0000000000210310 <func2 at plt>:
-# EX:        210310: adrp    x16, #131072
+# EX:        210310: adrp    x16, 0x230000
 # EX-NEXT:           ldr     x17, [x16, #1032]
 # EX-NEXT:           add     x16, x16, #1032
 # EX-NEXT:           br      x17
@@ -155,7 +155,7 @@ func1:
 # BTIPACEX2: 0000000000210380 <.plt>:
 # BTIPACEX2-NEXT:   210380:              bti     c
 # BTIPACEX2-NEXT:                        stp     x16, x30, [sp, #-16]!
-# BTIPACEX2-NEXT:                        adrp    x16, #131072
+# BTIPACEX2-NEXT:                        adrp    x16, 0x230000
 # BTIPACEX2-NEXT:                        ldr     x17, [x16, #1208]
 # BTIPACEX2-NEXT:                        add     x16, x16, #1208
 # BTIPACEX2-NEXT:                        br      x17
@@ -163,11 +163,11 @@ func1:
 # BTIPACEX2-NEXT:                        nop
 # BTIPACEX2: 00000000002103a0 <func2 at plt>:
 # BTIPACEX2-NEXT:   2103a0:              bti     c
-# BTIPACEX2-NEXT:                        adrp    x16, #131072
+# BTIPACEX2-NEXT:                        adrp    x16, 0x230000
 # BTIPACEX2-NEXT:                        ldr     x17, [x16, #1216]
 # BTIPACEX2-NEXT:                        add     x16, x16, #1216
 # BTIPACEX2-NEXT:                        autia1716
 # BTIPACEX2-NEXT:                        br      x17
 
 # BTIPACDYN2:        0x0000000070000001 (AARCH64_BTI_PLT)
-# BTIPACDYN2-NEXT:   0x0000000070000003 (AARCH64_PAC_PLT)
\ No newline at end of file
+# BTIPACDYN2-NEXT:   0x0000000070000003 (AARCH64_PAC_PLT)

diff  --git a/lld/test/ELF/aarch64-feature-pac.s b/lld/test/ELF/aarch64-feature-pac.s
index 8b5182f53ee5..4bdba6947f95 100644
--- a/lld/test/ELF/aarch64-feature-pac.s
+++ b/lld/test/ELF/aarch64-feature-pac.s
@@ -19,7 +19,7 @@
 # NOPAC: Disassembly of section .plt:
 # NOPAC: 00000000000102d0 <.plt>:
 # NOPAC-NEXT:    102d0: stp     x16, x30, [sp, #-16]!
-# NOPAC-NEXT:           adrp    x16, #131072
+# NOPAC-NEXT:           adrp    x16, 0x30000
 # NOPAC-NEXT:           ldr     x17, [x16, #960]
 # NOPAC-NEXT:           add     x16, x16, #960
 # NOPAC-NEXT:           br      x17
@@ -27,7 +27,7 @@
 # NOPAC-NEXT:           nop
 # NOPAC-NEXT:           nop
 # NOPAC: 00000000000102f0 <func3 at plt>:
-# NOPAC-NEXT:    102f0: adrp    x16, #131072
+# NOPAC-NEXT:    102f0: adrp    x16, 0x30000
 # NOPAC-NEXT:           ldr     x17, [x16, #968]
 # NOPAC-NEXT:           add     x16, x16, #968
 # NOPAC-NEXT:           br      x17
@@ -54,7 +54,7 @@
 # PACSO: Disassembly of section .plt:
 # PACSO: 0000000000010360 <.plt>:
 # PACSO-NEXT:    10360:         stp     x16, x30, [sp, #-16]!
-# PACSO-NEXT:                   adrp    x16, #131072
+# PACSO-NEXT:                   adrp    x16, 0x30000
 # PACSO-NEXT:                   ldr     x17, [x16, #1120]
 # PACSO-NEXT:                   add     x16, x16, #1120
 # PACSO-NEXT:                   br      x17
@@ -62,7 +62,7 @@
 # PACSO-NEXT:                   nop
 # PACSO-NEXT:                   nop
 # PACSO: 0000000000010380 <func3 at plt>:
-# PACSO-NEXT:    10380:         adrp    x16, #131072
+# PACSO-NEXT:    10380:         adrp    x16, 0x30000
 # PACSO-NEXT:                   ldr     x17, [x16, #1128]
 # PACSO-NEXT:                   add     x16, x16, #1128
 # PACSO-NEXT:                   br      x17
@@ -95,7 +95,7 @@
 # PACPLT: Disassembly of section .plt:
 # PACPLT: 0000000000210380 <.plt>:
 # PACPLT-NEXT:   210380:        stp     x16, x30, [sp, #-16]!
-# PACPLT-NEXT:                  adrp    x16, #131072
+# PACPLT-NEXT:                  adrp    x16, 0x230000
 # PACPLT-NEXT:                  ldr     x17, [x16, #1192]
 # PACPLT-NEXT:                  add     x16, x16, #1192
 # PACPLT-NEXT:                  br      x17
@@ -103,7 +103,7 @@
 # PACPLT-NEXT:                  nop
 # PACPLT-NEXT:                  nop
 # PACPLT: 00000000002103a0 <func2 at plt>:
-# PACPLT-NEXT:   2103a0:        adrp    x16, #131072
+# PACPLT-NEXT:   2103a0:        adrp    x16, 0x230000
 # PACPLT-NEXT:                  ldr     x17, [x16, #1200]
 # PACPLT-NEXT:                  add     x16, x16, #1200
 # PACPLT-NEXT:                  autia1716

diff  --git a/lld/test/ELF/aarch64-fpic-got.s b/lld/test/ELF/aarch64-fpic-got.s
index 4f46cea9c6ee..091fb84e2b6e 100644
--- a/lld/test/ELF/aarch64-fpic-got.s
+++ b/lld/test/ELF/aarch64-fpic-got.s
@@ -17,7 +17,7 @@
 ## page(0x220320) - page(0x210000) = 65536
 ## page(0x220320) & 0xff8 = 800
 # DIS:      <_start>:
-# DIS-NEXT: 210258: adrp x0, #65536
+# DIS-NEXT: 210258: adrp x0, 0x220000
 # DIS-NEXT: 21025c: ldr x0, [x0, #800]
 
 .globl _start

diff  --git a/lld/test/ELF/aarch64-gnu-ifunc-address.s b/lld/test/ELF/aarch64-gnu-ifunc-address.s
index 36c3f5a3bd28..46a914fe82fa 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc-address.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc-address.s
@@ -22,7 +22,7 @@ main:
  ret
 # CHECK:   0000000000010284 <main>:
 ## myfunc's got entry = page(0x20330)-page(0x10284) + 0x330 = 65536 + 816
-# CHECK-NEXT:    10284: adrp    x8, #65536
+# CHECK-NEXT:    10284: adrp    x8, 0x20000
 # CHECK-NEXT:    10288: ldr     x8, [x8, #816]
 # CHECK-NEXT:    1028c: ret
 

diff  --git a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
index 9f8a59367b0e..284d9a8d7edc 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
@@ -33,7 +33,7 @@ main:
 # PDE:      <myfunc_resolver>:
 # PDE-NEXT:   210170:   ret
 # PDE:      <main>:
-# PDE-NEXT:   210174:   adrp    x8, #0
+# PDE-NEXT:   210174:   adrp    x8, 0x210000
 # PDE-NEXT:   210178:   add     x8, x8, #384
 # PDE-NEXT:   21017c:   ret
 # PDE-EMPTY:
@@ -41,7 +41,7 @@ main:
 # PDE-EMPTY:
 # PDE-NEXT: <myfunc>:
 ## page(.got.plt) - page(0x210010) = 65536
-# PDE-NEXT:   210180: adrp    x16, #65536
+# PDE-NEXT:   210180: adrp    x16, 0x220000
 # PDE-NEXT:   210184: ldr     x17, [x16, #400]
 # PDE-NEXT:   210188: add     x16, x16, #400
 # PDE-NEXT:   21018c: br      x17
@@ -55,14 +55,14 @@ main:
 # PIE:      <myfunc_resolver>:
 # PIE-NEXT:    10260: ret
 # PIE:      <main>:
-# PIE-NEXT:    10264: adrp    x8, #0
+# PIE-NEXT:    10264: adrp    x8, 0x10000
 # PIE-NEXT:    10268: add     x8, x8, #624
 # PIE-NEXT:    1026c: ret
 # PIE-EMPTY:
 # PIE-NEXT: Disassembly of section .iplt:
 # PIE-EMPTY:
 # PIE-NEXT: <myfunc>:
-# PIE-NEXT:    10270: adrp    x16, #131072
+# PIE-NEXT:    10270: adrp    x16, 0x30000
 # PIE-NEXT:    10274: ldr     x17, [x16, #896]
 # PIE-NEXT:    10278: add     x16, x16, #896
 # PIE-NEXT:    1027c: br      x17

diff  --git a/lld/test/ELF/aarch64-gnu-ifunc-plt.s b/lld/test/ELF/aarch64-gnu-ifunc-plt.s
index a74965a7b364..fdd8e6ee09aa 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc-plt.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc-plt.s
@@ -48,7 +48,7 @@
 // DISASM-EMPTY:
 // DISASM-NEXT: <.plt>:
 // DISASM-NEXT:    2102f0: stp     x16, x30, [sp, #-16]!
-// DISASM-NEXT:    2102f4: adrp    x16, #131072
+// DISASM-NEXT:    2102f4: adrp    x16, 0x230000
 // DISASM-NEXT:    2102f8: ldr     x17, [x16, #1104]
 // DISASM-NEXT:    2102fc: add     x16, x16, #1104
 // DISASM-NEXT:    210300: br      x17
@@ -57,13 +57,13 @@
 // DISASM-NEXT:    21030c: nop
 // DISASM-EMPTY:
 // DISASM-NEXT:   <bar2 at plt>:
-// DISASM-NEXT:    210310: adrp    x16, #131072
+// DISASM-NEXT:    210310: adrp    x16, 0x230000
 // DISASM-NEXT:    210314: ldr     x17, [x16, #1112]
 // DISASM-NEXT:    210318: add     x16, x16, #1112
 // DISASM-NEXT:    21031c: br      x17
 // DISASM-EMPTY:
 // DISASM-NEXT:   <zed2 at plt>:
-// DISASM-NEXT:    210320: adrp    x16, #131072
+// DISASM-NEXT:    210320: adrp    x16, 0x230000
 // DISASM-NEXT:    210324: ldr     x17, [x16, #1120]
 // DISASM-NEXT:    210328: add     x16, x16, #1120
 // DISASM-NEXT:    21032c: br      x17
@@ -71,11 +71,11 @@
 // DISASM-NEXT: Disassembly of section .iplt:
 // DISASM-EMPTY:
 // DISASM-NEXT: <.iplt>:
-// DISASM-NEXT:    210330: adrp    x16, #131072
+// DISASM-NEXT:    210330: adrp    x16, 0x230000
 // DISASM-NEXT:    210334: ldr     x17, [x16, #1128]
 // DISASM-NEXT:    210338: add     x16, x16, #1128
 // DISASM-NEXT:    21033c: br      x17
-// DISASM-NEXT:    210340: adrp    x16, #131072
+// DISASM-NEXT:    210340: adrp    x16, 0x230000
 // DISASM-NEXT:    210344: ldr     x17, [x16, #1136]
 // DISASM-NEXT:    210348: add     x16, x16, #1136
 // DISASM-NEXT:    21034c: br      x17

diff  --git a/lld/test/ELF/aarch64-gnu-ifunc.s b/lld/test/ELF/aarch64-gnu-ifunc.s
index e03651788b6a..e0a51aa1c3c6 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc.s
@@ -115,11 +115,11 @@
 // DISASM-NEXT: Disassembly of section .iplt:
 // DISASM-EMPTY:
 // DISASM-NEXT: <.iplt>:
-// DISASM-NEXT:  2101a0: adrp x16, #65536
+// DISASM-NEXT:  2101a0: adrp x16, 0x220000
 // DISASM-NEXT:  2101a4: ldr x17, [x16, #448]
 // DISASM-NEXT:  2101a8: add x16, x16, #448
 // DISASM-NEXT:  2101ac: br x17
-// DISASM-NEXT:  2101b0: adrp x16, #65536
+// DISASM-NEXT:  2101b0: adrp x16, 0x220000
 // DISASM-NEXT:  2101b4: ldr x17, [x16, #456]
 // DISASM-NEXT:  2101b8: add x16, x16, #456
 // DISASM-NEXT:  2101bc: br x17

diff  --git a/lld/test/ELF/aarch64-gnu-ifunc2.s b/lld/test/ELF/aarch64-gnu-ifunc2.s
index 89b7625858c1..b70c38c299e0 100644
--- a/lld/test/ELF/aarch64-gnu-ifunc2.s
+++ b/lld/test/ELF/aarch64-gnu-ifunc2.s
@@ -12,7 +12,7 @@
 
 # CHECK:      <main>:
 # .got.plt - page(0x210174) = 0x220190 - 0x210000 = 0x10190
-# CHECK-NEXT:   210174: adrp    x8, #0x10000
+# CHECK-NEXT:   210174: adrp    x8, 0x220000
 # CHECK-NEXT:   210178: ldr     x8, [x8, #0x190]
 # CHECK-NEXT:   21017c: ret
 
@@ -20,7 +20,7 @@
 # CHECK-EMPTY:
 # CHECK-NEXT: <.iplt>:
 # .got.plt - page(0x210180) = 0x220190 - 0x210000 = 0x10190
-# CHECK-NEXT:   210180: adrp    x16, #0x10000
+# CHECK-NEXT:   210180: adrp    x16, 0x220000
 # CHECK-NEXT:   210184: ldr     x17, [x16, #0x190]
 # CHECK-NEXT:   210188: add     x16, x16, #0x190
 # CHECK-NEXT:   21018c: br      x17

diff  --git a/lld/test/ELF/aarch64-hi21-nc.s b/lld/test/ELF/aarch64-hi21-nc.s
index 154f98c792b9..a70e1482b462 100644
--- a/lld/test/ELF/aarch64-hi21-nc.s
+++ b/lld/test/ELF/aarch64-hi21-nc.s
@@ -4,5 +4,5 @@
 // RUN: llvm-objdump -d %t | FileCheck %s
 
 foo = . + 0x1100000000000000
-// CHECK: adrp x0, #0
+// CHECK: adrp x0, 0x210000
 adrp x0, :pg_hi21_nc:foo

diff  --git a/lld/test/ELF/aarch64-ifunc-bti.s b/lld/test/ELF/aarch64-ifunc-bti.s
index ab6c6236d2a0..d05be1eab6a6 100644
--- a/lld/test/ELF/aarch64-ifunc-bti.s
+++ b/lld/test/ELF/aarch64-ifunc-bti.s
@@ -14,7 +14,7 @@
 # CHECK: 0000000000010380 <.plt>:
 # CHECK-NEXT:    10380:         bti     c
 # CHECK-NEXT:                   stp     x16, x30, [sp, #-16]!
-# CHECK-NEXT:                   adrp    x16, #131072
+# CHECK-NEXT:                   adrp    x16, 0x30000
 # CHECK-NEXT:                   ldr     x17, [x16, #1288]
 # CHECK-NEXT:                   add     x16, x16, #1288
 # CHECK-NEXT:                   br      x17
@@ -22,7 +22,7 @@
 # CHECK-NEXT:                   nop
 # CHECK: 00000000000103a0 <func1 at plt>:
 # CHECK-NEXT:    103a0:         bti     c
-# CHECK-NEXT:                   adrp    x16, #131072
+# CHECK-NEXT:                   adrp    x16, 0x30000
 # CHECK-NEXT:                   ldr     x17, [x16, #1296]
 # CHECK-NEXT:                   add     x16, x16, #1296
 # CHECK-NEXT:                   br      x17
@@ -32,7 +32,7 @@
 # CHECK-EMPTY:
 # CHECK-NEXT: 00000000000103c0 <myfunc>:
 # CHECK-NEXT:    103c0:         bti     c
-# CHECK-NEXT:                   adrp    x16, #131072
+# CHECK-NEXT:                   adrp    x16, 0x30000
 # CHECK-NEXT:                   ldr     x17, [x16, #1304]
 # CHECK-NEXT:                   add     x16, x16, #1304
 # CHECK-NEXT:                   br      x17

diff  --git a/lld/test/ELF/aarch64-plt.s b/lld/test/ELF/aarch64-plt.s
index a049fbef6eb5..7d83a40dfc27 100644
--- a/lld/test/ELF/aarch64-plt.s
+++ b/lld/test/ELF/aarch64-plt.s
@@ -71,7 +71,7 @@
 // DISASMDSO-NEXT: <.plt>:
 // DISASMDSO-NEXT:     10340: stp     x16, x30, [sp, #-0x10]!
 // &(.got.plt[2]) = 0x30450 + 2 * 8 = 0x30460
-// DISASMDSO-NEXT:     10344: adrp    x16, #0x20000
+// DISASMDSO-NEXT:     10344: adrp    x16, 0x30000
 // DISASMDSO-NEXT:     10348: ldr     x17, [x16, #0x460]
 // DISASMDSO-NEXT:     1034c: add     x16, x16, #0x460
 // DISASMDSO-NEXT:     10350: br      x17
@@ -83,7 +83,7 @@
 // &.got.plt[foo] = 0x30468
 // DISASMDSO-EMPTY:
 // DISASMDSO-NEXT:   <foo at plt>:
-// DISASMDSO-NEXT:     10360: adrp    x16, #0x20000
+// DISASMDSO-NEXT:     10360: adrp    x16, 0x30000
 // DISASMDSO-NEXT:     10364: ldr     x17, [x16, #0x468]
 // DISASMDSO-NEXT:     10368: add     x16, x16, #0x468
 // DISASMDSO-NEXT:     1036c: br      x17
@@ -92,7 +92,7 @@
 // &.got.plt[foo] = 0x30470
 // DISASMDSO-EMPTY:
 // DISASMDSO-NEXT:   <bar at plt>:
-// DISASMDSO-NEXT:     10370: adrp    x16, #0x20000
+// DISASMDSO-NEXT:     10370: adrp    x16, 0x30000
 // DISASMDSO-NEXT:     10374: ldr     x17, [x16, #0x470]
 // DISASMDSO-NEXT:     10378: add     x16, x16, #0x470
 // DISASMDSO-NEXT:     1037c: br      x17
@@ -101,7 +101,7 @@
 // 0x30468 = 0x10000 + 131072 + 1128
 // DISASMDSO-EMPTY:
 // DISASMDSO-NEXT:   <weak at plt>:
-// DISASMDSO-NEXT:     10380: adrp    x16, #0x20000
+// DISASMDSO-NEXT:     10380: adrp    x16, 0x30000
 // DISASMDSO-NEXT:     10384: ldr     x17, [x16, #0x478]
 // DISASMDSO-NEXT:     10388: add     x16, x16, #0x478
 // DISASMDSO-NEXT:     1038c: br      x17
@@ -163,7 +163,7 @@
 // DISASMEXE-NEXT: <.plt>:
 // DISASMEXE-NEXT:    2102e0: stp     x16, x30, [sp, #-0x10]!
 // &(.got.plt[2]) = 0x2303f0 + 2 * 8 = 0x230400
-// DISASMEXE-NEXT:    2102e4: adrp    x16, #0x20000
+// DISASMEXE-NEXT:    2102e4: adrp    x16, 0x230000
 // DISASMEXE-NEXT:    2102e8: ldr     x17, [x16, #0x400]
 // DISASMEXE-NEXT:    2102ec: add     x16, x16, #0x400
 // DISASMEXE-NEXT:    2102f0: br      x17
@@ -174,7 +174,7 @@
 // bar at plt
 // DISASMEXE-EMPTY:
 // DISASMEXE-NEXT:   <bar at plt>:
-// DISASMEXE-NEXT:    210300: adrp    x16, #0x20000
+// DISASMEXE-NEXT:    210300: adrp    x16, 0x230000
 // DISASMEXE-NEXT:    210304: ldr     x17, [x16, #0x408]
 // DISASMEXE-NEXT:    210308: add     x16, x16, #0x408
 // DISASMEXE-NEXT:    21030c: br      x17
@@ -182,7 +182,7 @@
 // weak at plt
 // DISASMEXE-EMPTY:
 // DISASMEXE-NEXT:   <weak at plt>:
-// DISASMEXE-NEXT:    210310: adrp    x16, #0x20000
+// DISASMEXE-NEXT:    210310: adrp    x16, 0x230000
 // DISASMEXE-NEXT:    210314: ldr     x17, [x16, #0x410]
 // DISASMEXE-NEXT:    210318: add     x16, x16, #0x410
 // DISASMEXE-NEXT:    21031c: br      x17

diff  --git a/lld/test/ELF/aarch64-relocs.s b/lld/test/ELF/aarch64-relocs.s
index 9025a2413237..089da40a60bc 100644
--- a/lld/test/ELF/aarch64-relocs.s
+++ b/lld/test/ELF/aarch64-relocs.s
@@ -30,7 +30,7 @@ mystr:
 # CHECK: Disassembly of section .R_AARCH64_ADR_PREL_PG_H121:
 # CHECK-EMPTY:
 # CHECK-NEXT: <$x.2>:
-# CHECK-NEXT:   210132:       01 00 00 90     adrp    x1, #0
+# CHECK-NEXT:   210132:       01 00 00 90     adrp    x1, 0x210000
 
 .section .R_AARCH64_ADD_ABS_LO12_NC,"ax", at progbits
   add x0, x0, :lo12:.L.str

diff  --git a/lld/test/ELF/aarch64-thunk-pi.s b/lld/test/ELF/aarch64-thunk-pi.s
index 50322c524046..12a56bc28763 100644
--- a/lld/test/ELF/aarch64-thunk-pi.s
+++ b/lld/test/ELF/aarch64-thunk-pi.s
@@ -35,16 +35,16 @@ low_target2:
 // Expect range extension thunks for .text_low
 // adrp calculation is (PC + signed immediate) & (!0xfff)
 // CHECK: <__AArch64ADRPThunk_high_target>:
-// CHECK-NEXT:       ec:       adrp    x16, #0x10000000
+// CHECK-NEXT:       ec:       adrp    x16, 0x10000000
 // CHECK-NEXT:                 add     x16, x16, #0x40
 // CHECK-NEXT:                 br      x16
 // CHECK: <__AArch64ADRPThunk_high_target2>:
-// CHECK-NEXT:       f8:       adrp    x16, #0x10000000
+// CHECK-NEXT:       f8:       adrp    x16, 0x10000000
 // CHECK-NEXT:                 add     x16, x16, #0x8
 // CHECK-NEXT:                 br      x16
 /// Identical to the previous one, but for the target .text_high+8.
 // CHECK: <__AArch64ADRPThunk_>:
-// CHECK-NEXT:      104:       adrp    x16, #0x10000000
+// CHECK-NEXT:      104:       adrp    x16, 0x10000000
 // CHECK-NEXT:                 add     x16, x16, #0x8
 // CHECK-NEXT:                 br      x16
 
@@ -74,7 +74,7 @@ high_target2:
 // Expect Thunk for .text.high
 
 // CHECK: <__AArch64ADRPThunk_low_target2>:
-// CHECK-NEXT: 10000010:       adrp    x16, #-0x10000000
+// CHECK-NEXT: 10000010:       adrp    x16, 0x0
 // CHECK-NEXT:                 add     x16, x16, #0xe0
 // CHECK-NEXT:                 br      x16
 
@@ -82,7 +82,7 @@ high_target2:
 // CHECK-EMPTY:
 // CHECK-NEXT: <.plt>:
 // CHECK-NEXT: 10000020:       stp     x16, x30, [sp, #-0x10]!
-// CHECK-NEXT:                 adrp    x16, #0
+// CHECK-NEXT:                 adrp    x16, 0x10000000
 // CHECK-NEXT:                 ldr     x17, [x16, #0x120]
 // CHECK-NEXT:                 add     x16, x16, #0x120
 // CHECK-NEXT:                 br      x17
@@ -91,13 +91,13 @@ high_target2:
 // CHECK-NEXT:                 nop
 // CHECK-EMPTY:
 // CHECK-NEXT:   <high_target at plt>:
-// CHECK-NEXT: 10000040:       adrp    x16, #0x0
+// CHECK-NEXT: 10000040:       adrp    x16, 0x10000000
 // CHECK-NEXT:                 ldr     x17, [x16, #0x128]
 // CHECK-NEXT:                 add     x16, x16, #0x128
 // CHECK-NEXT:                 br      x17
 // CHECK-EMPTY:
 // CHECK-NEXT:   <low_target at plt>:
-// CHECK-NEXT: 10000050:       adrp    x16, #0x0
+// CHECK-NEXT: 10000050:       adrp    x16, 0x10000000
 // CHECK-NEXT:                 ldr     x17, [x16, #0x130]
 // CHECK-NEXT:                 add     x16, x16, #0x130
 // CHECK-NEXT:                 br      x17

diff  --git a/lld/test/ELF/aarch64-tls-gdie.s b/lld/test/ELF/aarch64-tls-gdie.s
index 52fb563fc099..ff64bf347516 100644
--- a/lld/test/ELF/aarch64-tls-gdie.s
+++ b/lld/test/ELF/aarch64-tls-gdie.s
@@ -28,7 +28,7 @@ _start:
 
 // CHECK:      <_start>:
 // CHECK-NEXT: 210238: nop
-// CHECK-NEXT: 21023c: adrp    x0, #65536
+// CHECK-NEXT: 21023c: adrp    x0, 0x220000
 // CHECK-NEXT: 210240: ldr     x0, [x0, #768]
 // CHECK-NEXT: 210244: nop
 // CHECK-NEXT: 210248: nop

diff  --git a/lld/test/ELF/aarch64-tls-ie.s b/lld/test/ELF/aarch64-tls-ie.s
index 24443cebe20c..6d3e4e2b1537 100644
--- a/lld/test/ELF/aarch64-tls-ie.s
+++ b/lld/test/ELF/aarch64-tls-ie.s
@@ -34,9 +34,9 @@
 ## Page(0x2200B8) - Page(0x210000) = 0x10000 = 65536
 ## 0x2200B8 & 0xff8 = 0xB8 = 184
 # CHECK:     <_start>:
-# CHECK-NEXT: 210278: adrp x0, #65536
+# CHECK-NEXT: 210278: adrp x0, 0x220000
 # CHECK-NEXT: 21027c: ldr  x0, [x0, #824]
-# CHECK-NEXT: 210280: adrp x0, #65536
+# CHECK-NEXT: 210280: adrp x0, 0x220000
 # CHECK-NEXT: 210284: ldr  x0, [x0, #832]
 
 .globl _start

diff  --git a/lld/test/ELF/aarch64-tlsdesc.s b/lld/test/ELF/aarch64-tlsdesc.s
index 1ae9152364b0..b7d3072d9eef 100644
--- a/lld/test/ELF/aarch64-tlsdesc.s
+++ b/lld/test/ELF/aarch64-tlsdesc.s
@@ -15,7 +15,7 @@
 // create target specific dynamic TLSDESC relocation where addend is
 // the symbol VMA in tls block.
 
-// CHECK:      10298: adrp    x0, #65536
+// CHECK:      10298: adrp    x0, 0x20000
 // CHECK-NEXT: 1029c: ldr     x1, [x0, #856]
 // CHECK-NEXT: 102a0: add     x0, x0, #856
 // CHECK-NEXT: 102a4: blr     x1
@@ -26,7 +26,7 @@
         .tlsdesccall a
         blr     x1
 
-// CHECK:      102a8: adrp    x0, #65536
+// CHECK:      102a8: adrp    x0, 0x20000
 // CHECK-NEXT: 102ac: ldr     x1, [x0, #872]
 // CHECK-NEXT: 102b0: add     x0, x0, #872
 // CHECK-NEXT: 102b4: blr     x1
@@ -37,7 +37,7 @@
         .tlsdesccall a
         blr     x1
 
-// CHECK:      102b8: adrp    x0, #65536
+// CHECK:      102b8: adrp    x0, 0x20000
 // CHECK-NEXT: 102bc: ldr     x1, [x0, #888]
 // CHECK-NEXT: 102c0: add     x0, x0, #888
 // CHECK-NEXT: 102c4: blr     x1

diff  --git a/lld/test/ELF/aarch64-tstbr14-reloc.s b/lld/test/ELF/aarch64-tstbr14-reloc.s
index a6fc4f9f0d0f..5e259755beb8 100644
--- a/lld/test/ELF/aarch64-tstbr14-reloc.s
+++ b/lld/test/ELF/aarch64-tstbr14-reloc.s
@@ -66,7 +66,7 @@
 #DSO-EMPTY:
 #DSO-NEXT: <.plt>:
 #DSO-NEXT:  10330: stp x16, x30, [sp, #-16]!
-#DSO-NEXT:  10334: adrp x16, #131072
+#DSO-NEXT:  10334: adrp x16, 0x30000
 #DSO-NEXT:  10338: ldr x17, [x16, #1072]
 #DSO-NEXT:  1033c: add x16, x16, #1072
 #DSO-NEXT:  10340: br x17
@@ -75,13 +75,13 @@
 #DSO-NEXT:  1034c: nop
 #DSO-EMPTY:
 #DSO-NEXT:   <_foo at plt>:
-#DSO-NEXT:  10350: adrp x16, #131072
+#DSO-NEXT:  10350: adrp x16, 0x30000
 #DSO-NEXT:  10354: ldr x17, [x16, #1080]
 #DSO-NEXT:  10358: add x16, x16, #1080
 #DSO-NEXT:  1035c: br x17
 #DSO-EMPTY:
 #DSO-NEXT:   <_bar at plt>:
-#DSO-NEXT:  10360: adrp x16, #131072
+#DSO-NEXT:  10360: adrp x16, 0x30000
 #DSO-NEXT:  10364: ldr x17, [x16, #1088]
 #DSO-NEXT:  10368: add x16, x16, #1088
 #DSO-NEXT:  1036c: br x17

diff  --git a/lld/test/ELF/aarch64-undefined-weak.s b/lld/test/ELF/aarch64-undefined-weak.s
index 9a4b7c23aa7a..cd5abf3a22ea 100644
--- a/lld/test/ELF/aarch64-undefined-weak.s
+++ b/lld/test/ELF/aarch64-undefined-weak.s
@@ -44,7 +44,7 @@ _start:
 // CHECK-NEXT: 10010128: b.eq    0x1001012c
 // CHECK-NEXT: 1001012c: cbz     x1, 0x10010130
 // CHECK-NEXT: 10010130: adr     x0, #0
-// CHECK-NEXT: 10010134: adrp    x0, #0
+// CHECK-NEXT: 10010134: adrp    x0, 0x10010000
 // CHECK-NEXT: 10010138: ldr     x8, 0x10010138
 // CHECK:      1001013c: 00 00 00 00     .word   0x00000000
 // CHECK-NEXT: 10010140: 00 00 00 00     .word   0x00000000

diff  --git a/llvm/lib/Target/AArch64/AArch64InstrFormats.td b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
index 8e01a8cf7beb..2756e4dc8aa4 100644
--- a/llvm/lib/Target/AArch64/AArch64InstrFormats.td
+++ b/llvm/lib/Target/AArch64/AArch64InstrFormats.td
@@ -263,6 +263,7 @@ def adrplabel : Operand<i64> {
   let EncoderMethod = "getAdrLabelOpValue";
   let PrintMethod = "printAdrpLabel";
   let ParserMatchClass = AdrpOperand;
+  let OperandType = "OPERAND_PCREL";
 }
 
 def AdrOperand : AsmOperandClass {

diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
index 38474d31460d..a372298740ea 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp
@@ -1377,7 +1377,8 @@ void AArch64InstPrinter::printAlignedLabel(const MCInst *MI, uint64_t Address,
   }
 }
 
-void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, unsigned OpNum,
+void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, uint64_t Address,
+                                        unsigned OpNum,
                                         const MCSubtargetInfo &STI,
                                         raw_ostream &O) {
   const MCOperand &Op = MI->getOperand(OpNum);
@@ -1385,7 +1386,11 @@ void AArch64InstPrinter::printAdrpLabel(const MCInst *MI, unsigned OpNum,
   // If the label has already been resolved to an immediate offset (say, when
   // we're running the disassembler), just print the immediate.
   if (Op.isImm()) {
-    O << "#" << formatImm(Op.getImm() * (1 << 12));
+    const int64_t Offset = Op.getImm() << 12;
+    if (PrintBranchImmAsAddress)
+      O << formatHex((Address & -4096) + Offset);
+    else
+      O << "#" << Offset;
     return;
   }
 

diff  --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
index 20c4e4c750ec..1a0342b783a2 100644
--- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
+++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.h
@@ -156,7 +156,7 @@ class AArch64InstPrinter : public MCInstPrinter {
 
   void printVectorIndex(const MCInst *MI, unsigned OpNum,
                         const MCSubtargetInfo &STI, raw_ostream &O);
-  void printAdrpLabel(const MCInst *MI, unsigned OpNum,
+  void printAdrpLabel(const MCInst *MI, uint64_t Address, unsigned OpNum,
                       const MCSubtargetInfo &STI, raw_ostream &O);
   void printBarrierOption(const MCInst *MI, unsigned OpNum,
                           const MCSubtargetInfo &STI, raw_ostream &O);

diff  --git a/llvm/test/MC/AArch64/adr.s b/llvm/test/MC/AArch64/adr.s
index 57b3a5b03096..c6abd5d539e5 100644
--- a/llvm/test/MC/AArch64/adr.s
+++ b/llvm/test/MC/AArch64/adr.s
@@ -19,15 +19,15 @@
   adr x5, (0xffffffff000f1000 - 0xffffffff00000000 + Symbol)
   adr x6, Symbol + (0xffffffff000f1000 - 0xffffffff00000000)
 
-// CHECK-NEXT: adrp x0, #0
+// CHECK-NEXT: adrp x0, 0x0
 // CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21	Symbol
-// CHECK-NEXT: adrp x2, #0
+// CHECK-NEXT: adrp x2, 0x0
 // CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21	Symbol
-// CHECK-NEXT: adrp x3, #0
+// CHECK-NEXT: adrp x3, 0x0
 // CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21	Symbol+0xf1000
-// CHECK-NEXT: adrp x4, #0
+// CHECK-NEXT: adrp x4, 0x0
 // CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21	Symbol+0xf1000
-// CHECK-NEXT: adrp x5, #0
+// CHECK-NEXT: adrp x5, 0x0
 // CHECK-NEXT: R_AARCH64_ADR_PREL_PG_HI21	Symbol+0xf1000
 
   adrp x0, Symbol

diff  --git a/llvm/test/MC/AArch64/coff-relocations.s b/llvm/test/MC/AArch64/coff-relocations.s
index c37b2bb7c3cc..54706fd897e6 100644
--- a/llvm/test/MC/AArch64/coff-relocations.s
+++ b/llvm/test/MC/AArch64/coff-relocations.s
@@ -89,7 +89,7 @@ tbz x0, #0, target
 ; CHECK:   }
 ; CHECK: ]
 
-; DISASM: 30:       20 1a 09 b0     adrp    x0, #305418240
+; DISASM: 30:       20 1a 09 b0     adrp    x0, 0x12345000
 ; DISASM: 34:       00 14 0d 91     add     x0, x0, #837
 ; DISASM: 38:       00 14 4d 39     ldrb    w0, [x0, #837]
 ; DISASM: 3c:       00 a4 41 f9     ldr     x0, [x0, #840]

diff  --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
index 1d988c6ebe5f..9b628d7b0ed5 100644
--- a/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
+++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/elf-aarch64-mapping-symbols.test
@@ -24,7 +24,7 @@ mystr:
 # CHECK:       10:       0a 00           .short  0x000a
 # CHECK: Disassembly of section .myothersection:
 # CHECK: <$x.2>:
-# CHECK:        0:       01 00 00 90     adrp    x1, #0
+# CHECK:        0:       01 00 00 90     adrp    x1, 0x0
 # CHECK: <mystr>:
 # CHECK:        4:       62 6c 61 68     .word
 # CHECK:        8:       00              .byte   0x01

diff  --git a/llvm/test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml b/llvm/test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml
new file mode 100644
index 000000000000..48b2f2c20889
--- /dev/null
+++ b/llvm/test/tools/llvm-objdump/ELF/AArch64/pcrel-address.yaml
@@ -0,0 +1,26 @@
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-objdump %t -d --no-show-raw-insn --no-leading-addr | FileCheck %s
+
+# CHECK-LABEL: <_start>:
+# CHECK-NEXT:    adrp x2, 0x220000 <_start+0x80>
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:    ELFDATA2LSB
+  Type:    ET_EXEC
+  Machine: EM_AARCH64
+Sections:
+  - Name:    .text
+    Type:    SHT_PROGBITS
+    Address: 0x200100
+    Flags:   [SHF_ALLOC, SHF_EXECINSTR]
+    Content: '02010090'
+  - Name:    .data
+    Type:    SHT_PROGBITS
+    Flags:   [SHF_ALLOC, SHF_WRITE]
+    Address: 0x220000
+Symbols:
+  - Name:    _start
+    Section: .text
+    Value:   0x200100


        


More information about the llvm-branch-commits mailing list