[llvm] 87de9a0 - [X86InstPrinter] Change printPCRelImm to print the target address in hexadecimal form

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 08:29:12 PDT 2020


Author: Fangrui Song
Date: 2020-03-26T08:28:59-07:00
New Revision: 87de9a0786d922a1b52db6cd8b12f642d1d00d85

URL: https://github.com/llvm/llvm-project/commit/87de9a0786d922a1b52db6cd8b12f642d1d00d85
DIFF: https://github.com/llvm/llvm-project/commit/87de9a0786d922a1b52db6cd8b12f642d1d00d85.diff

LOG: [X86InstPrinter] Change printPCRelImm to print the target address in hexadecimal form

```
// llvm-objdump -d output (before)
400000: e8 0b 00 00 00   callq 11
400005: e8 0b 00 00 00   callq 11

// llvm-objdump -d output (after)
400000: e8 0b 00 00 00  callq 0x400010
400005: e8 0b 00 00 00  callq 0x400015

// GNU objdump -d. The lack of 0x is not ideal because the result cannot be re-assembled
400000: e8 0b 00 00 00  callq 400010
400005: e8 0b 00 00 00  callq 400015
```

In llvm-objdump, we pass the address of the next MCInst. Ideally we
should just thread the address of the current address, unfortunately we
cannot call X86MCCodeEmitter::encodeInstruction (X86MCCodeEmitter
requires MCInstrInfo and MCContext) to get the length of the MCInst.

MCInstPrinter::printInst has other callers (e.g llvm-mc -filetype=asm, llvm-mca) which set Address to 0.
They leave MCInstPrinter::PrintBranchImmAsAddress as false and this change is a no-op for them.

Reviewed By: jhenderson

Differential Revision: https://reviews.llvm.org/D76580

Added: 
    

Modified: 
    lld/test/COFF/delayimports32.test
    lld/test/COFF/imports.test
    lld/test/COFF/lto-comdat.ll
    lld/test/COFF/lto.ll
    lld/test/ELF/comdat.s
    lld/test/ELF/gnu-ifunc-i386.s
    lld/test/ELF/gnu-ifunc-noplt-i386.s
    lld/test/ELF/gnu-ifunc-noplt.s
    lld/test/ELF/gnu-ifunc-plt-i386.s
    lld/test/ELF/gnu-ifunc-plt.s
    lld/test/ELF/gnu-ifunc-shared.s
    lld/test/ELF/gnu-ifunc.s
    lld/test/ELF/i386-feature-cet.s
    lld/test/ELF/i386-plt.s
    lld/test/ELF/i386-reloc-large-addend.s
    lld/test/ELF/i386-reloc-range.s
    lld/test/ELF/i386-retpoline-nopic-linkerscript.s
    lld/test/ELF/i386-retpoline-nopic.s
    lld/test/ELF/i386-retpoline-pic-linkerscript.s
    lld/test/ELF/i386-retpoline-pic.s
    lld/test/ELF/i386-tls-dynamic.s
    lld/test/ELF/local-got-pie.s
    lld/test/ELF/local-got-shared.s
    lld/test/ELF/local-got.s
    lld/test/ELF/lto/linker-script-symbols-ipo.ll
    lld/test/ELF/no-inhibit-exec.s
    lld/test/ELF/pre_init_fini_array_missing.s
    lld/test/ELF/relocation-i686.s
    lld/test/ELF/relocation.s
    lld/test/ELF/startstop.s
    lld/test/ELF/x86-64-feature-cet.s
    lld/test/ELF/x86-64-gotpc-relax.s
    lld/test/ELF/x86-64-plt.s
    lld/test/ELF/x86-64-retpoline-linkerscript.s
    lld/test/ELF/x86-64-retpoline-znow-linkerscript.s
    lld/test/ELF/x86-64-retpoline-znow-static-iplt.s
    lld/test/ELF/x86-64-retpoline-znow.s
    lld/test/ELF/x86-64-retpoline.s
    llvm/include/llvm/MC/MCInstPrinter.h
    llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
    llvm/test/CodeGen/X86/callbr-asm-obj-file.ll
    llvm/test/LTO/Resolution/X86/not-prevailing.ll
    llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
    llvm/test/MC/COFF/cv-loc-unreachable-2.s
    llvm/test/MC/COFF/cv-loc-unreachable.s
    llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s
    llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s
    llvm/test/MC/X86/align-via-padding.s
    llvm/test/MC/X86/align-via-relaxation.s
    llvm/test/MC/X86/x86-branch-relaxation.s
    llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
    llvm/test/Object/X86/objdump-trivial-object.test
    llvm/test/tools/llvm-objdump/ELF/call-absolute-symbol.test
    llvm/test/tools/llvm-objdump/MachO/hex-displacement.test
    llvm/test/tools/llvm-objdump/X86/coff-disassemble-export.test
    llvm/test/tools/llvm-objdump/X86/demangle.s
    llvm/test/tools/llvm-objdump/X86/elf-disassemble-no-symtab.test
    llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test
    llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-references.yaml
    llvm/test/tools/llvm-objdump/X86/section-filter-relocs.test
    llvm/tools/llvm-objdump/llvm-objdump.cpp

Removed: 
    


################################################################################
diff  --git a/lld/test/COFF/delayimports32.test b/lld/test/COFF/delayimports32.test
index 41b4bdc97ef1..3c1f892ff837 100644
--- a/lld/test/COFF/delayimports32.test
+++ b/lld/test/COFF/delayimports32.test
@@ -72,14 +72,14 @@ BASEREL-NEXT:   }
 BASEREL-NEXT: ]
 
 DISASM:      1029:      b8 20 30 40 00  movl    $4206624, %eax
-DISASM-NEXT: 102e:      e9 0a 00 00 00  jmp     10 <.text+0x3d>
+DISASM-NEXT: 102e:      e9 0a 00 00 00  jmp     0x40103d <.text+0x3d>
 DISASM-NEXT: 1033:      b8 24 30 40 00  movl    $4206628, %eax
-DISASM-NEXT: 1038:      e9 00 00 00 00  jmp     0 <.text+0x3d>
+DISASM-NEXT: 1038:      e9 00 00 00 00  jmp     0x40103d <.text+0x3d>
 DISASM-NEXT: 103d:      51      pushl   %ecx
 DISASM-NEXT: 103e:      52      pushl   %edx
 DISASM-NEXT: 103f:      50      pushl   %eax
 DISASM-NEXT: 1040:      68 00 20 40 00  pushl   $4202496
-DISASM-NEXT: 1045:      e8 b6 ff ff ff  calll   -74 <.text>
+DISASM-NEXT: 1045:      e8 b6 ff ff ff  calll   0x401000 <.text>
 DISASM-NEXT: 104a:      5a      popl    %edx
 DISASM-NEXT: 104b:      59      popl    %ecx
 DISASM-NEXT: 104c:      ff e0   jmpl    *%eax

diff  --git a/lld/test/COFF/imports.test b/lld/test/COFF/imports.test
index c120b82055ed..a5e030b57744 100644
--- a/lld/test/COFF/imports.test
+++ b/lld/test/COFF/imports.test
@@ -19,10 +19,10 @@ TEXT-NEXT: movq    $0, %rcx
 TEXT-NEXT: leaq    8180(%rip), %rdx
 TEXT-NEXT: leaq    8167(%rip), %r8
 TEXT-NEXT: movl    $0, %r9d
-TEXT-NEXT: callq   60
+TEXT-NEXT: callq   0x140001060
 TEXT-NEXT: movl    $0, %ecx
-TEXT-NEXT: callq   18
-TEXT-NEXT: callq   29
+TEXT-NEXT: callq   0x140001040
+TEXT-NEXT: callq   0x140001050
 TEXT:      jmpq    *4098(%rip)
 TEXT:      jmpq    *4090(%rip)
 TEXT:      jmpq    *4082(%rip)

diff  --git a/lld/test/COFF/lto-comdat.ll b/lld/test/COFF/lto-comdat.ll
index 68a82c6d584a..517dbd66314a 100644
--- a/lld/test/COFF/lto-comdat.ll
+++ b/lld/test/COFF/lto-comdat.ll
@@ -52,9 +52,9 @@
 ; TEXT-01-EMPTY:
 ; TEXT-01-NEXT: <.text>:
 ; TEXT-01-NEXT: subq	$40, %rsp
-; TEXT-01-NEXT: callq	23
-; TEXT-01-NEXT: callq	18
-; TEXT-01-NEXT: callq	13
+; TEXT-01-NEXT: callq	0x140001020
+; TEXT-01-NEXT: callq	0x140001020
+; TEXT-01-NEXT: callq	0x140001020
 ; TEXT-01-NEXT: xorl	%eax, %eax
 ; TEXT-01-NEXT: addq	$40, %rsp
 ; TEXT-01: retq
@@ -70,20 +70,20 @@
 ; TEXT-10-EMPTY:
 ; TEXT-10-NEXT: <.text>:
 ; TEXT-10-NEXT: subq	$40, %rsp
-; TEXT-10-NEXT: callq	55
+; TEXT-10-NEXT: callq	0x140001040
 ; TEXT-10-NEXT: nop
 ; TEXT-10-NEXT: addq	$40, %rsp
 ; TEXT-10-NEXT: retq
 ; TEXT-10-NEXT: int3
 ; TEXT-10-NEXT: subq	$40, %rsp
-; TEXT-10-NEXT: callq	39
+; TEXT-10-NEXT: callq	0x140001040
 ; TEXT-10-NEXT: nop
 ; TEXT-10-NEXT: addq	$40, %rsp
 ; TEXT-10-NEXT: retq
 ; TEXT-10-NEXT: int3
 ; TEXT-10-NEXT: subq	$40, %rsp
-; TEXT-10-NEXT: callq	-41
-; TEXT-10-NEXT: callq	-30
+; TEXT-10-NEXT: callq	0x140001000
+; TEXT-10-NEXT: callq	0x140001010
 ; TEXT-10-NEXT: xorl	%eax, %eax
 ; TEXT-10-NEXT: addq	$40, %rsp
 ; TEXT-10-NEXT: retq

diff  --git a/lld/test/COFF/lto.ll b/lld/test/COFF/lto.ll
index f00d25dda68a..d8ccf566939e 100644
--- a/lld/test/COFF/lto.ll
+++ b/lld/test/COFF/lto.ll
@@ -59,7 +59,7 @@
 ; TEXT-01-EMPTY:
 ; TEXT-01-NEXT: <.text>:
 ; TEXT-01-NEXT: subq	$40, %rsp
-; TEXT-01-NEXT: callq	23
+; TEXT-01-NEXT: callq	0x140001020
 ; TEXT-01-NEXT: xorl	%eax, %eax
 ; TEXT-01-NEXT: addq	$40, %rsp
 ; TEXT-01-NEXT: retq
@@ -118,7 +118,7 @@
 ; TEXT-10-NEXT: int3
 ; TEXT-10-NEXT: int3
 ; TEXT-10-NEXT: subq	$40, %rsp
-; TEXT-10-NEXT: callq	-41
+; TEXT-10-NEXT: callq	0x140001000
 ; TEXT-10-NEXT: xorl	%eax, %eax
 ; TEXT-10-NEXT: addq	$40, %rsp
 ; TEXT-10-NEXT: retq

diff  --git a/lld/test/ELF/comdat.s b/lld/test/ELF/comdat.s
index bf754fbbfaf0..689b8ca9d50a 100644
--- a/lld/test/ELF/comdat.s
+++ b/lld/test/ELF/comdat.s
@@ -31,7 +31,7 @@ foo:
 // CHECK-EMPTY:
 // CHECK-NEXT: <bar>:
 // 0x1234 - 0x1235 - 5 = -6
-// CHECK-NEXT:   1235:	{{.*}}  callq  -6
+// CHECK-NEXT:   1235:	{{.*}}  callq  0x1234
 
         .section .text3,"axG", at progbits,zed,comdat,unique,0
 

diff  --git a/lld/test/ELF/gnu-ifunc-i386.s b/lld/test/ELF/gnu-ifunc-i386.s
index 8023872da161..60c16f54e4f1 100644
--- a/lld/test/ELF/gnu-ifunc-i386.s
+++ b/lld/test/ELF/gnu-ifunc-i386.s
@@ -113,8 +113,8 @@
 // DISASM: <bar_resolver>:
 // DISASM-NEXT:   4010e5:       retl
 // DISASM:      <_start>:
