## Show that --disassemble + --reloc prints relocations inline and does not dump
## the relocation sections.
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=x86_64 1.s -o 1.o
# RUN: llvm-objdump 1.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"
# RUN: llvm-objdump 1.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK2
# RUN: llvm-mc -filetype=obj -triple=x86_64 -crel 1.s -o 1leb.o
# RUN: llvm-objdump 1leb.o -d -r | FileCheck %s --implicit-check-not="RELOCATION RECORDS"
# RUN: llvm-objdump 1leb.o -r --disassemble-symbols=x2,x4 | FileCheck %s --check-prefix=CHECK2
#--- 1.s
# CHECK: 0000000000000000 <x1>:
# CHECK-NEXT: 0: e8 00 00 00 00 callq 0x5 <x1+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 0xa <x2>
# CHECK-NEXT: 0000000000000006: R_X86_64_PLT32 foo+0x1
# CHECK-EMPTY:
# CHECK-NEXT: 000000000000000a <x2>:
# CHECK-NEXT: a: 90 nop
# CHECK-NEXT: b: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x12 <x3>
# CHECK-NEXT: 000000000000000e: R_X86_64_REX_GOTPCRELX var-0x4
# CHECK-EMPTY:
# CHECK-NEXT: 0000000000000012 <x3>:
# CHECK-NEXT: 12: e8 00 00 00 00 callq 0x17 <x4>
# CHECK-NEXT: 0000000000000013: R_X86_64_PLT32 foo-0x4
# CHECK-EMPTY:
# CHECK-NEXT: 0000000000000017 <x4>:
# CHECK-NEXT: 17: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x1e <x4+0x7>
# CHECK-NEXT: 000000000000001a: R_X86_64_REX_GOTPCRELX var-0x4
# CHECK-NOT: {{.}}
# CHECK2: 000000000000000a <x2>:
# CHECK2-NEXT: a: 90 nop
# CHECK2-NEXT: b: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x12 <x3>
# CHECK2-NEXT: 000000000000000e: R_X86_64_REX_GOTPCRELX var-0x4
# CHECK2-EMPTY:
# CHECK2-NEXT: 0000000000000017 <x4>:
# CHECK2-NEXT: 17: 48 8b 05 00 00 00 00 movq (%rip), %rax # 0x1e <x4+0x7>
# CHECK2-NEXT: 000000000000001a: R_X86_64_REX_GOTPCRELX var-0x4
# CHECK2-NOT: {{.}}
.globl x1, x2, x3, x4
x1:
.reloc .+1, R_X86_64_PC32, foo-4
.reloc .+2, BFD_RELOC_NONE, bar+8
.byte 0xe8, 0, 0, 0, 0
.reloc .+1, R_X86_64_PLT32, foo+1
.byte 0xe8, 0, 0, 0, 0
x2:
nop
movq var@GOTPCREL(%rip), %rax
x3:
call foo
x4:
movq var@GOTPCREL(%rip), %rax
#--- 2.yaml
## Check we report an error if the relocated section identified by the
## sh_info field of a relocation section is invalid.
# RUN: yaml2obj 2.yaml -o 2.o
# RUN: not llvm-objdump 2.o -d --reloc 2>&1 | FileCheck %s --check-prefix=ERR
# ERR: error: '2.o': section (1): failed to get a relocated section: invalid section index: 255
--- !ELF
FileHeader:
Class: ELFCLASS64
Data: ELFDATA2LSB
Type: ET_REL
Machine: EM_X86_64
Sections:
- Name: .rela.debug_info
Type: SHT_RELA
Link: 0
Info: 0xFF
Relocations: []
#--- 3.s
## Check ranges of addends being displayed in a dump of relocations mixed with disassembly.
# RUN: llvm-mc -filetype=obj -triple=x86_64 3.s -o 3.o
# RUN: llvm-objdump -d -r 3.o | FileCheck %s --check-prefix=ADDENDS
# ADDENDS: Disassembly of section .text:
# ADDENDS: R_X86_64_64 glob-0x8000000000000000
# ADDENDS: R_X86_64_64 glob+0x7fffffffffffffff
# ADDENDS: R_X86_64_64 glob-0x1
# ADDENDS: R_X86_64_64 glob+0x12345678
# ADDENDS: R_X86_64_64 glob{{$}}
.reloc ., BFD_RELOC_64, glob-0x8000000000000000
.reloc .+1, BFD_RELOC_64, glob+0x7fffffffffffffff
.reloc .+2, BFD_RELOC_64, glob-1
.reloc .+3, BFD_RELOC_64, glob+0x12345678
.reloc .+4, BFD_RELOC_64, glob
.space 8