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

Kevin Enderby via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 13:14:14 PDT 2016


Author: enderby
Date: Thu Apr 28 15:14:13 2016
New Revision: 267929

URL: http://llvm.org/viewvc/llvm-project?rev=267929&view=rev
Log:
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

Modified:
    llvm/trunk/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test
    llvm/trunk/tools/llvm-objdump/MachODump.cpp

Modified: llvm/trunk/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test?rev=267929&r1=267928&r2=267929&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test (original)
+++ llvm/trunk/test/tools/llvm-objdump/ARM/macho-symbolized-disassembly.test Thu Apr 28 15:14:13 2016
@@ -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.exe.macho-arm | FileCheck %s -check-prefix=EXE
 
-OBJ: 00000006	movw	r3, :lower16:((54-14)-4)
-OBJ: 0000000a	movt	r3, :upper16:((54-14)-4)
-OBJ: 00000024	bl	_printf
+OBJ: 00000006	40 f2 24 03 	movw	r3, :lower16:((54-14)-4)
+OBJ: 0000000a	c0 f2 00 03 	movt	r3, :upper16:((54-14)-4)
+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

Modified: llvm/trunk/tools/llvm-objdump/MachODump.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-objdump/MachODump.cpp?rev=267929&r1=267928&r2=267929&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-objdump/MachODump.cpp (original)
+++ llvm/trunk/tools/llvm-objdump/MachODump.cpp Thu Apr 28 15:14:13 2016
@@ -6215,6 +6215,8 @@ static void DisassembleMachO(StringRef F
     ThumbSymbolizerInfo.adrp_addr = 0;
     ThumbSymbolizerInfo.adrp_inst = 0;
 
+    unsigned int Arch = MachOOF->getArch();
+
     // Disassemble symbol by symbol.
     for (unsigned SymIdx = 0; SymIdx != Symbols.size(); SymIdx++) {
       Expected<StringRef> SymNameOrErr = Symbols[SymIdx].getName();
@@ -6297,7 +6299,7 @@ static void DisassembleMachO(StringRef F
             outs() << format("%8" PRIx64 ":", PC);
           }
         }
-        if (!NoShowRawInsn)
+        if (!NoShowRawInsn || Arch == Triple::arm)
           outs() << "\t";
 
         // Check the data in code table here to see if this is data not an
@@ -6330,7 +6332,7 @@ static void DisassembleMachO(StringRef F
           gotInst = DisAsm->getInstruction(Inst, Size, Bytes.slice(Index), PC,
                                            DebugOut, Annotations);
         if (gotInst) {
-          if (!NoShowRawInsn) {
+          if (!NoShowRawInsn || Arch == Triple::arm) {
             dumpBytes(makeArrayRef(Bytes.data() + Index, Size), outs());
           }
           formatted_raw_ostream FormattedOS(outs());
@@ -6400,7 +6402,7 @@ static void DisassembleMachO(StringRef F
               outs() << format("%8" PRIx64 ":", PC);
             }
           }
-          if (!NoShowRawInsn) {
+          if (!NoShowRawInsn || Arch == Triple::arm) {
             outs() << "\t";
             dumpBytes(makeArrayRef(Bytes.data() + Index, InstSize), outs());
           }




More information about the llvm-commits mailing list