-// DISASM-NEXT:   4010e6:       calll 21 <foo>
-// DISASM-NEXT:                 calll 32 <bar>
+// DISASM-NEXT:   4010e6:       calll 0x401100 <foo>
+// DISASM-NEXT:                 calll 0x401110 <bar>
 // DISASM-NEXT:                 movl $4194516, %edx
 // DISASM-NEXT:                 movl $4194532, %edx
 // DISASM-EMPTY:
@@ -123,11 +123,11 @@
 // DISASM-NEXT: <foo>:
 // DISASM-NEXT:   401100:       jmpl *4202784
 // DISASM-NEXT:                 pushl $0
-// DISASM-NEXT:                 jmp -4198672
+// DISASM-NEXT:                 jmp 0x0
 // DISASM:      <bar>:
 // DISASM-NEXT:   401110:       jmpl *4202788
 // DISASM-NEXT:                 pushl $8
-// DISASM-NEXT:                 jmp -4198688
+// DISASM-NEXT:                 jmp 0x0
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/gnu-ifunc-noplt-i386.s b/lld/test/ELF/gnu-ifunc-noplt-i386.s
index 0b08912996ff..324ef95fd891 100644
--- a/lld/test/ELF/gnu-ifunc-noplt-i386.s
+++ b/lld/test/ELF/gnu-ifunc-noplt-i386.s
@@ -27,10 +27,10 @@
 // DISASM-NEXT:   retl
 // DISASM-EMPTY:
 // DISASM-NEXT: 004011ee <_start>:
-// DISASM-NEXT:   calll	-0x4 <_start+0x1>
-// DISASM-NEXT:   calll	-0x4 <_start+0x6>
-// DISASM-NEXT:   calll	0x23 <bar2 at plt>
-// DISASM-NEXT:   calll	0x2e <zed2 at plt>
+// DISASM-NEXT:   calll	0x4011ef <_start+0x1>
+// DISASM-NEXT:   calll	0x4011f4 <_start+0x6>
+// DISASM-NEXT:   calll	0x401220 <bar2 at plt>
+// DISASM-NEXT:   calll	0x401230 <zed2 at plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .plt:
 // DISASM-EMPTY:
@@ -45,12 +45,12 @@
 // DISASM-NEXT: 00401220 <bar2 at plt>:
 // DISASM-NEXT:   jmpl	*0x4032d4
 // DISASM-NEXT:   pushl	$0x0
-// DISASM-NEXT:   jmp	-0x20 <.plt>
+// DISASM-NEXT:   jmp	0x401210 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: 00401230 <zed2 at plt>:
 // DISASM-NEXT:   jmpl	*0x4032d8
 // DISASM-NEXT:   pushl	$0x8
-// DISASM-NEXT:   jmp	-0x30 <.plt>
+// DISASM-NEXT:   jmp	0x401210 <.plt>
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/gnu-ifunc-noplt.s b/lld/test/ELF/gnu-ifunc-noplt.s
index db9edc20b991..1685e5fc443e 100644
--- a/lld/test/ELF/gnu-ifunc-noplt.s
+++ b/lld/test/ELF/gnu-ifunc-noplt.s
@@ -30,10 +30,10 @@
 // DISASM-NEXT:   201321:      	retq
 // DISASM-EMPTY:
 // DISASM-NEXT: 0000000000201322 <_start>:
-// DISASM-NEXT:   201322:      	callq	0 <_start+0x5>
-// DISASM-NEXT:   201327:      	callq	0 <_start+0xa>
-// DISASM-NEXT:   20132c:      	callq	31 <bar2 at plt>
-// DISASM-NEXT:   201331:      	callq	42 <zed2 at plt>
+// DISASM-NEXT:   201322:      	callq	0x201327 <_start+0x5>
+// DISASM-NEXT:   201327:      	callq	0x20132c <_start+0xa>
+// DISASM-NEXT:   20132c:      	callq	0x201350 <bar2 at plt>
+// DISASM-NEXT:   201331:      	callq	0x201360 <zed2 at plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .plt:
 // DISASM-EMPTY:
@@ -45,12 +45,12 @@
 // DISASM-NEXT: 0000000000201350 <bar2 at plt>:
 // DISASM-NEXT:   201350:      	jmpq	*8514(%rip)
 // DISASM-NEXT:   201356:      	pushq	$0
-// DISASM-NEXT:   20135b:      	jmp	-32 <.plt>
+// DISASM-NEXT:   20135b:      	jmp	0x201340 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: 0000000000201360 <zed2 at plt>:
 // DISASM-NEXT:   201360:      	jmpq	*8506(%rip)
 // DISASM-NEXT:   201366:      	pushq	$1
-// DISASM-NEXT:   20136b:      	jmp	-48 <.plt>
+// DISASM-NEXT:   20136b:      	jmp	0x201340 <.plt>
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/gnu-ifunc-plt-i386.s b/lld/test/ELF/gnu-ifunc-plt-i386.s
index 28b039f145fd..90a21a212eb7 100644
--- a/lld/test/ELF/gnu-ifunc-plt-i386.s
+++ b/lld/test/ELF/gnu-ifunc-plt-i386.s
@@ -37,10 +37,10 @@
 // DISASM:      <bar>:
 // DISASM-NEXT:    4011b5:       retl
 // DISASM:      <_start>:
-// DISASM-NEXT:    4011b6:       calll   69 <zed2+0x401200>
-// DISASM-NEXT:                  calll   80 <zed2+0x401210>
-// DISASM-NEXT:                  calll   27 <bar2 at plt>
-// DISASM-NEXT:                  calll   38 <zed2 at plt>
+// DISASM-NEXT:    4011b6:       calll   0x401200 <zed2+0x401200>
+// DISASM-NEXT:                  calll   0x401210 <zed2+0x401210>
+// DISASM-NEXT:                  calll   0x4011e0 <bar2 at plt>
+// DISASM-NEXT:                  calll   0x4011f0 <zed2 at plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .plt:
 // DISASM-EMPTY:
@@ -55,22 +55,22 @@
 // DISASM-NEXT:   <bar2 at plt>:
 // DISASM-NEXT:    4011e0:       jmpl    *4207268
 // DISASM-NEXT:                  pushl   $0
-// DISASM-NEXT:                  jmp     -32 <.plt>
+// DISASM-NEXT:                  jmp     0x4011d0 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   <zed2 at plt>:
 // DISASM-NEXT:    4011f0:       jmpl    *4207272
 // DISASM-NEXT:                  pushl   $8
-// DISASM-NEXT:                  jmp     -48 <.plt>
+// DISASM-NEXT:                  jmp     0x4011d0 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .iplt:
 // DISASM-EMPTY:
 // DISASM-NEXT: <.iplt>:
 // DISASM-NEXT:                  jmpl    *4207276
 // DISASM-NEXT:                  pushl   $0
-// DISASM-NEXT:                  jmp     -64 <.plt>
+// DISASM-NEXT:                  jmp     0x4011d0 <.plt>
 // DISASM-NEXT:                  jmpl    *4207280
 // DISASM-NEXT:                  pushl   $8
-// DISASM-NEXT:                  jmp     -80 <.plt>
+// DISASM-NEXT:                  jmp     0x4011d0 <.plt>
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/gnu-ifunc-plt.s b/lld/test/ELF/gnu-ifunc-plt.s
index d23a2b21b4d3..b8b1f39a18fb 100644
--- a/lld/test/ELF/gnu-ifunc-plt.s
+++ b/lld/test/ELF/gnu-ifunc-plt.s
@@ -41,8 +41,8 @@
 // DISASM:      <bar>:
 // DISASM-NEXT:   2012d9:       retq
 // DISASM:      <_start>:
-// DISASM-NEXT:   2012da:       callq   65
-// DISASM-NEXT:   2012df:       callq   76
+// DISASM-NEXT:   2012da:       callq   0x201320
+// DISASM-NEXT:   2012df:       callq   0x201330
 // DISASM-NEXT:                 callq   {{.*}} <bar2 at plt>
 // DISASM-NEXT:                 callq   {{.*}} <zed2 at plt>
 // DISASM-EMPTY:
@@ -56,22 +56,22 @@
 // DISASM-NEXT:   <bar2 at plt>:
 // DISASM-NEXT:   201300:       jmpq    *8514(%rip)
 // DISASM-NEXT:   201306:       pushq   $0
-// DISASM-NEXT:   20130b:       jmp     -32 <.plt>
+// DISASM-NEXT:   20130b:       jmp     0x2012f0 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   <zed2 at plt>:
 // DISASM-NEXT:   201310:       jmpq    *8506(%rip)
 // DISASM-NEXT:   201316:       pushq   $1
-// DISASM-NEXT:   20131b:       jmp     -48 <.plt>
+// DISASM-NEXT:   20131b:       jmp     0x2012f0 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: Disassembly of section .iplt:
 // DISASM-EMPTY:
 // DISASM-NEXT: <.iplt>:
 // DISASM-NEXT:   201320:       jmpq    *8498(%rip)
 // DISASM-NEXT:   201326:       pushq   $0
-// DISASM-NEXT:   20132b:       jmp     -64 <.plt>
+// DISASM-NEXT:   20132b:       jmp     0x2012f0 <.plt>
 // DISASM-NEXT:   201330:       jmpq    *8490(%rip)
 // DISASM-NEXT:   201336:       pushq   $1
-// DISASM-NEXT:   20133b:       jmp     -80 <.plt>
+// DISASM-NEXT:   20133b:       jmp     0x2012f0 <.plt>
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/gnu-ifunc-shared.s b/lld/test/ELF/gnu-ifunc-shared.s
index 9a2e8beb9f6b..c88b7b11b7fa 100644
--- a/lld/test/ELF/gnu-ifunc-shared.s
+++ b/lld/test/ELF/gnu-ifunc-shared.s
@@ -16,9 +16,9 @@
 // DISASM:     <fct2>:
 // DISASM-NEXT:     1309:       retq
 // DISASM:     <f1>:
-// DISASM-NEXT:     130a:       callq   65
-// DISASM-NEXT:     130f:       callq   28
-// DISASM-NEXT:     1314:       callq   39
+// DISASM-NEXT:     130a:       callq   0x1350
+// DISASM-NEXT:     130f:       callq   0x1330
+// DISASM-NEXT:     1314:       callq   0x1340
 // DISASM-NEXT:     1319:       retq
 // DISASM:     <f2>:
 // DISASM-NEXT:     131a:       retq
@@ -33,18 +33,18 @@
 // DISASM-NEXT:   <fct2 at plt>:
 // DISASM-NEXT:     1330:       jmpq    *8482(%rip)
 // DISASM-NEXT:     1336:       pushq   $0
-// DISASM-NEXT:     133b:       jmp     -32 <.plt>
+// DISASM-NEXT:     133b:       jmp     0x1320 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   <f2 at plt>:
 // DISASM-NEXT:     1340:       jmpq    *8474(%rip)
 // DISASM-NEXT:     1346:       pushq   $1
-// DISASM-NEXT:     134b:       jmp     -48 <.plt>
+// DISASM-NEXT:     134b:       jmp     0x1320 <.plt>
 // DISASM:      Disassembly of section .iplt:
 // DISASM-EMPTY:
 // DISASM:      <.iplt>:
 // DISASM-NEXT:     1350:       jmpq    *8466(%rip)
 // DISASM-NEXT:     1356:       pushq   $0
-// DISASM-NEXT:     135b:       jmp     -64 <.plt>
+// DISASM-NEXT:     135b:       jmp     0x1320 <.plt>
 
 // CHECK: Relocations [
 // CHECK-NEXT:   Section (5) .rela.dyn {

diff  --git a/lld/test/ELF/gnu-ifunc.s b/lld/test/ELF/gnu-ifunc.s
index 60955336d1d2..c43bef28b2e2 100644
--- a/lld/test/ELF/gnu-ifunc.s
+++ b/lld/test/ELF/gnu-ifunc.s
@@ -96,8 +96,8 @@
 // DISASM:      <bar>:
 // DISASM-NEXT:  201189: {{.*}} retq
 // DISASM:      <_start>:
-// DISASM-NEXT:  20118a: {{.*}} callq 33
-// DISASM-NEXT:  20118f: {{.*}} callq 44
+// DISASM-NEXT:  20118a: {{.*}} callq 0x2011b0
+// DISASM-NEXT:  20118f: {{.*}} callq 0x2011c0
 // DISASM-NEXT:  201194: {{.*}} movl $2097496, %edx
 // DISASM-NEXT:  201199: {{.*}} movl $2097544, %edx
 // DISASM-NEXT:  20119e: {{.*}} movl $2097545, %edx
