Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 6ede1c0

Browse files
committed
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
1 parent 5515858 commit 6ede1c0

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// 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
22
// 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
33

4-
OBJ: 00000006 movw r3, :lower16:((54-14)-4)
5-
OBJ: 0000000a movt r3, :upper16:((54-14)-4)
6-
OBJ: 00000024 bl _printf
4+
OBJ: 00000006 40 f2 24 03 movw r3, :lower16:((54-14)-4)
5+
OBJ: 0000000a c0 f2 00 03 movt r3, :upper16:((54-14)-4)
6+
OBJ: 00000024 ff f7 ec ff bl _printf
77

8-
EXE: 0000bfa8 blx 0xbffc @ symbol stub for: _printf
8+
EXE: 0000bfa8 00 f0 28 e8 blx 0xbffc @ symbol stub for: _printf

tools/llvm-objdump/MachODump.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6215,6 +6215,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
62156215
ThumbSymbolizerInfo.adrp_addr = 0;
62166216
ThumbSymbolizerInfo.adrp_inst = 0;
62176217

6218+
unsigned int Arch = MachOOF->getArch();
6219+
62186220
// Disassemble symbol by symbol.
62196221
for (unsigned SymIdx = 0; SymIdx != Symbols.size(); SymIdx++) {
62206222
Expected<StringRef> SymNameOrErr = Symbols[SymIdx].getName();
@@ -6297,7 +6299,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
62976299
outs() << format("%8" PRIx64 ":", PC);
62986300
}
62996301
}
6300-
if (!NoShowRawInsn)
6302+
if (!NoShowRawInsn || Arch == Triple::arm)
63016303
outs() << "\t";
63026304

63036305
// 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,
63306332
gotInst = DisAsm->getInstruction(Inst, Size, Bytes.slice(Index), PC,
63316333
DebugOut, Annotations);
63326334
if (gotInst) {
6333-
if (!NoShowRawInsn) {
6335+
if (!NoShowRawInsn || Arch == Triple::arm) {
63346336
dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs());
63356337
}
63366338
formatted_raw_ostream FormattedOS(outs());
@@ -6400,7 +6402,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
64006402
outs() << format("%8" PRIx64 ":", PC);
64016403
}
64026404
}
6403-
if (!NoShowRawInsn) {
6405+
if (!NoShowRawInsn || Arch == Triple::arm) {
64046406
outs() << "\t";
64056407
dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
64066408
}

0 commit comments

Comments
 (0)