Update llvm-objdump for disassembly of ARM Mach-O files to always include the opcode bytes.

As this is the expected behavior of the old darwin otool(1) for ARM Mach-O files.

rdar://25896249


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@267929 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Kevin Enderby 2016-04-28 20:14:13 +00:00
parent 5515858465
commit 6ede1c09ad
2 changed files with 9 additions and 7 deletions

View File

@ -1,8 +1,8 @@
// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.obj.macho-arm | FileCheck %s -check-prefix=OBJ // RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.obj.macho-arm | FileCheck %s -check-prefix=OBJ
// RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.exe.macho-arm | FileCheck %s -check-prefix=EXE // RUN: llvm-objdump -d -m -no-show-raw-insn -full-leading-addr -print-imm-hex %p/Inputs/hello.exe.macho-arm | FileCheck %s -check-prefix=EXE
OBJ: 00000006 movw r3, :lower16:((54-14)-4) OBJ: 00000006 40 f2 24 03 movw r3, :lower16:((54-14)-4)
OBJ: 0000000a movt r3, :upper16:((54-14)-4) OBJ: 0000000a c0 f2 00 03 movt r3, :upper16:((54-14)-4)
OBJ: 00000024 bl _printf OBJ: 00000024 ff f7 ec ff bl _printf
EXE: 0000bfa8 blx 0xbffc @ symbol stub for: _printf EXE: 0000bfa8 00 f0 28 e8 blx 0xbffc @ symbol stub for: _printf

View File

@ -6215,6 +6215,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
ThumbSymbolizerInfo.adrp_addr = 0; ThumbSymbolizerInfo.adrp_addr = 0;
ThumbSymbolizerInfo.adrp_inst = 0; ThumbSymbolizerInfo.adrp_inst = 0;
unsigned int Arch = MachOOF->getArch();
// Disassemble symbol by symbol. // Disassemble symbol by symbol.
for (unsigned SymIdx = 0; SymIdx != Symbols.size(); SymIdx++) { for (unsigned SymIdx = 0; SymIdx != Symbols.size(); SymIdx++) {
Expected<StringRef> SymNameOrErr = Symbols[SymIdx].getName(); Expected<StringRef> SymNameOrErr = Symbols[SymIdx].getName();
@ -6297,7 +6299,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
outs() << format("%8" PRIx64 ":", PC); outs() << format("%8" PRIx64 ":", PC);
} }
} }
if (!NoShowRawInsn) if (!NoShowRawInsn || Arch == Triple::arm)
outs() << "\t"; outs() << "\t";
// Check the data in code table here to see if this is data not an // Check the data in code table here to see if this is data not an
@ -6330,7 +6332,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
gotInst = DisAsm->getInstruction(Inst, Size, Bytes.slice(Index), PC, gotInst = DisAsm->getInstruction(Inst, Size, Bytes.slice(Index), PC,
DebugOut, Annotations); DebugOut, Annotations);
if (gotInst) { if (gotInst) {
if (!NoShowRawInsn) { if (!NoShowRawInsn || Arch == Triple::arm) {
dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs()); dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs());
} }
formatted_raw_ostream FormattedOS(outs()); formatted_raw_ostream FormattedOS(outs());
@ -6400,7 +6402,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
outs() << format("%8" PRIx64 ":", PC); outs() << format("%8" PRIx64 ":", PC);
} }
} }
if (!NoShowRawInsn) { if (!NoShowRawInsn || Arch == Triple::arm) {
outs() << "\t"; outs() << "\t";
dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs()); dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
} }