@@ -107,10 +107,10 @@
 // DISASM-NEXT: <.iplt>:
 // DISASM-NEXT:  2011b0: {{.*}} jmpq *4122(%rip)
 // DISASM-NEXT:  2011b6: {{.*}} pushq $0
-// DISASM-NEXT:  2011bb: {{.*}} jmp -2101696
+// DISASM-NEXT:  2011bb: {{.*}} jmp 0x0
 // DISASM-NEXT:  2011c0: {{.*}} jmpq *4114(%rip)
 // DISASM-NEXT:  2011c6: {{.*}} pushq $1
-// DISASM-NEXT:  2011cb: {{.*}} jmp -2101712
+// DISASM-NEXT:  2011cb: {{.*}} jmp 0x0
 
 .text
 .type foo STT_GNU_IFUNC

diff  --git a/lld/test/ELF/i386-feature-cet.s b/lld/test/ELF/i386-feature-cet.s
index b4073a40232e..25a44ee6e52d 100644
--- a/lld/test/ELF/i386-feature-cet.s
+++ b/lld/test/ELF/i386-feature-cet.s
@@ -41,8 +41,8 @@
 
 # DISASM:      Disassembly of section .text:
 # DISASM:      00401200 <func1>:
-# DISASM-NEXT: 401200:       calll   0x2b <func2+0x401230>
-# DISASM-NEXT: 401205:       calll   0x36 <ifunc>
+# DISASM-NEXT: 401200:       calll   0x401230 <func2+0x401230>
+# DISASM-NEXT: 401205:       calll   0x401240 <ifunc>
 # DISASM-NEXT:               retl
 
 # DISASM:      Disassembly of section .plt:
@@ -55,7 +55,7 @@
 # DISASM-NEXT:               nop
 # DISASM-NEXT:               endbr32
 # DISASM-NEXT:               pushl   $0x0
-# DISASM-NEXT:               jmp     -0x1e <.plt>
+# DISASM-NEXT:               jmp     0x401210 <.plt>
 # DISASM-NEXT:               nop
 
 # DISASM:      Disassembly of section .plt.sec:

diff  --git a/lld/test/ELF/i386-plt.s b/lld/test/ELF/i386-plt.s
index c8f66c69a730..bad417851f53 100644
--- a/lld/test/ELF/i386-plt.s
+++ b/lld/test/ELF/i386-plt.s
@@ -52,10 +52,10 @@
 // DISASM-NEXT:  4011bc:
 // DISASM-NEXT:  4011be:
 // DISASM:       <_start>:
-// DISASM-NEXT: 4011c0:       jmp 0x2b <bar at plt>
-// DISASM-NEXT: 4011c5:       jmp 0x26 <bar at plt>
-// DISASM-NEXT: 4011ca:       jmp 0x31 <zed at plt>
-// DISASM-NEXT: 4011cf:       jmp -0x18 <local>
+// DISASM-NEXT: 4011c0:       jmp 0x4011f0 <bar at plt>
+// DISASM-NEXT: 4011c5:       jmp 0x4011f0 <bar at plt>
+// DISASM-NEXT: 4011ca:       jmp 0x401200 <zed at plt>
+// DISASM-NEXT: 4011cf:       jmp 0x4011bc <local>
 
 // DISASM:      Disassembly of section .plt:
 // DISASM-EMPTY:
@@ -72,13 +72,13 @@
 /// .got.plt[3] = 0x403278 + 12 = 0x403284
 // DISASM-NEXT: 4011f0:       jmpl *0x403284
 // DISASM-NEXT:               pushl $0x0
-// DISASM-NEXT:               jmp -0x20 <.plt>
+// DISASM-NEXT:               jmp 0x4011e0 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT: <zed at plt>:
 /// .got.plt[4] = 0x403278 + 16 = 0x403288
 // DISASM-NEXT: 401200:       jmpl *0x403288
 // DISASM-NEXT:               pushl $0x8
-// DISASM-NEXT:               jmp -0x30 <.plt>
+// DISASM-NEXT:               jmp 0x4011e0 <.plt>
 
 // CHECKSHARED:        Name: .plt
 // CHECKSHARED-NEXT:   Type: SHT_PROGBITS
@@ -122,10 +122,10 @@
 // DISASMSHARED-NEXT: 11e0:
 // DISASMSHARED-NEXT: 11e2:
 // DISASMSHARED:      <_start>:
-// DISASMSHARED-NEXT: 11e4:       jmp 39 <bar at plt>
-// DISASMSHARED-NEXT:             jmp 34 <bar at plt>
-// DISASMSHARED-NEXT:             jmp 45 <zed at plt>
-// DISASMSHARED-NEXT:             jmp -24 <local>
+// DISASMSHARED-NEXT: 11e4:       jmp 0x1210 <bar at plt>
+// DISASMSHARED-NEXT:             jmp 0x1210 <bar at plt>
+// DISASMSHARED-NEXT:             jmp 0x1220 <zed at plt>
+// DISASMSHARED-NEXT:             jmp 0x11e0 <local>
 // DISASMSHARED-EMPTY:
 // DISASMSHARED-NEXT: Disassembly of section .plt:
 // DISASMSHARED-EMPTY:
@@ -139,11 +139,11 @@
 // DISASMSHARED:      <bar at plt>:
 // DISASMSHARED-NEXT: 1210:       jmpl *12(%ebx)
 // DISASMSHARED-NEXT:             pushl $0
-// DISASMSHARED-NEXT:             jmp -32 <.plt>
+// DISASMSHARED-NEXT:             jmp 0x1200 <.plt>
 // DISASMSHARED:      <zed at plt>:
 // DISASMSHARED-NEXT: 1220:       jmpl *16(%ebx)
 // DISASMSHARED-NEXT:             pushl $8
-// DISASMSHARED-NEXT:             jmp -48 <.plt>
+// DISASMSHARED-NEXT:             jmp 0x1200 <.plt>
 
 // DISASMPIE:      Disassembly of section .plt:
 // DISASMPIE-EMPTY:
@@ -158,12 +158,12 @@
 // DISASMPIE-NEXT: <bar at plt>:
 // DISASMPIE-NEXT: 11f0:       jmpl *12(%ebx)
 // DISASMPIE-NEXT:             pushl $0
-// DISASMPIE-NEXT:             jmp -32 <.plt>
+// DISASMPIE-NEXT:             jmp 0x11e0 <.plt>
 // DISASMPIE-EMPTY:
 // DISASMPIE-NEXT: <zed at plt>:
 // DISASMPIE-NEXT: 1200:       jmpl *16(%ebx)
 // DISASMPIE-NEXT:             pushl $8
-// DISASMPIE-NEXT:             jmp -48 <.plt>
+// DISASMPIE-NEXT:             jmp 0x11e0 <.plt>
 
 local:
 .long 0

diff  --git a/lld/test/ELF/i386-reloc-large-addend.s b/lld/test/ELF/i386-reloc-large-addend.s
index 7d4816dc0a6f..bcdc99115b7a 100644
--- a/lld/test/ELF/i386-reloc-large-addend.s
+++ b/lld/test/ELF/i386-reloc-large-addend.s
@@ -10,7 +10,7 @@
 // CHECK:        Disassembly of section .text:
 // CHECK-EMPTY:
 // CHECK-NEXT: <_start>:
-// CHECK-NEXT:     7000:       e9 fe 1f        jmp     8190
+// CHECK-NEXT:     7000:       e9 fe 1f        jmp     0x9001
 //                            0x1 + 0x9000 - 0x7003 == 8190
         .global _start
 _start:

diff  --git a/lld/test/ELF/i386-reloc-range.s b/lld/test/ELF/i386-reloc-range.s
index ffdae86f516a..0c15e6a9e055 100644
--- a/lld/test/ELF/i386-reloc-range.s
+++ b/lld/test/ELF/i386-reloc-range.s
@@ -12,7 +12,7 @@
 // CHECK:        Disassembly of section .text:
 // CHECK-EMPTY:
 // CHECK-NEXT: <_start>:
-// CHECK-NEXT:      200:       jmp -1
+// CHECK-NEXT:      200:       jmp 0x202
 //              0x10202 - 0x203 == 0xffff
 
 // RUN: not ld.lld -Ttext 0x200 %t.o %t2.o -o /dev/null 2>&1 | FileCheck --check-prefix=ERR %s

diff  --git a/lld/test/ELF/i386-retpoline-nopic-linkerscript.s b/lld/test/ELF/i386-retpoline-nopic-linkerscript.s
index e883a409670c..88e07c3c1544 100644
--- a/lld/test/ELF/i386-retpoline-nopic-linkerscript.s
+++ b/lld/test/ELF/i386-retpoline-nopic-linkerscript.s
@@ -18,10 +18,10 @@
 // CHECK-NEXT: 10:       pushl   236
 // CHECK-NEXT: 16:       pushl   %eax
 // CHECK-NEXT: 17:       movl    240, %eax
-// CHECK-NEXT: 1c:       calll   15 <.plt+0x20>
+// CHECK-NEXT: 1c:       calll   0x30 <.plt+0x20>
 // CHECK-NEXT: 21:       pause
 // CHECK-NEXT: 23:       lfence
-// CHECK-NEXT: 26:       jmp     -7 <.plt+0x11>
+// CHECK-NEXT: 26:       jmp     0x21 <.plt+0x11>
 // CHECK-NEXT: 28:       int3
 // CHECK-NEXT: 29:       int3
 // CHECK-NEXT: 2a:       int3
@@ -39,10 +39,10 @@
 // CHECK-NEXT: 3f:       int3
 // CHECK-NEXT: 40:       pushl   %eax
 // CHECK-NEXT: 41:       movl    244, %eax
-// CHECK-NEXT: 46:       calll   -27 <.plt+0x20>
-// CHECK-NEXT: 4b:       jmp     -47 <.plt+0x11>
+// CHECK-NEXT: 46:       calll   0x30 <.plt+0x20>
+// CHECK-NEXT: 4b:       jmp     0x21 <.plt+0x11>
 // CHECK-NEXT: 50:       pushl   $0
-// CHECK-NEXT: 55:       jmp     -74 <.plt>
+// CHECK-NEXT: 55:       jmp     0x10 <.plt>
 // CHECK-NEXT: 5a:       int3
 // CHECK-NEXT: 5b:       int3
 // CHECK-NEXT: 5c:       int3
@@ -51,10 +51,10 @@
 // CHECK-NEXT: 5f:       int3
 // CHECK-NEXT: 60:       pushl   %eax
 // CHECK-NEXT: 61:       movl    248, %eax
-// CHECK-NEXT: 66:       calll   -59 <.plt+0x20>
-// CHECK-NEXT: 6b:       jmp     -79 <.plt+0x11>
+// CHECK-NEXT: 66:       calll   0x30 <.plt+0x20>
+// CHECK-NEXT: 6b:       jmp     0x21 <.plt+0x11>
 // CHECK-NEXT: 70:       pushl   $8
-// CHECK-NEXT: 75:       jmp     -106 <.plt>
+// CHECK-NEXT: 75:       jmp     0x10 <.plt>
 // CHECK-NEXT: 7a:       int3
 // CHECK-NEXT: 7b:       int3
 // CHECK-NEXT: 7c:       int3

diff  --git a/lld/test/ELF/i386-retpoline-nopic.s b/lld/test/ELF/i386-retpoline-nopic.s
index e5eba67d3958..170e1a251c3c 100644
--- a/lld/test/ELF/i386-retpoline-nopic.s
+++ b/lld/test/ELF/i386-retpoline-nopic.s
@@ -16,10 +16,10 @@
 // CHECK-NEXT: 4011d0:       pushl   4207276
 // CHECK-NEXT: 4011d6:       pushl   %eax
 // CHECK-NEXT: 4011d7:       movl    4207280, %eax
-// CHECK-NEXT: 4011dc:       calll   15 <.plt+0x20>
+// CHECK-NEXT: 4011dc:       calll   0x4011f0 <.plt+0x20>
 // CHECK-NEXT: 4011e1:       pause
 // CHECK-NEXT: 4011e3:       lfence
-// CHECK-NEXT: 4011e6:       jmp     -7 <.plt+0x11>
+// CHECK-NEXT: 4011e6:       jmp     0x4011e1 <.plt+0x11>
 // CHECK-NEXT: 4011e8:       int3
 // CHECK-NEXT: 4011e9:       int3
 // CHECK-NEXT: 4011ea:       int3
@@ -37,10 +37,10 @@
 // CHECK-NEXT: 4011ff:       int3
 // CHECK-NEXT: 401200:       pushl   %eax
 // CHECK-NEXT: 401201:       movl    4207284, %eax
