Skip to content

Commit

Permalink
Fix llvm-objdump so it picks a good CPU based for Mach-O files
Browse files Browse the repository at this point in the history
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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@292993 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
enderby committed Jan 24, 2017
1 parent adb0ce8 commit 61fed38
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/Object/MachOObjectFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2454,6 +2454,8 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
*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");
Expand All @@ -2464,6 +2466,8 @@ Triple MachOObjectFile::getArchTriple(uint32_t CPUType, uint32_t CPUSubType,
*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");
Expand Down
Binary file added test/tools/llvm-objdump/ARM/Inputs/divs.macho-armv7s
Binary file not shown.
3 changes: 3 additions & 0 deletions test/tools/llvm-objdump/ARM/macho-nomcpu-armv7s.test
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 61fed38

Please sign in to comment.