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

Commit 6d5d4f6

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 (cherry picked from commit 6ede1c0)
1 parent 3a21b80 commit 6d5d4f6

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
@@ -6137,6 +6137,8 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
61376137
ThumbSymbolizerInfo.adrp_addr = 0;
61386138
ThumbSymbolizerInfo.adrp_inst = 0;
61396139

6140+
unsigned int Arch = MachOOF->getArch();
6141+
61406142
// Disassemble symbol by symbol.
61416143
for (unsigned SymIdx = 0; SymIdx != Symbols.size(); SymIdx++) {
61426144
ErrorOr<StringRef> SymNameOrErr = Symbols[SymIdx].getName();
@@ -6208,7 +6210,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
62086210
outs() << format("%8" PRIx64 ":", PC);
62096211
}
62106212
}
6211-
if (!NoShowRawInsn)
6213+
if (!NoShowRawInsn || Arch == Triple::arm)
62126214
outs() << "\t";
62136215

62146216
// Check the data in code table here to see if this is data not an
@@ -6241,7 +6243,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
62416243
gotInst = DisAsm->getInstruction(Inst, Size, Bytes.slice(Index), PC,
62426244
DebugOut, Annotations);
62436245
if (gotInst) {
6244-
if (!NoShowRawInsn) {
6246+
if (!NoShowRawInsn || Arch == Triple::arm) {
62456247
dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs());
62466248
}
62476249
formatted_raw_ostream FormattedOS(outs());
@@ -6311,7 +6313,7 @@ static void DisassembleMachO(StringRef Filename, MachOObjectFile *MachOOF,
63116313
outs() << format("%8" PRIx64 ":", PC);
63126314
}
63136315
}
6314-
if (!NoShowRawInsn) {
6316+
if (!NoShowRawInsn || Arch == Triple::arm) {
63156317
outs() << "\t";
63166318
dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
63176319
}

0 commit comments

Comments
 (0)