-// CHECK-NEXT: 401206:       calll   -27 <.plt+0x20>
-// CHECK-NEXT: 40120b:       jmp     -47 <.plt+0x11>
+// CHECK-NEXT: 401206:       calll   0x4011f0 <.plt+0x20>
+// CHECK-NEXT: 40120b:       jmp     0x4011e1 <.plt+0x11>
 // CHECK-NEXT: 401210:       pushl   $0
-// CHECK-NEXT: 401215:       jmp     -74 <.plt>
+// CHECK-NEXT: 401215:       jmp     0x4011d0 <.plt>
 // CHECK-NEXT: 40121a:       int3
 // CHECK-NEXT: 40121b:       int3
 // CHECK-NEXT: 40121c:       int3
@@ -49,10 +49,10 @@
 // CHECK-NEXT: 40121f:       int3
 // CHECK-NEXT: 401220:       pushl   %eax
 // CHECK-NEXT: 401221:       movl    4207288, %eax
-// CHECK-NEXT: 401226:       calll   -59 <.plt+0x20>
-// CHECK-NEXT: 40122b:       jmp     -79 <.plt+0x11>
+// CHECK-NEXT: 401226:       calll   0x4011f0 <.plt+0x20>
+// CHECK-NEXT: 40122b:       jmp     0x4011e1 <.plt+0x11>
 // CHECK-NEXT: 401230:       pushl   $8
-// CHECK-NEXT: 401235:       jmp     -106 <.plt>
+// CHECK-NEXT: 401235:       jmp     0x4011d0 <.plt>
 // CHECK-NEXT: 40123a:       int3
 // CHECK-NEXT: 40123b:       int3
 // CHECK-NEXT: 40123c:       int3

diff  --git a/lld/test/ELF/i386-retpoline-pic-linkerscript.s b/lld/test/ELF/i386-retpoline-pic-linkerscript.s
index 5db492bd733e..f14c47b52dd6 100644
--- a/lld/test/ELF/i386-retpoline-pic-linkerscript.s
+++ b/lld/test/ELF/i386-retpoline-pic-linkerscript.s
@@ -18,10 +18,10 @@
 // CHECK-NEXT: 10:       ff b3 04 00 00 00       pushl   4(%ebx)
 // CHECK-NEXT: 16:       50      pushl   %eax
 // CHECK-NEXT: 17:       8b 83 08 00 00 00 movl    8(%ebx), %eax
-// CHECK-NEXT: 1d:       e8 0e 00 00 00  calll   14 <.plt+0x20>
+// CHECK-NEXT: 1d:       e8 0e 00 00 00  calll   0x30 <.plt+0x20>
 // CHECK-NEXT: 22:       f3 90   pause
 // CHECK-NEXT: 24:       0f ae e8        lfence
-// CHECK-NEXT: 27:       eb f9   jmp     -7 <.plt+0x12>
+// CHECK-NEXT: 27:       eb f9   jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 29:       cc      int3
 // CHECK-NEXT: 2a:       cc      int3
 // CHECK-NEXT: 2b:       cc      int3
@@ -38,10 +38,10 @@
 // CHECK-NEXT: 3f:       cc      int3
 // CHECK-NEXT: 40:       50      pushl   %eax
 // CHECK-NEXT: 41:       8b 83 0c 00 00 00       movl    12(%ebx), %eax
-// CHECK-NEXT: 47:       e8 e4 ff ff ff  calll   -28 <.plt+0x20>
-// CHECK-NEXT: 4c:       e9 d1 ff ff ff  jmp     -47 <.plt+0x12>
+// CHECK-NEXT: 47:       e8 e4 ff ff ff  calll   0x30 <.plt+0x20>
+// CHECK-NEXT: 4c:       e9 d1 ff ff ff  jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 51:       68 00 00 00 00  pushl   $0
-// CHECK-NEXT: 56:       e9 b5 ff ff ff  jmp     -75 <.plt>
+// CHECK-NEXT: 56:       e9 b5 ff ff ff  jmp     0x10 <.plt>
 // CHECK-NEXT: 5b:       cc      int3
 // CHECK-NEXT: 5c:       cc      int3
 // CHECK-NEXT: 5d:       cc      int3
@@ -49,10 +49,10 @@
 // CHECK-NEXT: 5f:       cc      int3
 // CHECK-NEXT: 60:       50      pushl   %eax
 // CHECK-NEXT: 61:       8b 83 10 00 00 00       movl    16(%ebx), %eax
-// CHECK-NEXT: 67:       e8 c4 ff ff ff  calll   -60 <.plt+0x20>
-// CHECK-NEXT: 6c:       e9 b1 ff ff ff  jmp     -79 <.plt+0x12>
+// CHECK-NEXT: 67:       e8 c4 ff ff ff  calll   0x30 <.plt+0x20>
+// CHECK-NEXT: 6c:       e9 b1 ff ff ff  jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 71:       68 08 00 00 00  pushl   $8
-// CHECK-NEXT: 76:       e9 95 ff ff ff  jmp     -107 <.plt>
+// CHECK-NEXT: 76:       e9 95 ff ff ff  jmp     0x10 <.plt>
 // CHECK-NEXT: 7b:       cc      int3
 // CHECK-NEXT: 7c:       cc      int3
 // CHECK-NEXT: 7d:       cc      int3

diff  --git a/lld/test/ELF/i386-retpoline-pic.s b/lld/test/ELF/i386-retpoline-pic.s
index e5e24da6e3f6..b6a01243c175 100644
--- a/lld/test/ELF/i386-retpoline-pic.s
+++ b/lld/test/ELF/i386-retpoline-pic.s
@@ -16,10 +16,10 @@
 // CHECK-NEXT: 11d0:       pushl   4(%ebx)
 // CHECK-NEXT: 11d6:       pushl   %eax
 // CHECK-NEXT: 11d7:       movl    8(%ebx), %eax
-// CHECK-NEXT: 11dd:       calll   14 <.plt+0x20>
+// CHECK-NEXT: 11dd:       calll   0x11f0 <.plt+0x20>
 // CHECK-NEXT: 11e2:       pause
 // CHECK-NEXT: 11e4:       lfence
-// CHECK-NEXT: 11e7:       jmp     -7 <.plt+0x12>
+// CHECK-NEXT: 11e7:       jmp     0x11e2 <.plt+0x12>
 // CHECK-NEXT: 11e9:       int3
 // CHECK-NEXT: 11ea:       int3
 // CHECK-NEXT: 11eb:       int3
@@ -36,10 +36,10 @@
 // CHECK-NEXT: 11ff:       int3
 // CHECK-NEXT: 1200:       pushl   %eax
 // CHECK-NEXT: 1201:       movl    12(%ebx), %eax
-// CHECK-NEXT: 1207:       calll   -28 <.plt+0x20>
-// CHECK-NEXT: 120c:       jmp     -47 <.plt+0x12>
+// CHECK-NEXT: 1207:       calll   0x11f0 <.plt+0x20>
+// CHECK-NEXT: 120c:       jmp     0x11e2 <.plt+0x12>
 // CHECK-NEXT: 1211:       pushl   $0
-// CHECK-NEXT: 1216:       jmp     -75 <.plt>
+// CHECK-NEXT: 1216:       jmp     0x11d0 <.plt>
 // CHECK-NEXT: 121b:       int3
 // CHECK-NEXT: 121c:       int3
 // CHECK-NEXT: 121d:       int3
@@ -47,10 +47,10 @@
 // CHECK-NEXT: 121f:       int3
 // CHECK-NEXT: 1220:       pushl   %eax
 // CHECK-NEXT: 1221:       movl    16(%ebx), %eax
-// CHECK-NEXT: 1227:       calll   -60 <.plt+0x20>
-// CHECK-NEXT: 122c:       jmp     -79 <.plt+0x12>
+// CHECK-NEXT: 1227:       calll   0x11f0 <.plt+0x20>
+// CHECK-NEXT: 122c:       jmp     0x11e2 <.plt+0x12>
 // CHECK-NEXT: 1231:       pushl   $8
-// CHECK-NEXT: 1236:       jmp     -107 <.plt>
+// CHECK-NEXT: 1236:       jmp     0x11d0 <.plt>
 // CHECK-NEXT: 123b:       int3
 // CHECK-NEXT: 123c:       int3
 // CHECK-NEXT: 123d:       int3

diff  --git a/lld/test/ELF/i386-tls-dynamic.s b/lld/test/ELF/i386-tls-dynamic.s
index 7b5da4ad0b7c..34dc99dea431 100644
--- a/lld/test/ELF/i386-tls-dynamic.s
+++ b/lld/test/ELF/i386-tls-dynamic.s
@@ -82,16 +82,16 @@ addl tls1 at gotntpoff(%ebx),%eax
 ## -4128 and -4120 are first and second GOT entries offsets.
 ## Each one is a pair of records.
 # DIS-NEXT: 1260:       leal -4128(,%ebx), %eax
-# DIS-NEXT: 1267:       calll 100
+# DIS-NEXT: 1267:       calll 0x12d0
 # DIS-NEXT: 126c:       leal -4120(,%ebx), %eax
-# DIS-NEXT: 1273:       calll 88
+# DIS-NEXT: 1273:       calll 0x12d0
 ## Local dynamic model:
 ## -16 is a local module tls index offset.
 # DIS-NEXT: 1278:       leal -4112(%ebx), %eax
-# DIS-NEXT: 127e:       calll 77
+# DIS-NEXT: 127e:       calll 0x12d0
 # DIS-NEXT: 1283:       leal 8(%eax), %edx
 # DIS-NEXT: 1289:       leal -4112(%ebx), %eax
-# DIS-NEXT: 128f:       calll 60
+# DIS-NEXT: 128f:       calll 0x12d0
 # DIS-NEXT: 1294:       leal 12(%eax), %edx
 ## Initial exec model:
 # DIS-NEXT: 129a:       movl %gs:0, %eax

diff  --git a/lld/test/ELF/local-got-pie.s b/lld/test/ELF/local-got-pie.s
index cab43e42836a..41c33c2513b5 100644
--- a/lld/test/ELF/local-got-pie.s
+++ b/lld/test/ELF/local-got-pie.s
@@ -17,7 +17,7 @@ foo:
 // DISASM:      Disassembly of section .text:
 // DISASM-EMPTY:
 // DISASM-NEXT: <_start>:
-// DISASM-NEXT:   1210: {{.*}} callq 4275
+// DISASM-NEXT:   1210: {{.*}} callq 0x22c8
 // DISASM:      <foo>:
 // DISASM-NEXT:   1215: {{.*}} nop
 

diff  --git a/lld/test/ELF/local-got-shared.s b/lld/test/ELF/local-got-shared.s
index 554e2b126eac..083790562d55 100644
--- a/lld/test/ELF/local-got-shared.s
+++ b/lld/test/ELF/local-got-shared.s
@@ -14,7 +14,7 @@ foo:
 
 // 0x22E0 - 0x1228 - 5 = 4275
 // DISASM:      <bar>:
-// DISASM-NEXT:   1228:       callq 4275
+// DISASM-NEXT:   1228:       callq 0x22e0
 
 // DISASM:      <foo>:
 // DISASM-NEXT:   122d:       nop

diff  --git a/lld/test/ELF/local-got.s b/lld/test/ELF/local-got.s
index 17cb2da8a165..6ae94924761a 100644
--- a/lld/test/ELF/local-got.s
+++ b/lld/test/ELF/local-got.s
@@ -18,8 +18,8 @@ foo:
 // 0x202320 - 0x201250 - 5 =  4299
 // 0x202328 - 0x201255 - 5 =  4302
 // DISASM:      <_start>:
-// DISASM-NEXT:   201250:       callq 4299
-// DISASM-NEXT:   201255:       callq 4302
+// DISASM-NEXT:   201250:       callq 0x202320
+// DISASM-NEXT:   201255:       callq 0x202328
 
 // DISASM:      <foo>:
 // DISASM-NEXT:   20125a:       nop

diff  --git a/lld/test/ELF/lto/linker-script-symbols-ipo.ll b/lld/test/ELF/lto/linker-script-symbols-ipo.ll
index 179cc833ffec..967721db74d7 100644
--- a/lld/test/ELF/lto/linker-script-symbols-ipo.ll
+++ b/lld/test/ELF/lto/linker-script-symbols-ipo.ll
@@ -18,7 +18,7 @@
 ; NOIPO:      <foo>:
 ; NOIPO-NEXT:   movl $2, %eax
 ; NOIPO:      <_start>:
