diff --git a/lld/test/COFF/delayimports32.test b/lld/test/COFF/delayimports32.test --- a/lld/test/COFF/delayimports32.test +++ b/lld/test/COFF/delayimports32.test @@ -72,14 +72,14 @@ 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 --- a/lld/test/COFF/imports.test +++ b/lld/test/COFF/imports.test @@ -19,10 +19,10 @@ 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 --- 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 --- 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 --- a/lld/test/ELF/comdat.s +++ b/lld/test/ELF/comdat.s @@ -31,7 +31,7 @@ // CHECK-EMPTY: // CHECK-NEXT: : // 0x1234 - 0x1235 - 5 = -6 -// CHECK-NEXT: 1235: {{.*}} callq -6 +// CHECK-NEXT: 1235: {{.*}} callq 0x1234 .section .text3,"axG",@progbits,zed,comdat,unique,0 diff --git a/lld/test/ELF/gnu-ifunc-i386.s b/lld/test/ELF/gnu-ifunc-i386.s --- a/lld/test/ELF/gnu-ifunc-i386.s +++ b/lld/test/ELF/gnu-ifunc-i386.s @@ -113,8 +113,8 @@ // DISASM: : // DISASM-NEXT: 4010e5: retl // DISASM: <_start>: -// DISASM-NEXT: 4010e6: calll 21 -// DISASM-NEXT: calll 32 +// DISASM-NEXT: 4010e6: calll 0x401100 +// DISASM-NEXT: calll 0x401110 // DISASM-NEXT: movl $4194516, %edx // DISASM-NEXT: movl $4194532, %edx // DISASM-EMPTY: @@ -123,11 +123,11 @@ // DISASM-NEXT: : // DISASM-NEXT: 401100: jmpl *4202784 // DISASM-NEXT: pushl $0 -// DISASM-NEXT: jmp -4198672 +// DISASM-NEXT: jmp 0x0 // DISASM: : // 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 --- 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 -// DISASM-NEXT: calll 0x2e +// DISASM-NEXT: calll 0x4011ef <_start+0x1> +// DISASM-NEXT: calll 0x4011f4 <_start+0x6> +// DISASM-NEXT: calll 0x401220 +// DISASM-NEXT: calll 0x401230 // DISASM-EMPTY: // DISASM-NEXT: Disassembly of section .plt: // DISASM-EMPTY: @@ -45,12 +45,12 @@ // DISASM-NEXT: 00401220 : // DISASM-NEXT: jmpl *0x4032d4 // DISASM-NEXT: pushl $0x0 -// DISASM-NEXT: jmp -0x20 <.plt> +// DISASM-NEXT: jmp 0x401210 <.plt> // DISASM-EMPTY: // DISASM-NEXT: 00401230 : // 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 --- 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 -// DISASM-NEXT: 201331: callq 42 +// DISASM-NEXT: 201322: callq 0x201327 <_start+0x5> +// DISASM-NEXT: 201327: callq 0x20132c <_start+0xa> +// DISASM-NEXT: 20132c: callq 0x201350 +// DISASM-NEXT: 201331: callq 0x201360 // DISASM-EMPTY: // DISASM-NEXT: Disassembly of section .plt: // DISASM-EMPTY: @@ -45,12 +45,12 @@ // DISASM-NEXT: 0000000000201350 : // 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 : // 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 --- a/lld/test/ELF/gnu-ifunc-plt-i386.s +++ b/lld/test/ELF/gnu-ifunc-plt-i386.s @@ -37,10 +37,10 @@ // DISASM: : // DISASM-NEXT: 4011b5: retl // DISASM: <_start>: -// DISASM-NEXT: 4011b6: calll 69 -// DISASM-NEXT: calll 80 -// DISASM-NEXT: calll 27 -// DISASM-NEXT: calll 38 +// DISASM-NEXT: 4011b6: calll 0x401200 +// DISASM-NEXT: calll 0x401210 +// DISASM-NEXT: calll 0x4011e0 +// DISASM-NEXT: calll 0x4011f0 // DISASM-EMPTY: // DISASM-NEXT: Disassembly of section .plt: // DISASM-EMPTY: @@ -55,22 +55,22 @@ // DISASM-NEXT: : // DISASM-NEXT: 4011e0: jmpl *4207268 // DISASM-NEXT: pushl $0 -// DISASM-NEXT: jmp -32 <.plt> +// DISASM-NEXT: jmp 0x4011d0 <.plt> // DISASM-EMPTY: // DISASM-NEXT: : // 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 --- a/lld/test/ELF/gnu-ifunc-plt.s +++ b/lld/test/ELF/gnu-ifunc-plt.s @@ -41,8 +41,8 @@ // DISASM: : // 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 {{.*}} // DISASM-NEXT: callq {{.*}} // DISASM-EMPTY: @@ -56,22 +56,22 @@ // DISASM-NEXT: : // 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: : // 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 --- a/lld/test/ELF/gnu-ifunc-shared.s +++ b/lld/test/ELF/gnu-ifunc-shared.s @@ -16,9 +16,9 @@ // DISASM: : // DISASM-NEXT: 1309: retq // DISASM: : -// 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: : // DISASM-NEXT: 131a: retq @@ -33,18 +33,18 @@ // DISASM-NEXT: : // 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: : // 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 --- a/lld/test/ELF/gnu-ifunc.s +++ b/lld/test/ELF/gnu-ifunc.s @@ -96,8 +96,8 @@ // DISASM: : // 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 --- 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 : -# DISASM-NEXT: 401200: calll 0x2b -# DISASM-NEXT: 401205: calll 0x36 +# DISASM-NEXT: 401200: calll 0x401230 +# DISASM-NEXT: 401205: calll 0x401240 # 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 --- 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 -// DISASM-NEXT: 4011c5: jmp 0x26 -// DISASM-NEXT: 4011ca: jmp 0x31 -// DISASM-NEXT: 4011cf: jmp -0x18 +// DISASM-NEXT: 4011c0: jmp 0x4011f0 +// DISASM-NEXT: 4011c5: jmp 0x4011f0 +// DISASM-NEXT: 4011ca: jmp 0x401200 +// DISASM-NEXT: 4011cf: jmp 0x4011bc // 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: : /// .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 -// DISASMSHARED-NEXT: jmp 34 -// DISASMSHARED-NEXT: jmp 45 -// DISASMSHARED-NEXT: jmp -24 +// DISASMSHARED-NEXT: 11e4: jmp 0x1210 +// DISASMSHARED-NEXT: jmp 0x1210 +// DISASMSHARED-NEXT: jmp 0x1220 +// DISASMSHARED-NEXT: jmp 0x11e0 // DISASMSHARED-EMPTY: // DISASMSHARED-NEXT: Disassembly of section .plt: // DISASMSHARED-EMPTY: @@ -139,11 +139,11 @@ // DISASMSHARED: : // DISASMSHARED-NEXT: 1210: jmpl *12(%ebx) // DISASMSHARED-NEXT: pushl $0 -// DISASMSHARED-NEXT: jmp -32 <.plt> +// DISASMSHARED-NEXT: jmp 0x1200 <.plt> // DISASMSHARED: : // 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: : // DISASMPIE-NEXT: 11f0: jmpl *12(%ebx) // DISASMPIE-NEXT: pushl $0 -// DISASMPIE-NEXT: jmp -32 <.plt> +// DISASMPIE-NEXT: jmp 0x11e0 <.plt> // DISASMPIE-EMPTY: // DISASMPIE-NEXT: : // 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- 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 --- a/lld/test/ELF/i386-tls-dynamic.s +++ b/lld/test/ELF/i386-tls-dynamic.s @@ -82,16 +82,16 @@ ## -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 --- a/lld/test/ELF/local-got-pie.s +++ b/lld/test/ELF/local-got-pie.s @@ -17,7 +17,7 @@ // DISASM: Disassembly of section .text: // DISASM-EMPTY: // DISASM-NEXT: <_start>: -// DISASM-NEXT: 1210: {{.*}} callq 4275 +// DISASM-NEXT: 1210: {{.*}} callq 0x22c8 // DISASM: : // DISASM-NEXT: 1215: {{.*}} nop diff --git a/lld/test/ELF/local-got-shared.s b/lld/test/ELF/local-got-shared.s --- a/lld/test/ELF/local-got-shared.s +++ b/lld/test/ELF/local-got-shared.s @@ -14,7 +14,7 @@ // 0x22E0 - 0x1228 - 5 = 4275 // DISASM: : -// DISASM-NEXT: 1228: callq 4275 +// DISASM-NEXT: 1228: callq 0x22e0 // DISASM: : // DISASM-NEXT: 122d: nop diff --git a/lld/test/ELF/local-got.s b/lld/test/ELF/local-got.s --- a/lld/test/ELF/local-got.s +++ b/lld/test/ELF/local-got.s @@ -18,8 +18,8 @@ // 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: : // 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 --- 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: : ; NOIPO-NEXT: movl $2, %eax ; NOIPO: <_start>: -; NOIPO-NEXT: jmp -21 +; NOIPO-NEXT: jmp 0x201160 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 --- 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 --- a/lld/test/ELF/pre_init_fini_array_missing.s +++ b/lld/test/ELF/pre_init_fini_array_missing.s @@ -22,21 +22,21 @@ // 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 --- a/lld/test/ELF/relocation-i686.s +++ b/lld/test/ELF/relocation-i686.s @@ -33,7 +33,7 @@ // CHECK: Disassembly of section .R_386_PC32: // CHECK-EMPTY: // CHECK-NEXT: : -// CHECK-NEXT: calll 4 +// CHECK-NEXT: calll 0x4011ba // CHECK: : // CHECK-NEXT: nop @@ -77,7 +77,7 @@ // CHECK: Disassembly of section .dynamic_reloc: // CHECK-EMPTY: // CHECK-NEXT: <.dynamic_reloc>: -// CHECK-NEXT: 4011c5: calll 38 +// CHECK-NEXT: 4011c5: calll 0x4011f0 .section .R_386_GOT32,"ax",@progbits .global R_386_GOT32 diff --git a/lld/test/ELF/relocation.s b/lld/test/ELF/relocation.s --- a/lld/test/ELF/relocation.s +++ b/lld/test/ELF/relocation.s @@ -93,7 +93,7 @@ // 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: : @@ -132,7 +132,7 @@ // CHECK: Disassembly of section .R_X86_64_PC32: // CHECK-EMPTY: // CHECK-NEXT: : -// CHECK-NEXT: 201327: {{.*}} callq 36 +// CHECK-NEXT: 201327: {{.*}} callq 0x201350 // CHECK-NEXT: 20132c: {{.*}} movl $2102096, %eax .section .R_X86_64_32S_2,"ax",@progbits diff --git a/lld/test/ELF/startstop.s b/lld/test/ELF/startstop.s --- 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 --- 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 : -# DISASM-NEXT: 201330: callq 0x2b -# DISASM-NEXT: 201335: callq 0x36 +# DISASM-NEXT: 201330: callq 0x201360 +# DISASM-NEXT: 201335: callq 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 --- 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 -# DISASM-NEXT: callq -99 -# DISASM-NEXT: callq -104 -# DISASM-NEXT: callq -110 +# DISASM-NEXT: callq 0x201170 +# DISASM-NEXT: callq 0x201170 +# DISASM-NEXT: callq 0x201171 +# DISASM-NEXT: callq 0x201171 # DISASM-NEXT: callq *4155(%rip) # DISASM-NEXT: callq *4149(%rip) -# DISASM-NEXT: jmp -128 +# DISASM-NEXT: jmp 0x201170 # DISASM-NEXT: nop -# DISASM-NEXT: jmp -134 +# DISASM-NEXT: jmp 0x201170 # DISASM-NEXT: nop -# DISASM-NEXT: jmp -139 +# DISASM-NEXT: jmp 0x201171 # DISASM-NEXT: nop -# DISASM-NEXT: jmp -145 +# DISASM-NEXT: jmp 0x201171 # 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 --- a/lld/test/ELF/x86-64-plt.s +++ b/lld/test/ELF/x86-64-plt.s @@ -70,17 +70,17 @@ // DISASM-NEXT: : // DISASM-NEXT: 1330: jmpq *8450(%rip) // DISASM-NEXT: pushq $0 -// DISASM-NEXT: jmp -32 <.plt> +// DISASM-NEXT: jmp 0x1320 <.plt> // DISASM-EMPTY: // DISASM-NEXT: : // 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@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 -// DISASM2-NEXT: jmp 38 -// DISASM2-NEXT: jmp 49 -// DISASM2-NEXT: jmp -20 <_start> +// DISASM2-NEXT: jmp 0x2012f0 +// DISASM2-NEXT: jmp 0x2012f0 +// DISASM2-NEXT: jmp 0x201300 +// DISASM2-NEXT: jmp 0x2012c0 <_start> // 0x202018 - 0x201036 = 4066 // 0x202020 - 0x201046 = 4058 @@ -106,12 +106,12 @@ // DISASM2-NEXT: : // DISASM2-NEXT: 2012f0: jmpq *8450(%rip) // DISASM2-NEXT: pushq $0 -// DISASM2-NEXT: jmp -32 <.plt> +// DISASM2-NEXT: jmp 0x2012e0 <.plt> // DISASM2-EMPTY: // DISASM2-NEXT: : // 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 --- 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 --- 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 --- 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@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@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 --- 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 --- 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 --- a/llvm/include/llvm/MC/MCInstPrinter.h +++ b/llvm/include/llvm/MC/MCInstPrinter.h @@ -84,6 +84,12 @@ 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 difficult 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 --- 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 @@ } } -/// 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 differently than normal immediates. -/// for example, a $ is not emitted. +/// value (e.g. for jumps and calls). In Intel-style these print slightly +/// differently 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 --- 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 : -; CHECK-NEXT: 0: 74 00 je 0 +; CHECK-NEXT: 0: 74 00 je 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 --- 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: : ; CHECK-NEXT: {{.*}} pushq %rbx -; CHECK-NEXT: {{.*}} callq 0 +; CHECK-NEXT: {{.*}} callq 0x6 ; CHECK-NEXT: {{.*}} movl %eax, %ebx -; CHECK-NEXT: {{.*}} callq 0 +; CHECK-NEXT: {{.*}} callq 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 --- 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 +# ASM-NEXT: 15: 75 0f jne 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 +# ASM-NEXT: 26: e8 00 00 00 00 callq 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 --- 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 --- 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 --- a/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s +++ b/llvm/test/MC/X86/AlignedBundling/misaligned-bundle-group.s @@ -16,8 +16,8 @@ # 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 --- a/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s +++ b/llvm/test/MC/X86/AlignedBundling/single-inst-bundling.s @@ -30,8 +30,8 @@ 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 --- a/llvm/test/MC/X86/align-via-padding.s +++ b/llvm/test/MC/X86/align-via-padding.s @@ -35,12 +35,12 @@ # fewer nops by relaxing the branch, even though we don't need to # CHECK: : # CHECK: 45: 48 85 c0 testq %rax, %rax - # CHECK: 48: 2e 2e 2e 2e 0f 8e 1e 00 00 00 jle 30 + # CHECK: 48: 2e 2e 2e 2e 0f 8e 1e 00 00 00 jle 0x70 # CHECK: 52: 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 nopw %cs:(%rax,%rax) # CHECK: : # CHECK: 60: 48 83 e8 01 subq $1, %rax # CHECK: 64: 48 85 c0 testq %rax, %rax - # CHECK: 67: 7e 07 jle 7 + # CHECK: 67: 7e 07 jle 0x70 # CHECK: 69: 2e 2e e9 f0 ff ff ff jmp # CHECK: : # CHECK: 70: c3 retq @@ -62,7 +62,7 @@ # 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 + # CHECK: fe: eb 80 jmp 0x80 # 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 --- 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 - # CHECK: 2: e9 1a 00 00 00 jmp 26 - # CHECK: 7: e9 15 00 00 00 jmp 21 - # CHECK: c: e9 10 00 00 00 jmp 16 - # CHECK: 11: e9 0b 00 00 00 jmp 11 - # CHECK: 16: e9 06 00 00 00 jmp 6 - # CHECK: 1b: e9 01 00 00 00 jmp 1 + # CHECK: 0: eb 1f jmp 0x21 + # CHECK: 2: e9 1a 00 00 00 jmp 0x21 + # CHECK: 7: e9 15 00 00 00 jmp 0x21 + # CHECK: c: e9 10 00 00 00 jmp 0x21 + # CHECK: 11: e9 0b 00 00 00 jmp 0x21 + # CHECK: 16: e9 06 00 00 00 jmp 0x21 + # CHECK: 1b: e9 01 00 00 00 jmp 0x21 # CHECK: 20: cc int3 .p2align 4 jmp foo @@ -33,7 +33,7 @@ # Check that we're not shifting aroudn the offsets of labels - doing # that would require a further round of relaxation # CHECK: : - # CHECK: 22: eb fe jmp -2 + # CHECK: 22: eb fe jmp 0x22 # 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 @@ # fewer nops by relaxing the branch, even though we don't need to # CHECK: : # CHECK: 45: 48 85 c0 testq %rax, %rax - # CHECK: 48: 0f 8e 22 00 00 00 jle 34 + # CHECK: 48: 0f 8e 22 00 00 00 jle 0x70 # 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: : # CHECK: 60: 48 83 e8 01 subq $1, %rax # CHECK: 64: 48 85 c0 testq %rax, %rax - # CHECK: 67: 7e 07 jle 7 - # CHECK: 69: e9 f2 ff ff ff jmp -14 + # CHECK: 67: 7e 07 jle 0x70 + # CHECK: 69: e9 f2 ff ff ff jmp 0x60 # CHECK: 6e: 66 90 nop # CHECK: : # CHECK: 70: c3 retq diff --git a/llvm/test/MC/X86/x86-branch-relaxation.s b/llvm/test/MC/X86/x86-branch-relaxation.s --- a/llvm/test/MC/X86/x86-branch-relaxation.s +++ b/llvm/test/MC/X86/x86-branch-relaxation.s @@ -24,8 +24,8 @@ // CHECK16-LABEL: bar16 -// CHECK16-NEXT: e9 fe ff jmp -2 +// CHECK16-NEXT: e9 fe ff jmp 0x1 // CHECK32-LABEL: baz32 -// CHECK32-NEXT: e9 fc ff ff ff jmp -4 +// CHECK32-NEXT: e9 fc ff ff ff jmp 0x1 diff --git a/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test b/llvm/test/Object/X86/objdump-disassembly-inline-relocations.test --- 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 --- 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 --- 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 +CHECK: 201000: e8 fb f0 df ff callq 0x100 diff --git a/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test b/llvm/test/tools/llvm-objdump/MachO/hex-displacement.test --- 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 --- 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: : -// CHECK: calll 8 +// CHECK: calll 0x10001010 // CHECK-LABEL: f: -// CHECK: calll -24 +// CHECK: calll 0x10001000 diff --git a/llvm/test/tools/llvm-objdump/X86/demangle.s b/llvm/test/tools/llvm-objdump/X86/demangle.s --- 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: : -# 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 --- 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 --- 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 --- 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 +# EXEC: 4000: e8 00 00 00 00 callq 0x4005 # EXEC: Disassembly of section .text2: -# EXEC: 4005: e8 12 34 56 78 callq 2018915346 +# EXEC: 4005: e8 12 34 56 78 callq 0x7856741c --- !ELF FileHeader: @@ -48,17 +48,17 @@ # 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 +# REL-NEXT: 0: e8 00 00 00 00 callq 0x5 # 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 --- 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 --- a/llvm/tools/llvm-objdump/llvm-objdump.cpp +++ b/llvm/tools/llvm-objdump/llvm-objdump.cpp @@ -735,9 +735,15 @@ 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 + // difficult 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"; } };