Most Arm disassemblers, including GNU objdump and Arm's own `fromelf`, emit an instruction's raw encoding as a 32-bit words or (for Thumb) one or two 16-bit halfwords, in logical order rather than according to their storage endianness. This is generally easier to read: it matches the encoding diagrams in the architecture spec, it matches the value you'd write in a `.inst` directive, and it means that fields within the instruction encoding that span more than one byte (such as branch offsets or `SVC` immediates) can be read directly in the encoding without having to mentally reverse the bytes. llvm-objdump already has a system of PrettyPrinter subclasses which makes it easy for a target to drop in its own preferred formatting. This patch adds pretty-printers for all the Arm targets, so that llvm-objdump will display Arm instruction encodings in their preferred layout instead of little-endian and bytewise. Reviewed By: DavidSpickett Differential Revision: https://reviews.llvm.org/D130358
29 lines
801 B
Plaintext
29 lines
801 B
Plaintext
# RUN: yaml2obj %s -o %t
|
|
# RUN: llvm-objdump -D --triple=thumbv8.1m.main-none-eabi %t | FileCheck %s
|
|
|
|
## This is a test case with "random" data/instructions, checking that
|
|
## llvm-objdump handles such instructions cleanly. Disassembly of instructions
|
|
## can fail when it e.g. is not given the right set of architecture features,
|
|
## for example when the source is compiled with:
|
|
##
|
|
## clang -march=..+ext1+ext2
|
|
##
|
|
## and disassembly is attempted with:
|
|
##
|
|
## llvm-objdump --mattr=+ext1
|
|
|
|
# CHECK: 00000000 <.text>:
|
|
# CHECK-NEXT: 0: f3cb 8bf7 <unknown>
|
|
# CHECK-NEXT: 4: be <unknown>
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS32
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_ARM
|
|
Sections:
|
|
- Name: .text
|
|
Type: SHT_PROGBITS
|
|
Content: "cbf3f78bbe"
|