-; NOIPO-NEXT:   jmp -21 <foo>
+; NOIPO-NEXT:   jmp 0x201160 <foo>
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/lld/test/ELF/no-inhibit-exec.s b/lld/test/ELF/no-inhibit-exec.s
index 788a58f365a0..66031eaea912 100644
--- a/lld/test/ELF/no-inhibit-exec.s
+++ b/lld/test/ELF/no-inhibit-exec.s
@@ -8,7 +8,7 @@
 # CHECK: Disassembly of section .text:
 # CHECK-EMPTY:
 # CHECK-NEXT: _start
-# CHECK-NEXT: 201120: {{.*}} callq -2101541
+# CHECK-NEXT: 201120: {{.*}} callq 0x0
 
 # RELOC:      Relocations [
 # RELOC-NEXT: ]

diff  --git a/lld/test/ELF/pre_init_fini_array_missing.s b/lld/test/ELF/pre_init_fini_array_missing.s
index 5f7c02bfb81d..22cf5fe9e2be 100644
--- a/lld/test/ELF/pre_init_fini_array_missing.s
+++ b/lld/test/ELF/pre_init_fini_array_missing.s
@@ -22,21 +22,21 @@ _start:
 // CHECK: Disassembly of section .text:
 // CHECK-EMPTY:
 // CHECK-NEXT:  <_start>:
-// CHECK-NEXT:   201120:       callq    -5
-// CHECK-NEXT:                 callq    -10
-// CHECK-NEXT:                 callq    -15
-// CHECK-NEXT:                 callq    -20
-// CHECK-NEXT:                 callq    -25
-// CHECK-NEXT:                 callq    -30
+// CHECK-NEXT:   201120:       callq    0x201120
+// CHECK-NEXT:                 callq    0x201120
+// CHECK-NEXT:                 callq    0x201120
+// CHECK-NEXT:                 callq    0x201120
+// CHECK-NEXT:                 callq    0x201120
+// CHECK-NEXT:                 callq    0x201120
 
 // In position-independent binaries, they resolve to .text too.
 
 // PIE:      Disassembly of section .text:
 // PIE-EMPTY:
 // PIE-NEXT: <_start>:
-// PIE-NEXT:     1210:       callq   -5
-// PIE-NEXT:                 callq   -10
-// PIE-NEXT:                 callq   -15
-// PIE-NEXT:                 callq   -20
-// PIE-NEXT:                 callq   -25
-// PIE-NEXT:                 callq   -30
+// PIE-NEXT:     1210:       callq   0x1210
+// PIE-NEXT:                 callq   0x1210
+// PIE-NEXT:                 callq   0x1210
+// PIE-NEXT:                 callq   0x1210
+// PIE-NEXT:                 callq   0x1210
+// PIE-NEXT:                 callq   0x1210

diff  --git a/lld/test/ELF/relocation-i686.s b/lld/test/ELF/relocation-i686.s
index 3ae6f4dec64a..bbaaf1c3434a 100644
--- a/lld/test/ELF/relocation-i686.s
+++ b/lld/test/ELF/relocation-i686.s
@@ -33,7 +33,7 @@ R_386_PC32_2:
 // CHECK: Disassembly of section .R_386_PC32:
 // CHECK-EMPTY:
 // CHECK-NEXT: <R_386_PC32>:
-// CHECK-NEXT:   calll 4
+// CHECK-NEXT:   calll 0x4011ba
 
 // CHECK:      <R_386_PC32_2>:
 // CHECK-NEXT:   nop
@@ -77,7 +77,7 @@ R_386_GOTPC:
 // CHECK:      Disassembly of section .dynamic_reloc:
 // CHECK-EMPTY:
 // CHECK-NEXT: <.dynamic_reloc>:
-// CHECK-NEXT:   4011c5:       calll 38 <bar at plt>
+// CHECK-NEXT:   4011c5:       calll 0x4011f0 <bar at plt>
 
 .section .R_386_GOT32,"ax", at progbits
 .global R_386_GOT32

diff  --git a/lld/test/ELF/relocation.s b/lld/test/ELF/relocation.s
index 7a7eaef06abf..f2dcbac3db52 100644
--- a/lld/test/ELF/relocation.s
+++ b/lld/test/ELF/relocation.s
@@ -93,7 +93,7 @@ lulz:
 // CHECK: Disassembly of section .text:
 // CHECK-EMPTY:
 // CHECK-NEXT: <_start>:
-// CHECK-NEXT:   201310:  e8 04 00 00 00   callq 4
+// CHECK-NEXT:   201310:  e8 04 00 00 00   callq 0x201319
 // CHECK-NEXT:   201315:
 
 // CHECK:      <lulz>:
@@ -132,7 +132,7 @@ R_X86_64_PC32:
 // CHECK:      Disassembly of section .R_X86_64_PC32:
 // CHECK-EMPTY:
 // CHECK-NEXT: <R_X86_64_PC32>:
-// CHECK-NEXT:  201327:   {{.*}}  callq  36
+// CHECK-NEXT:  201327:   {{.*}}  callq  0x201350
 // CHECK-NEXT:  20132c:   {{.*}}  movl $2102096, %eax
 
 .section .R_X86_64_32S_2,"ax", at progbits

diff  --git a/lld/test/ELF/startstop.s b/lld/test/ELF/startstop.s
index 9eddd4cc91f4..86f203b84ff1 100644
--- a/lld/test/ELF/startstop.s
+++ b/lld/test/ELF/startstop.s
@@ -5,9 +5,9 @@
 // RUN: llvm-readobj --symbols -r %t.so | FileCheck -check-prefix=SYMBOL %s
 
 // DISASM: <_start>:
-// DISASM:    1330:       callq   10 <__start_foo>
-// DISASM:    1335:       callq   8 <__start_bar>
-// DISASM:    133a:       callq   3 <__start_bar>
+// DISASM:    1330:       callq   0x133f <__start_foo>
+// DISASM:    1335:       callq   0x1342 <__start_bar>
+// DISASM:    133a:       callq   0x1342 <__start_bar>
 // DISASM: Disassembly of section foo:
 // DISASM-EMPTY:
 // DISASM: <__start_foo>:

diff  --git a/lld/test/ELF/x86-64-feature-cet.s b/lld/test/ELF/x86-64-feature-cet.s
index 0361a291c4c8..7cd26696dc5a 100644
--- a/lld/test/ELF/x86-64-feature-cet.s
+++ b/lld/test/ELF/x86-64-feature-cet.s
@@ -42,8 +42,8 @@
 
 # DISASM:      Disassembly of section .text:
 # DISASM:      0000000000201330 <func1>:
-# DISASM-NEXT: 201330:       callq   0x2b <func2+0x201360>
-# DISASM-NEXT: 201335:       callq   0x36 <func2+0x201370>
+# DISASM-NEXT: 201330:       callq   0x201360 <func2+0x201360>
+# DISASM-NEXT: 201335:       callq   0x201370 <func2+0x201370>
 # DISASM-NEXT:               retq
 
 # DISASM:      Disassembly of section .plt:
@@ -53,7 +53,7 @@
 # DISASM-NEXT:               nopl    (%rax)
 # DISASM-NEXT:               endbr64
 # DISASM-NEXT:               pushq   $0x0
-# DISASM-NEXT:               jmp     -0x1e <.plt>
+# DISASM-NEXT:               jmp     0x201340 <.plt>
 # DISASM-NEXT:               nop
 
 # DISASM:      Disassembly of section .plt.sec:

diff  --git a/lld/test/ELF/x86-64-gotpc-relax.s b/lld/test/ELF/x86-64-gotpc-relax.s
index 0541bb66baa8..66aca36b2136 100644
--- a/lld/test/ELF/x86-64-gotpc-relax.s
+++ b/lld/test/ELF/x86-64-gotpc-relax.s
@@ -33,19 +33,19 @@
 # DISASM-NEXT: leaq -72(%rip), %rax
 # DISASM-NEXT: movq 4192(%rip), %rax
 # DISASM-NEXT: movq 4185(%rip), %rax
-# DISASM-NEXT: callq -93 <foo>
-# DISASM-NEXT: callq -99 <foo>
-# DISASM-NEXT: callq -104 <hid>
-# DISASM-NEXT: callq -110 <hid>
+# DISASM-NEXT: callq 0x201170 <foo>
+# DISASM-NEXT: callq 0x201170 <foo>
+# DISASM-NEXT: callq 0x201171 <hid>
+# DISASM-NEXT: callq 0x201171 <hid>
 # DISASM-NEXT: callq *4155(%rip)
 # DISASM-NEXT: callq *4149(%rip)
-# DISASM-NEXT: jmp   -128 <foo>
+# DISASM-NEXT: jmp   0x201170 <foo>
 # DISASM-NEXT: nop
-# DISASM-NEXT: jmp   -134 <foo>
+# DISASM-NEXT: jmp   0x201170 <foo>
 # DISASM-NEXT: nop
-# DISASM-NEXT: jmp   -139 <hid>
+# DISASM-NEXT: jmp   0x201171 <hid>
 # DISASM-NEXT: nop
-# DISASM-NEXT: jmp   -145 <hid>
+# DISASM-NEXT: jmp   0x201171 <hid>
 # DISASM-NEXT: nop
 # DISASM-NEXT: jmpq  *4119(%rip)
 # DISASM-NEXT: jmpq  *4113(%rip)

diff  --git a/lld/test/ELF/x86-64-plt.s b/lld/test/ELF/x86-64-plt.s
index 72cfb8c1f526..cd0567405b3e 100644
--- a/lld/test/ELF/x86-64-plt.s
+++ b/lld/test/ELF/x86-64-plt.s
@@ -70,17 +70,17 @@
 // DISASM-NEXT:   <bar at plt>:
 // DISASM-NEXT:   1330:       jmpq *8450(%rip)
 // DISASM-NEXT:               pushq $0
-// DISASM-NEXT:               jmp -32 <.plt>
+// DISASM-NEXT:               jmp 0x1320 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   <zed at plt>:
 // DISASM-NEXT:   1340:       jmpq *8442(%rip)
 // DISASM-NEXT:               pushq $1
-// DISASM-NEXT:               jmp -48 <.plt>
+// DISASM-NEXT:               jmp 0x1320 <.plt>
 // DISASM-EMPTY:
 // DISASM-NEXT:   <_start at plt>:
 // DISASM-NEXT:   1350:       jmpq *8434(%rip)
 // DISASM-NEXT:               pushq $2
-// DISASM-NEXT:               jmp -64 <.plt>
+// DISASM-NEXT:               jmp 0x1320 <.plt>
 
 // 0x201030 - (0x201000 + 1) - 4 = 43
 // 0x201030 - (0x201005 + 1) - 4 = 38
@@ -88,10 +88,10 @@
 // 0x201000 - (0x20100f + 1) - 4 = -20
 
 // DISASM2:      <_start>:
-// DISASM2-NEXT:   jmp  43 <bar at plt>
-// DISASM2-NEXT:   jmp  38 <bar at plt>
-// DISASM2-NEXT:   jmp  49 <zed at plt>
-// DISASM2-NEXT:   jmp  -20 <_start>
+// DISASM2-NEXT:   jmp  0x2012f0 <bar at plt>
+// DISASM2-NEXT:   jmp  0x2012f0 <bar at plt>
+// DISASM2-NEXT:   jmp  0x201300 <zed at plt>
+// DISASM2-NEXT:   jmp  0x2012c0 <_start>
 
 // 0x202018 - 0x201036  = 4066
 // 0x202020 - 0x201046  = 4058
@@ -106,12 +106,12 @@
 // DISASM2-NEXT: <bar at plt>:
 // DISASM2-NEXT:  2012f0:       jmpq *8450(%rip)
 // DISASM2-NEXT:                pushq $0
-// DISASM2-NEXT:                jmp -32 <.plt>
+// DISASM2-NEXT:                jmp 0x2012e0 <.plt>
 // DISASM2-EMPTY:
 // DISASM2-NEXT: <zed at plt>:
 // DISASM2-NEXT:  201300:       jmpq *8442(%rip)
 // DISASM2-NEXT:                pushq $1
-// DISASM2-NEXT:                jmp -48 <.plt>
+// DISASM2-NEXT:                jmp 0x2012e0 <.plt>
 // DISASM2-NOT:   {{.}}
 
 .global _start

