[llvm] r292993 - Fix llvm-objdump so it picks a good CPU based for Mach-O files

Kevin Enderby via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 24 15:41:04 PST 2017


Author: enderby
Date: Tue Jan 24 17:41:04 2017
New Revision: 292993

URL: http://llvm.org/viewvc/llvm-project?rev=292993&view=rev
Log:
Fix llvm-objdump so it picks a good CPU based for Mach-O files
for CPU_SUBTYPE_ARM_V7S and CPU_SUBTYPE_ARM_V7K.

For these two cpusubtypes they should default to a cortex-a7 CPU
to give proper disassembly without a -mcpu= flag.

rdar://27431703

Added:
    llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/divs.macho-armv7s   (with props)
    llvm/trunk/test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test
Modified:
    llvm/trunk/lib/Object/MachOObjectFile.cpp

Modified: llvm/trunk/lib/Object/MachOObjectFile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/MachOObjectFile.cpp?rev=292993&r1=292992&r2=292993&view=diff
==============================================================================
--- llvm/trunk/lib/Object/MachOObjectFile.cpp (original)
+++ llvm/trunk/lib/Object/MachOObjectFile.cpp Tue Jan 24 17:41:04 2017
@@ -2454,6 +2454,8 @@ Triple MachOObjectFile::getArchTriple(ui
         *ArchFlag = "armv7em";
       return Triple("thumbv7em-apple-darwin");
     case MachO::CPU_SUBTYPE_ARM_V7K:
+      if (McpuDefault)
+        *McpuDefault = "cortex-a7";
       if (ArchFlag)
         *ArchFlag = "armv7k";
       return Triple("armv7k-apple-darwin");
@@ -2464,6 +2466,8 @@ Triple MachOObjectFile::getArchTriple(ui
         *ArchFlag = "armv7m";
       return Triple("thumbv7m-apple-darwin");
     case MachO::CPU_SUBTYPE_ARM_V7S:
+      if (McpuDefault)
+        *McpuDefault = "cortex-a7";
       if (ArchFlag)
         *ArchFlag = "armv7s";
       return Triple("armv7s-apple-darwin");

Added: llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/divs.macho-armv7s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/divs.macho-armv7s?rev=292993&view=auto
==============================================================================
Binary file - no diff available.

Propchange: llvm/trunk/test/tools/llvm-objdump/ARM/Inputs/divs.macho-armv7s
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: llvm/trunk/test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test?rev=292993&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test (added)
+++ llvm/trunk/test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test Tue Jan 24 17:41:04 2017
@@ -0,0 +1,3 @@
+@ RUN: llvm-objdump -m -d %p/Inputs/divs.macho-armv7s | FileCheck %s
+
+@ CHECK: 10 f0 10 e7 sdiv r0, r0, r0




More information about the llvm-commits mailing list