mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
3d2508df1f
``` // 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
81 lines
3.6 KiB
Plaintext
81 lines
3.6 KiB
Plaintext
# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-i386 \
|
|
# RUN: | FileCheck %s -check-prefix COFF-i386
|
|
|
|
# COFF-i386: file format coff-i386
|
|
# COFF-i386: Disassembly of section .text:
|
|
# COFF-i386: 0: 83 ec 0c subl $12, %esp
|
|
# COFF-i386: 3: c7 44 24 08 00 00 00 00 movl $0, 8(%esp)
|
|
# COFF-i386: b: c7 04 24 00 00 00 00 movl $0, (%esp)
|
|
# COFF-i386: 12: e8 00 00 00 00 calll 0
|
|
# COFF-i386: 17: e8 00 00 00 00 calll 0
|
|
# COFF-i386: 1c: 8b 44 24 08 movl 8(%esp), %eax
|
|
# COFF-i386: 20: 83 c4 0c addl $12, %esp
|
|
# COFF-i386: 23: c3 ret
|
|
|
|
# RUN: llvm-objdump -d %p/../Inputs/trivial-object-test.coff-x86-64 \
|
|
# RUN: | FileCheck %s -check-prefix COFF-x86-64
|
|
|
|
# COFF-x86-64: file format coff-x86-64
|
|
# COFF-x86-64: Disassembly of section .text:
|
|
# COFF-x86-64: 0: 48 83 ec 28 subq $40, %rsp
|
|
# COFF-x86-64: 4: c7 44 24 24 00 00 00 00 movl $0, 36(%rsp)
|
|
# COFF-x86-64: c: 48 8d 0d 00 00 00 00 leaq (%rip), %rcx
|
|
# COFF-x86-64: 13: e8 00 00 00 00 callq 0
|
|
# COFF-x86-64: 18: e8 00 00 00 00 callq 0
|
|
# COFF-x86-64: 1d: 8b 44 24 24 movl 36(%rsp), %eax
|
|
# COFF-x86-64: 21: 48 83 c4 28 addq $40, %rsp
|
|
# COFF-x86-64: 25: c3 ret
|
|
|
|
# RUN: yaml2obj --docnum=1 %s -o %t.elf-i386
|
|
# RUN: llvm-objdump -d %t.elf-i386 | FileCheck %s --check-prefix=ELF-i386
|
|
|
|
# ELF-i386: file format elf32-i386
|
|
# ELF-i386: Disassembly of section .text:
|
|
# 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 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
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_386
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
Content: 83EC0CC744240800000000C7042400000000E8FCFFFFFFE8FCFFFFFF8B44240883C40CC3
|
|
|
|
# RUN: yaml2obj --docnum=2 %s -o %t.elf-x86-64
|
|
# RUN: llvm-objdump -d %t.elf-x86-64 | FileCheck %s --check-prefix=ELF-x86-64
|
|
|
|
# ELF-x86-64: file format elf64-x86-64
|
|
# ELF-x86-64: Disassembly of section .text:
|
|
# ELF-x86-64: 0: 48 83 ec 08 subq $8, %rsp
|
|
# ELF-x86-64: 4: c7 44 24 04 00 00 00 00 movl $0, 4(%rsp)
|
|
# ELF-x86-64: c: bf 00 00 00 00 movl $0, %edi
|
|
# ELF-x86-64: 11: e8 00 00 00 00 callq 0
|
|
# ELF-x86-64: 16: 30 c0 xorb %al, %al
|
|
# ELF-x86-64: 18: e8 00 00 00 00 callq 0
|
|
# ELF-x86-64: 1d: 8b 44 24 04 movl 4(%rsp), %eax
|
|
# ELF-x86-64: 21: 48 83 c4 08 addq $8, %rsp
|
|
# ELF-x86-64: 25: c3 ret
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
|
|
Content: 4883EC08C744240400000000BF00000000E80000000030C0E8000000008B4424044883C408C3
|