diff  --git a/lld/test/ELF/x86-64-retpoline-linkerscript.s b/lld/test/ELF/x86-64-retpoline-linkerscript.s
index 5a14595b4844..295af0ab608b 100644
--- a/lld/test/ELF/x86-64-retpoline-linkerscript.s
+++ b/lld/test/ELF/x86-64-retpoline-linkerscript.s
@@ -17,10 +17,10 @@
 // CHECK-NEXT: <.plt>:
 // CHECK-NEXT: 10:       ff 35 32 01 00 00       pushq   306(%rip)
 // CHECK-NEXT: 16:       4c 8b 1d 33 01 00 00    movq    307(%rip), %r11
-// CHECK-NEXT: 1d:       e8 0e 00 00 00  callq   14 <.plt+0x20>
+// CHECK-NEXT: 1d:       e8 0e 00 00 00  callq   0x30 <.plt+0x20>
 // CHECK-NEXT: 22:       f3 90   pause
 // CHECK-NEXT: 24:       0f ae e8        lfence
-// CHECK-NEXT: 27:       eb f9   jmp     -7 <.plt+0x12>
+// CHECK-NEXT: 27:       eb f9   jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 29:       cc      int3
 // CHECK-NEXT: 2a:       cc      int3
 // CHECK-NEXT: 2b:       cc      int3
@@ -42,20 +42,20 @@
 // CHECK-NEXT: 3e:       cc      int3
 // CHECK-NEXT: 3f:       cc      int3
 // CHECK-NEXT: 40:       4c 8b 1d 11 01 00 00    movq    273(%rip), %r11
-// CHECK-NEXT: 47:       e8 e4 ff ff ff  callq   -28 <.plt+0x20>
-// CHECK-NEXT: 4c:       e9 d1 ff ff ff  jmp     -47 <.plt+0x12>
+// CHECK-NEXT: 47:       e8 e4 ff ff ff  callq   0x30 <.plt+0x20>
+// CHECK-NEXT: 4c:       e9 d1 ff ff ff  jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 51:       68 00 00 00 00  pushq   $0
-// CHECK-NEXT: 56:       e9 b5 ff ff ff  jmp     -75 <.plt>
+// CHECK-NEXT: 56:       e9 b5 ff ff ff  jmp     0x10 <.plt>
 // CHECK-NEXT: 5b:       cc      int3
 // CHECK-NEXT: 5c:       cc      int3
 // CHECK-NEXT: 5d:       cc      int3
 // CHECK-NEXT: 5e:       cc      int3
 // CHECK-NEXT: 5f:       cc      int3
 // CHECK-NEXT: 60:       4c 8b 1d f9 00 00 00    movq    249(%rip), %r11
-// CHECK-NEXT: 67:       e8 c4 ff ff ff  callq   -60 <.plt+0x20>
-// CHECK-NEXT: 6c:       e9 b1 ff ff ff  jmp     -79 <.plt+0x12>
+// CHECK-NEXT: 67:       e8 c4 ff ff ff  callq   0x30 <.plt+0x20>
+// CHECK-NEXT: 6c:       e9 b1 ff ff ff  jmp     0x22 <.plt+0x12>
 // CHECK-NEXT: 71:       68 01 00 00 00  pushq   $1
-// CHECK-NEXT: 76:       e9 95 ff ff ff  jmp     -107 <.plt>
+// CHECK-NEXT: 76:       e9 95 ff ff ff  jmp     0x10 <.plt>
 // CHECK-NEXT: 7b:       cc      int3
 // CHECK-NEXT: 7c:       cc      int3
 // CHECK-NEXT: 7d:       cc      int3

diff  --git a/lld/test/ELF/x86-64-retpoline-znow-linkerscript.s b/lld/test/ELF/x86-64-retpoline-znow-linkerscript.s
index 61e5d28cd680..f516489b0aa1 100644
--- a/lld/test/ELF/x86-64-retpoline-znow-linkerscript.s
+++ b/lld/test/ELF/x86-64-retpoline-znow-linkerscript.s
@@ -15,10 +15,10 @@
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: <.plt>:
-// CHECK-NEXT: 10:	e8 0b 00 00 00 	callq	11 <.plt+0x10>
+// CHECK-NEXT: 10:	e8 0b 00 00 00 	callq	0x20 <.plt+0x10>
 // CHECK-NEXT: 15:	f3 90 	pause
 // CHECK-NEXT: 17:	0f ae e8 	lfence
-// CHECK-NEXT: 1a:	eb f9 	jmp	-7 <.plt+0x5>
+// CHECK-NEXT: 1a:	eb f9 	jmp	0x15 <.plt+0x5>
 // CHECK-NEXT: 1c:	cc 	int3
 // CHECK-NEXT: 1d:	cc 	int3
 // CHECK-NEXT: 1e:	cc 	int3
@@ -37,13 +37,13 @@
 // CHECK-NEXT: 2e:	cc 	int3
 // CHECK-NEXT: 2f:	cc 	int3
 // CHECK-NEXT: 30:	4c 8b 1d 31 00 00 00 	movq	49(%rip), %r11
-// CHECK-NEXT: 37:	e9 d4 ff ff ff 	jmp	-44 <.plt>
+// CHECK-NEXT: 37:	e9 d4 ff ff ff 	jmp	0x10 <.plt>
 // CHECK-NEXT: 3c:	cc 	int3
 // CHECK-NEXT: 3d:	cc 	int3
 // CHECK-NEXT: 3e:	cc 	int3
 // CHECK-NEXT: 3f:	cc 	int3
 // CHECK-NEXT: 40:      4c 8b 1d 29 00 00 00 	movq	41(%rip), %r11
-// CHECK-NEXT: 47:	e9 c4 ff ff ff 	jmp	-60 <.plt>
+// CHECK-NEXT: 47:	e9 c4 ff ff ff 	jmp	0x10 <.plt>
 // CHECK-NEXT: 4c:	cc 	int3
 // CHECK-NEXT: 4d:	cc 	int3
 // CHECK-NEXT: 4e:	cc 	int3

diff  --git a/lld/test/ELF/x86-64-retpoline-znow-static-iplt.s b/lld/test/ELF/x86-64-retpoline-znow-static-iplt.s
index 01cc1ec4579b..eecd5a692a36 100644
--- a/lld/test/ELF/x86-64-retpoline-znow-static-iplt.s
+++ b/lld/test/ELF/x86-64-retpoline-znow-static-iplt.s
@@ -5,16 +5,16 @@
 
 #0x2011a9+5 + 34 = 0x2011d0 (foo at plt)
 # CHECK:      <_start>:
-# CHECK-NEXT:  2011a9:       callq   34
+# CHECK-NEXT:  2011a9:       callq   0x2011d0
 
 #Static IPLT header due to -z retpolineplt
 # CHECK:       00000000002011b0 <.plt>:
-# CHECK-NEXT:  2011b0:       callq   11 <.plt+0x10>
+# CHECK-NEXT:  2011b0:       callq   0x2011c0 <.plt+0x10>
 # CHECK-NEXT:  2011b5:       pause
 # CHECK-NEXT:  2011b7:       lfence
 #foo at plt
 # CHECK:       2011d0:       movq    4105(%rip), %r11
-# CHECK-NEXT:  2011d7:       jmp     -44 <.plt>
+# CHECK-NEXT:  2011d7:       jmp     0x2011b0 <.plt>
 
 .type foo STT_GNU_IFUNC
 .globl foo

diff  --git a/lld/test/ELF/x86-64-retpoline-znow.s b/lld/test/ELF/x86-64-retpoline-znow.s
index 20f13ab290ba..a8a62c18bb36 100644
--- a/lld/test/ELF/x86-64-retpoline-znow.s
+++ b/lld/test/ELF/x86-64-retpoline-znow.s
@@ -14,10 +14,10 @@
 // CHECK:      Disassembly of section .plt:
 // CHECK-EMPTY:
 // CHECK-NEXT: <.plt>:
-// CHECK-NEXT: 12d0:       callq   11 <.plt+0x10>
+// CHECK-NEXT: 12d0:       callq   0x12e0 <.plt+0x10>
 // CHECK-NEXT:             pause
 // CHECK-NEXT:             lfence
-// CHECK-NEXT:             jmp     -7 <.plt+0x5>
+// CHECK-NEXT:             jmp     0x12d5 <.plt+0x5>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
@@ -36,13 +36,13 @@
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT: 12f0:       movq    4369(%rip), %r11
-// CHECK-NEXT:             jmp     -44 <.plt>
+// CHECK-NEXT:             jmp     0x12d0 <.plt>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT: 1300:       movq    4361(%rip), %r11
-// CHECK-NEXT:             jmp     -60 <.plt>
+// CHECK-NEXT:             jmp     0x12d0 <.plt>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3

diff  --git a/lld/test/ELF/x86-64-retpoline.s b/lld/test/ELF/x86-64-retpoline.s
index 874e20423578..8ef218d49b26 100644
--- a/lld/test/ELF/x86-64-retpoline.s
+++ b/lld/test/ELF/x86-64-retpoline.s
@@ -16,10 +16,10 @@
 // CHECK-NEXT: <.plt>:
 // CHECK-NEXT: 1300:       pushq   8498(%rip)
 // CHECK-NEXT:             movq    8499(%rip), %r11
-// CHECK-NEXT:             callq   14 <.plt+0x20>
+// CHECK-NEXT:             callq   0x1320 <.plt+0x20>
 // CHECK-NEXT:             pause
 // CHECK-NEXT:             lfence
-// CHECK-NEXT:             jmp     -7 <.plt+0x12>
+// CHECK-NEXT:             jmp     0x1312 <.plt+0x12>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
@@ -41,20 +41,20 @@
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT: 1330:       movq    8465(%rip), %r11
-// CHECK-NEXT:             callq   -28 <.plt+0x20>
-// CHECK-NEXT:             jmp     -47 <.plt+0x12>
+// CHECK-NEXT:             callq   0x1320 <.plt+0x20>
+// CHECK-NEXT:             jmp     0x1312 <.plt+0x12>
 // CHECK-NEXT:             pushq   $0
-// CHECK-NEXT:             jmp     -75 <.plt>
+// CHECK-NEXT:             jmp     0x1300 <.plt>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT: 1350:       movq    8441(%rip), %r11
-// CHECK-NEXT:             callq   -60 <.plt+0x20>
-// CHECK-NEXT:             jmp     -79 <.plt+0x12>
+// CHECK-NEXT:             callq   0x1320 <.plt+0x20>
+// CHECK-NEXT:             jmp     0x1312 <.plt+0x12>
 // CHECK-NEXT:             pushq   $1
-// CHECK-NEXT:             jmp     -107 <.plt>
+// CHECK-NEXT:             jmp     0x1300 <.plt>
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3
 // CHECK-NEXT:             int3

diff  --git a/llvm/include/llvm/MC/MCInstPrinter.h b/llvm/include/llvm/MC/MCInstPrinter.h
index d466749b1209..71e049b92455 100644
--- a/llvm/include/llvm/MC/MCInstPrinter.h
+++ b/llvm/include/llvm/MC/MCInstPrinter.h
@@ -84,6 +84,12 @@ class MCInstPrinter {
   void setCommentStream(raw_ostream &OS) { CommentStream = &OS; }
 
   /// Print the specified MCInst to the specified raw_ostream.
+  ///
+  /// \p Address the address of current instruction on most targets, used to
+  /// print a PC relative immediate as the target address. On targets where a PC
+  /// relative immediate is relative to the next instruction and the length of a
+  /// MCInst is 
diff icult to measure (e.g. x86), this is the address of the next
+  /// instruction. If Address is 0, the immediate will be printed.
   virtual void printInst(const MCInst *MI, uint64_t Address, StringRef Annot,
                          const MCSubtargetInfo &STI, raw_ostream &OS) = 0;
 

diff  --git a/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
index 6f27808b2bb5..33d70fdb1214 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86InstPrinterCommon.cpp
@@ -13,6 +13,7 @@
 
 #include "X86InstPrinterCommon.h"
 #include "X86BaseInfo.h"
+#include "llvm/MC/MCAsmInfo.h"
 #include "llvm/MC/MCExpr.h"
 #include "llvm/MC/MCInst.h"
 #include "llvm/MC/MCInstrDesc.h"
@@ -287,16 +288,23 @@ void X86InstPrinterCommon::printRoundingControl(const MCInst *MI, unsigned Op,
   }
 }
 
