1 ## Show that --disassemble + --reloc prints relocations inline and does not dump
2 ## the relocation sections.
4 # RUN: rm -rf %t && split-file %s %t && cd %t
5 # RUN: llvm-mc -filetype=obj -triple=x86_64 1.s -o 1.o
6 # RUN: llvm-objdump 1.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"
7 # RUN: llvm-objdump 1.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK2
9 # RUN: llvm-mc -filetype=obj -triple=x86_64 -crel 1.s -o 1leb.o
10 # RUN: llvm-objdump 1leb.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"
11 # RUN: llvm-objdump 1leb.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK2
14 # CHECK: 0000000000000000 <x1>:
15 # CHECK-NEXT: 0: e8 00 00 00 00 callq 0x5 <x1+0x5>
16 # CHECK-NEXT: 0000000000000001: R_X86_64_PC32 foo-0x4
17 # CHECK-NEXT: 0000000000000002: R_X86_64_NONE bar+0x8
18 # CHECK-NEXT: 5: e8 00 00 00 00 callq 0xa <x2>
19 # CHECK-NEXT: 0000000000000006: R_X86_64_PLT32 foo+0x1
21 # CHECK-NEXT: 000000000000000a <x2>:
22 # CHECK-NEXT: a: 90 nop
23 # CHECK-NEXT: b: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x12 <x3>
24 # CHECK-NEXT: 000000000000000e: R_X86_64_REX_GOTPCRELX var-0x4
26 # CHECK-NEXT: 0000000000000012 <x3>:
27 # CHECK-NEXT: 12: e8 00 00 00 00 callq 0x17 <x4>
28 # CHECK-NEXT: 0000000000000013: R_X86_64_PLT32 foo-0x4
30 # CHECK-NEXT: 0000000000000017 <x4>:
31 # CHECK-NEXT: 17: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x1e <x4+0x7>
32 # CHECK-NEXT: 000000000000001a: R_X86_64_REX_GOTPCRELX var-0x4
35 # CHECK2: 000000000000000a <x2>:
36 # CHECK2-NEXT: a: 90 nop
37 # CHECK2-NEXT: b: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x12 <x3>
38 # CHECK2-NEXT: 000000000000000e: R_X86_64_REX_GOTPCRELX var-0x4
40 # CHECK2-NEXT: 0000000000000017 <x4>:
41 # CHECK2-NEXT: 17: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x1e <x4+0x7>
42 # CHECK2-NEXT: 000000000000001a: R_X86_64_REX_GOTPCRELX var-0x4
47 .reloc .+1, R_X86_64_PC32, foo-4
48 .reloc .+2, BFD_RELOC_NONE, bar+8
49 .byte 0xe8, 0, 0, 0, 0
50 .reloc .+1, R_X86_64_PLT32, foo+1
51 .byte 0xe8, 0, 0, 0, 0
55 movq var@GOTPCREL(%rip), %rax
61 movq var@GOTPCREL(%rip), %rax
64 ## Check we report an error if the relocated section identified by the
65 ## sh_info field of a relocation section is invalid.
67 # RUN: yaml2obj 2.yaml -o 2.o
68 # RUN: not llvm-objdump 2.o -d --reloc 2>&1 | FileCheck %s --check-prefix=ERR
70 # ERR: error: '2.o': section (1): failed to get a relocated section: invalid section index: 255
79 - Name: .rela.debug_info
86 ## Check ranges of addends being displayed in a dump of relocations mixed with disassembly.
87 # RUN: llvm-mc -filetype=obj -triple=x86_64 3.s -o 3.o
88 # RUN: llvm-objdump -d -r 3.o | FileCheck %s --check-prefix=ADDENDS
90 # ADDENDS: Disassembly of section .text:
91 # ADDENDS: R_X86_64_64 glob-0x8000000000000000
92 # ADDENDS: R_X86_64_64 glob+0x7fffffffffffffff
93 # ADDENDS: R_X86_64_64 glob-0x1
94 # ADDENDS: R_X86_64_64 glob+0x12345678
95 # ADDENDS: R_X86_64_64 glob{{$}}
97 .reloc ., BFD_RELOC_64, glob-0x8000000000000000
98 .reloc .+1, BFD_RELOC_64, glob+0x7fffffffffffffff
99 .reloc .+2, BFD_RELOC_64, glob-1
100 .reloc .+3, BFD_RELOC_64, glob+0x12345678
101 .reloc .+4, BFD_RELOC_64, glob