-/// printPCRelImm - This is used to print an immediate value that ends up
-/// being encoded as a pc-relative value (e.g. for jumps and calls).  In
-/// Intel-style these print slightly 
diff erently than normal immediates.
-/// for example, a $ is not emitted.
+/// value (e.g. for jumps and calls). In Intel-style these print slightly
+/// 
diff erently than normal immediates. For example, a $ is not emitted.
+///
+/// \p Address The address of the next instruction.
+/// \see MCInstPrinter::printInst
 void X86InstPrinterCommon::printPCRelImm(const MCInst *MI, uint64_t Address,
                                          unsigned OpNo, raw_ostream &O) {
   const MCOperand &Op = MI->getOperand(OpNo);
-  if (Op.isImm())
-    O << formatImm(Op.getImm());
-  else {
+  if (Op.isImm()) {
+    if (PrintBranchImmAsAddress) {
+      uint64_t Target = Address + Op.getImm();
+      if (MAI.getCodePointerSize() == 4)
+        Target &= 0xffffffff;
+      O << formatHex(Target);
+    } else
+      O << formatImm(Op.getImm());
+  } else {
     assert(Op.isExpr() && "unknown pcrel immediate operand");
     // If a symbolic branch target was added as a constant expression then print
     // that address in hex.

diff  --git a/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll b/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll
index a8a392541b49..938eabfc7d99 100644
--- a/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll
+++ b/llvm/test/CodeGen/X86/callbr-asm-obj-file.ll
@@ -3,7 +3,7 @@
 ; RUN:  | FileCheck %s
 
 ; CHECK: 0000000000000000 <test1>:
-; CHECK-NEXT:   0: 74 00 je 0 <test1+0x2>
+; CHECK-NEXT:   0: 74 00 je 0x2 <test1+0x2>
 ; CHECK-NEXT:   2: c3    retq
 
 define void @test1() {

diff  --git a/llvm/test/LTO/Resolution/X86/not-prevailing.ll b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
index 7a7ca0ee784e..174d3401a61d 100644
--- a/llvm/test/LTO/Resolution/X86/not-prevailing.ll
+++ b/llvm/test/LTO/Resolution/X86/not-prevailing.ll
@@ -6,9 +6,9 @@
 ; Check that 'foo' and 'bar' were not inlined.
 ; CHECK:      <zed>:
 ; CHECK-NEXT:  {{.*}}  pushq   %rbx
-; CHECK-NEXT:  {{.*}}  callq   0 <zed+0x6>
+; CHECK-NEXT:  {{.*}}  callq   0x6 <zed+0x6>
 ; CHECK-NEXT:  {{.*}}  movl    %eax, %ebx
-; CHECK-NEXT:  {{.*}}  callq   0 <zed+0xd>
+; CHECK-NEXT:  {{.*}}  callq   0xd <zed+0xd>
 ; CHECK-NEXT:  {{.*}}  movl    %ebx, %eax
 ; CHECK-NEXT:  {{.*}}  popq    %rbx
 ; CHECK-NEXT:  {{.*}}  retq

diff  --git a/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
index 1d2e96e73eaf..8258954535d4 100644
--- a/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
+++ b/llvm/test/MC/COFF/cv-inline-linetable-unlikely.s
@@ -26,13 +26,13 @@
 # ASM-NEXT:        4: c7 05 fc ff ff ff 00 00 00 00 movl    $0, -4(%rip)
 #  Begin inline loc (matches cv_loc below)
 # ASM-NEXT:        e: 83 3d ff ff ff ff 00          cmpl    $0, -1(%rip)
-# ASM-NEXT:       15: 75 0f                         jne     15 <g+0x26>
+# ASM-NEXT:       15: 75 0f                         jne     0x26 <g+0x26>
 #  End inline loc
 # ASM-NEXT:       17: c7 05 fc ff ff ff 00 00 00 00 movl    $0, -4(%rip)
 # ASM-NEXT:       21: 48 83 c4 28                   addq    $40, %rsp
 # ASM-NEXT:       25: c3                            retq
 #  Begin inline loc (matches cv_loc below)
-# ASM-NEXT:       26: e8 00 00 00 00                callq   0 <g+0x2b>
+# ASM-NEXT:       26: e8 00 00 00 00                callq   0x2b <g+0x2b>
 # ASM-NEXT:       2b: 0f 0b                         ud2
 #  End inline loc
 

diff  --git a/llvm/test/MC/COFF/cv-loc-unreachable-2.s b/llvm/test/MC/COFF/cv-loc-unreachable-2.s
index b23ddb97282e..2906622ddd7d 100644
--- a/llvm/test/MC/COFF/cv-loc-unreachable-2.s
+++ b/llvm/test/MC/COFF/cv-loc-unreachable-2.s
@@ -8,9 +8,9 @@
 
 # ASM:      00000000 <_callit>:
 #   begin inline {
-# ASM-NEXT:        0: e8 00 00 00 00                calll   0 <_callit+0x5>
+# ASM-NEXT:        0: e8 00 00 00 00                calll   0x5 <_callit+0x5>
 # ASM-NEXT:        5: 85 c0                         testl   %eax, %eax
-# ASM-NEXT:        7: 75 01                         jne     1 <_callit+0xa>
+# ASM-NEXT:        7: 75 01                         jne     0xa <_callit+0xa>
 #   } end inline
 # ASM-NEXT:        9: c3                            retl
 #   begin inline {

diff  --git a/llvm/test/MC/COFF/cv-loc-unreachable.s b/llvm/test/MC/COFF/cv-loc-unreachable.s
index 8c7f15d1079f..333fb4523f5b 100644
--- a/llvm/test/MC/COFF/cv-loc-unreachable.s
+++ b/llvm/test/MC/COFF/cv-loc-unreachable.s
@@ -19,9 +19,9 @@
 
 # ASM:      00000000 <_callit>:
 #   begin inline {
-# ASM-NEXT:        0: e8 00 00 00 00                calll   0 <_callit+0x5>
+# ASM-NEXT:        0: e8 00 00 00 00                calll   0x5 <_callit+0x5>
 # ASM-NEXT:        5: 85 c0                         testl   %eax, %eax
-# ASM-NEXT:        7: 75 01                         jne     1 <_callit+0xa>
+# ASM-NEXT:        7: 75 01                         jne     0xa <_callit+0xa>
 #   } end inline
 # ASM-NEXT:        9: c3                            retl
 #   begin inline {

diff  --git a/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s b/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s
index 3c86caa00cce..6962a2a65960 100644
--- a/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s
+++ b/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s
@@ -16,8 +16,8 @@ foo:
 # CHECK-RELAX:      1a: nop
 # CHECK-RELAX:      20: nopw %cs:(%eax,%eax)
 # CHECK-RELAX:      2a: nopw %cs:(%eax,%eax)
-# CHECK-OPT:        1b: calll -4
-# CHECK-RELAX:      3b: calll -4
+# CHECK-OPT:        1b: calll 0x1c
+# CHECK-RELAX:      3b: calll 0x3c
         calll   bar # 5 bytes
         .bundle_unlock
         ret         # 1 byte

diff  --git a/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s b/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s
index f15a2b34d184..bb2efa8d1646 100644
--- a/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s
+++ b/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s
@@ -30,8 +30,8 @@ foo:
   jle     .L_ELSE
 # Due to the padding that's inserted before the addl, the jump target
 # becomes farther by one byte.
-# CHECK-OPT:     jle 5
-# CHECK-RELAX:   jle 7
+# CHECK-OPT:     jle 0x24
+# CHECK-RELAX:   jle 0x2d
 
   addl    %ebp, %eax
 # CHECK-OPT:     nop

diff  --git a/llvm/test/MC/X86/align-via-padding.s b/llvm/test/MC/X86/align-via-padding.s
index 572af4b02961..d5d86da6ddca 100644
--- a/llvm/test/MC/X86/align-via-padding.s
+++ b/llvm/test/MC/X86/align-via-padding.s
@@ -35,12 +35,12 @@ foo:
   # fewer nops by relaxing the branch, even though we don't need to
   # CHECK: <loop_preheader>:
   # CHECK: 45: 48 85 c0                       testq %rax, %rax
-  # CHECK: 48: 2e 2e 2e 2e 0f 8e 1e 00 00 00  jle 30 <loop_exit>
+  # CHECK: 48: 2e 2e 2e 2e 0f 8e 1e 00 00 00  jle 0x70 <loop_exit>
   # CHECK: 52: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00    	nopw	%cs:(%rax,%rax)
   # CHECK: <loop_header>:
   # CHECK: 60: 48 83 e8 01                    subq $1, %rax
   # CHECK: 64: 48 85 c0                       testq %rax, %rax
-  # CHECK: 67: 7e 07                          jle 7 <loop_exit>
+  # CHECK: 67: 7e 07                          jle 0x70 <loop_exit>
   # CHECK: 69: 2e 2e e9 f0 ff ff ff           jmp
   # CHECK: <loop_exit>:
   # CHECK: 70: c3                             retq
@@ -62,7 +62,7 @@ loop_exit:
   # Correctness cornercase - can't prefix pad jmp without having relaxed it
   # first as doing so would make the relative offset too large
   # CHECK: fd: cc                             int3
-  # CHECK: fe: eb 80                          jmp -128 <loop_exit+0x10>
+  # CHECK: fe: eb 80                          jmp 0x80 <loop_exit+0x10>
   # CHECK: 100: cc                           	int3
 .p2align 5
 .L1:

diff  --git a/llvm/test/MC/X86/align-via-relaxation.s b/llvm/test/MC/X86/align-via-relaxation.s
index 7f372bba0f20..d768232655b7 100644
--- a/llvm/test/MC/X86/align-via-relaxation.s
+++ b/llvm/test/MC/X86/align-via-relaxation.s
@@ -9,13 +9,13 @@
   # Demonstrate that we can relax instructions to provide padding, not
   # just insert nops.  jmps are being used for ease of demonstration.
   # CHECK: .text
-  # CHECK: 0: eb 1f                         jmp 31 <foo>
-  # CHECK: 2: e9 1a 00 00 00                jmp 26 <foo>
-  # CHECK: 7: e9 15 00 00 00                jmp 21 <foo>
-  # CHECK: c: e9 10 00 00 00                jmp 16 <foo>
-  # CHECK: 11: e9 0b 00 00 00               jmp 11 <foo>
-  # CHECK: 16: e9 06 00 00 00               jmp 6 <foo>
-  # CHECK: 1b: e9 01 00 00 00               jmp 1 <foo>
+  # CHECK: 0: eb 1f                         jmp 0x21 <foo>
+  # CHECK: 2: e9 1a 00 00 00                jmp 0x21 <foo>
+  # CHECK: 7: e9 15 00 00 00                jmp 0x21 <foo>
+  # CHECK: c: e9 10 00 00 00                jmp 0x21 <foo>
+  # CHECK: 11: e9 0b 00 00 00               jmp 0x21 <foo>
+  # CHECK: 16: e9 06 00 00 00               jmp 0x21 <foo>
+  # CHECK: 1b: e9 01 00 00 00               jmp 0x21 <foo>
   # CHECK: 20: cc                           int3
   .p2align 4
   jmp foo
@@ -33,7 +33,7 @@ foo:
   # Check that we're not shifting aroudn the offsets of labels - doing
   # that would require a further round of relaxation
   # CHECK: <bar>:
-  # CHECK: 22: eb fe                          jmp -2 <bar>
+  # CHECK: 22: eb fe                          jmp 0x22 <bar>
   # CHECK: 24: 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
   # CHECK: 30: 0f 0b                          ud2
 
@@ -48,14 +48,14 @@ nobypass:
   # fewer nops by relaxing the branch, even though we don't need to
   # CHECK: <loop_preheader>:
   # CHECK: 45: 48 85 c0                       testq %rax, %rax
-  # CHECK: 48: 0f 8e 22 00 00 00              jle 34 <loop_exit>
+  # CHECK: 48: 0f 8e 22 00 00 00              jle 0x70 <loop_exit>
   # CHECK: 4e: 66 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax)
   # CHECK: 5d: 0f 1f 00                       nopl (%rax)
   # CHECK: <loop_header>:
   # CHECK: 60: 48 83 e8 01                    subq $1, %rax
   # CHECK: 64: 48 85 c0                       testq %rax, %rax
-  # CHECK: 67: 7e 07                          jle 7 <loop_exit>
-  # CHECK: 69: e9 f2 ff ff ff                 jmp -14 <loop_header>
+  # CHECK: 67: 7e 07                          jle 0x70 <loop_exit>
+  # CHECK: 69: e9 f2 ff ff ff                 jmp 0x60 <loop_header>
   # CHECK: 6e: 66 90                          nop
   # CHECK: <loop_exit>:
   # CHECK: 70: c3                             retq

diff  --git a/llvm/test/MC/X86/x86-branch-relaxation.s b/llvm/test/MC/X86/x86-branch-relaxation.s
index 0bdeb667bbfb..8eaf32c48290 100644
--- a/llvm/test/MC/X86/x86-branch-relaxation.s
+++ b/llvm/test/MC/X86/x86-branch-relaxation.s
@@ -24,8 +24,8 @@ baz32:
 
 	
 // CHECK16-LABEL: bar16
-// CHECK16-NEXT: e9 fe ff 	jmp	-2 <bar16+0x1>
+// CHECK16-NEXT: e9 fe ff 	jmp	0x1 <bar16+0x1>
 // CHECK32-LABEL: baz32
-// CHECK32-NEXT: e9 fc ff ff ff 	jmp	-4 <baz32+0x1>
+// CHECK32-NEXT: e9 fc ff ff ff 	jmp	0x1 <baz32+0x1>
 
 	

diff  --git a/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test b/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
index 34dedf9cefed..986c652ab8ff 100644
--- a/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
+++ b/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test
@@ -42,9 +42,9 @@
 # MACHO-i386:        3:       c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
 # MACHO-i386:        b:       c7 04 24 24 00 00 00                            movl    $36, (%esp)
 # MACHO-i386:                                e: GENERIC_RELOC_VANILLA __cstring
-# MACHO-i386:       12:       e8 1f 00 00 00                                  calll   31
+# MACHO-i386:       12:       e8 1f 00 00 00                                  calll   0x36
 # MACHO-i386:                               13: GENERIC_RELOC_VANILLA __jump_table
-# MACHO-i386:       17:       e8 15 00 00 00                                  calll   21
+# MACHO-i386:       17:       e8 15 00 00 00                                  calll   0x31
 # MACHO-i386:                               18: GENERIC_RELOC_VANILLA __jump_table
 # MACHO-i386:       1c:       8b 44 24 08                                     movl    8(%esp), %eax
 # MACHO-i386:       20:       83 c4 0c                                        addl    $12, %esp
@@ -79,9 +79,9 @@
 # ELF-i386:        3:     c7 44 24 08 00 00 00 00                         movl    $0, 8(%esp)
 # ELF-i386:        b:     c7 04 24 00 00 00 00                            movl    $0, (%esp)
 # ELF-i386:                              e: R_386_32      .rodata.str1.1
-# ELF-i386:       12:     e8 fc ff ff ff                                  calll   -4
+# ELF-i386:       12:     e8 fc ff ff ff                                  calll   0x13
 # ELF-i386:                             13: R_386_PC32    puts
-# ELF-i386:       17:     e8 fc ff ff ff                                  calll   -4
+# ELF-i386:       17:     e8 fc ff ff ff                                  calll   0x18
 # ELF-i386:                             18: R_386_PC32    SomeOtherFunction
 # ELF-i386:       1c:     8b 44 24 08                                     movl    8(%esp), %eax
 # ELF-i386:       20:     83 c4 0c                                        addl    $12, %esp

diff  --git a/llvm/test/Object/X86/objdump-trivial-object.test b/llvm/test/Object/X86/objdump-trivial-object.test
index c3e080c5f88f..b7c69d6518d8 100644
--- a/llvm/test/Object/X86/objdump-trivial-object.test
+++ b/llvm/test/Object/X86/objdump-trivial-object.test
@@ -34,8 +34,8 @@
 # ELF-i386:        0: 83 ec 0c                        subl    $12, %esp
 # ELF-i386:        3: c7 44 24 08 00 00 00 00         movl    $0, 8(%esp)
 # ELF-i386:        b: c7 04 24 00 00 00 00            movl    $0, (%esp)
-# ELF-i386:       12: e8 fc ff ff ff                  calll   -4
-# ELF-i386:       17: e8 fc ff ff ff                  calll   -4
+# ELF-i386:       12: e8 fc ff ff ff                  calll   0x13
+# ELF-i386:       17: e8 fc ff ff ff                  calll   0x18
 # ELF-i386:       1c: 8b 44 24 08                     movl    8(%esp), %eax
 # ELF-i386:       20: 83 c4 0c                        addl    $12, %esp
 # ELF-i386:       23: c3                              ret

diff  --git a/llvm/test/tools/llvm-objdump/ELF/call-absolute-symbol.test b/llvm/test/tools/llvm-objdump/ELF/call-absolute-symbol.test
index f1c6ff025d70..424daf31bfff 100644
--- a/llvm/test/tools/llvm-objdump/ELF/call-absolute-symbol.test
+++ b/llvm/test/tools/llvm-objdump/ELF/call-absolute-symbol.test
@@ -1,3 +1,3 @@
 // REQUIRES: x86_64-linux
 // RUN: llvm-objdump -d %p/Inputs/call-absolute-symbol.elf-x86_64 | FileCheck %s
-CHECK: 201000:	e8 fb f0 df ff 	callq	-2100997 <foo>
+CHECK: 201000:	e8 fb f0 df ff 	callq	0x100 <foo>

diff  --git a/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test b/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test
index 541cca53869b..d8d481cec043 100644
--- a/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test
+++ b/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test
@@ -3,4 +3,4 @@
 
 # RUN: llvm-objdump -d %p/Inputs/hello.exe.macho-i386 | FileCheck %s
 
-# CHECK: 1f47:   e8 00 00 00 00  calll   0 <_main+0xc>
+# CHECK: 1f47:   e8 00 00 00 00  calll   0x1f4c <_main+0xc>

diff  --git a/llvm/test/tools/llvm-objdump/X86/coff-disassemble-export.test b/llvm/test/tools/llvm-objdump/X86/coff-disassemble-export.test
index 5cd01bcfa70d..f05a1513b27a 100644
--- a/llvm/test/tools/llvm-objdump/X86/coff-disassemble-export.test
+++ b/llvm/test/tools/llvm-objdump/X86/coff-disassemble-export.test
@@ -2,7 +2,7 @@
 // RUN:   FileCheck %s
 
 // CHECK-LABEL: <g>:
-// CHECK: calll 8 <f>
+// CHECK: calll 0x10001010 <f>
 
 // CHECK-LABEL: f:
-// CHECK: calll -24 <g>
+// CHECK: calll 0x10001000 <g>

diff  --git a/llvm/test/tools/llvm-objdump/X86/demangle.s b/llvm/test/tools/llvm-objdump/X86/demangle.s
index d555bbf5ac74..f6523f2e931b 100644
--- a/llvm/test/tools/llvm-objdump/X86/demangle.s
+++ b/llvm/test/tools/llvm-objdump/X86/demangle.s
@@ -11,7 +11,7 @@
 ## Check the case when relocations are inlined into disassembly.
 # RUN: llvm-objdump -d -r --demangle %t | FileCheck %s --check-prefix=INLINE
 # INLINE:      <foo()>:
-# INLINE-NEXT:  0: {{.*}}  callq   0 <_Z3foov+0x5>
+# INLINE-NEXT:  0: {{.*}}  callq   0x5 <_Z3foov+0x5>
 # INLINE-NEXT:  0000000000000001:  R_X86_64_PLT32 foo()-0x4
 
 .text

diff  --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-no-symtab.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-no-symtab.test
index a5bb43f95041..61c268d218eb 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-no-symtab.test
+++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-no-symtab.test
@@ -8,7 +8,7 @@
 # CHECK:       Disassembly of section .text:
 # CHECK-EMPTY:
 # CHECK-NEXT:  0000000000004000 <.text>:
-# CHECK-NEXT:    4000: e8 42 00 00 00                callq   66 <.text+0x47>
+# CHECK-NEXT:    4000: e8 42 00 00 00                callq   0x4047 <.text+0x47>
 
 --- !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test
index a7d77f863eb7..593735a6a102 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test
+++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-relocs.test
@@ -4,10 +4,10 @@
 # RUN: yaml2obj %s --docnum=1 -o %t1.o
 # RUN: llvm-objdump %t1.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"
 
-# CHECK:      0: e8 00 00 00 00                callq   0 <.text+0x5>
+# CHECK:      0: e8 00 00 00 00                callq   0x5 <.text+0x5>
 # CHECK-NEXT:          0000000000000001:  R_X86_64_PC32        foo-0x4
 # CHECK-NEXT:          0000000000000002:  R_X86_64_NONE        bar+0x8
-# CHECK-NEXT: 5: e8 00 00 00 00                callq   0 <.text+0xa>
+# CHECK-NEXT: 5: e8 00 00 00 00                callq   0xa <.text+0xa>
 # CHECK-NEXT:          0000000000000006:  R_X86_64_PLT32       foo+0x1
 
 --- !ELF

diff  --git a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-references.yaml b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-references.yaml
index 92c82e7519d6..f1470c847978 100644
--- a/llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-references.yaml
+++ b/llvm/test/tools/llvm-objdump/X86/elf-disassemble-symbol-references.yaml
@@ -3,9 +3,9 @@
 # RUN: llvm-objdump %t -d | FileCheck %s --check-prefix=EXEC
 
 # EXEC: Disassembly of section .text1:
-# EXEC:     4000: e8 00 00 00 00                callq   0 <third>
+# EXEC:     4000: e8 00 00 00 00                callq   0x4005 <third>
 # EXEC: Disassembly of section .text2:
-# EXEC:     4005: e8 12 34 56 78                callq   2018915346 <fourth+0x78563412>
+# EXEC:     4005: e8 12 34 56 78                callq   0x7856741c <fourth+0x78563412>
 
 --- !ELF
 FileHeader:
@@ -48,17 +48,17 @@ Symbols:
 # REL:      Disassembly of section .text1:
 # REL-EMPTY:
 # REL-NEXT: 0000000000000000 <.text1>:
-# REL-NEXT:        0: e8 00 00 00 00                callq   0 <.text1+0x5>
+# REL-NEXT:        0: e8 00 00 00 00                callq   0x5 <.text1+0x5>
 # REL-EMPTY:
 # REL-NEXT: Disassembly of section .text2:
 # REL-EMPTY:
 # REL-NEXT: 0000000000000000 <.text2>:
-# REL-NEXT:        0: e8 00 00 00 00                callq   0 <sym2>
+# REL-NEXT:        0: e8 00 00 00 00                callq   0x5 <sym2>
 # REL-EMPTY:
 # REL-NEXT: Disassembly of section .text3:
 # REL-EMPTY:
 # REL-NEXT: 0000000000000000 <.text3>:
-# REL-NEXT:        0: e8 00 00 00 00                callq   0 <.text3+0x5>
+# REL-NEXT:        0: e8 00 00 00 00                callq   0x5 <.text3+0x5>
 
 --- !ELF
 FileHeader:

diff  --git a/llvm/test/tools/llvm-objdump/X86/section-filter-relocs.test b/llvm/test/tools/llvm-objdump/X86/section-filter-relocs.test
index a00e34ee7510..002bd9349d16 100644
--- a/llvm/test/tools/llvm-objdump/X86/section-filter-relocs.test
+++ b/llvm/test/tools/llvm-objdump/X86/section-filter-relocs.test
@@ -10,7 +10,7 @@
 # DISASM:       Disassembly of section .text:
 # DISASM-EMPTY:
 # DISASM-NEXT:  0000000000000400 <.text>:
-# DISASM-NEXT:  400: e8 00 00 00 00                callq   0 <.text+0x5>
+# DISASM-NEXT:  400: e8 00 00 00 00                callq   0x405 <.text+0x5>
 # RELOC-NEXT:                      00000401:  R_X86_64_PC32        foo+0x1
 # RELOC-NEXT:                      00000401:  R_X86_64_GOT32       foo
 # DISASM:       Disassembly of section .rodata:

diff  --git a/llvm/tools/llvm-objdump/llvm-objdump.cpp b/llvm/tools/llvm-objdump/llvm-objdump.cpp
index e9cd34e00fad..4514f3c28647 100644
--- a/llvm/tools/llvm-objdump/llvm-objdump.cpp
+++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp
@@ -735,9 +735,15 @@ class PrettyPrinter {
     unsigned Column = OS.tell() - Start;
     OS.indent(Column < TabStop - 1 ? TabStop - 1 - Column : 7 - Column % 8);
 
-    if (MI)
-      IP.printInst(MI, Address.Address, "", STI, OS);
-    else
+    if (MI) {
+      // See MCInstPrinter::printInst. On targets where a PC relative immediate
+      // is relative to the next instruction and the length of a MCInst is
+      // 
diff icult to measure (x86), this is the address of the next
+      // instruction.
+      uint64_t Addr =
+          Address.Address + (STI.getTargetTriple().isX86() ? Bytes.size() : 0);
+      IP.printInst(MI, Addr, "", STI, OS);
+    } else
       OS << "\t<unknown>";
   }
 };


        


More information about the llvm-commits mailing list