From f310e62b77199c295a280b492996ce8a883e4bd9 Mon Sep 17 00:00:00 2001 From: Kevin Enderby Date: Thu, 21 Sep 2017 21:45:02 +0000 Subject: Fix a bug in llvm-objdump when disassembling using the wrong default CPU in the second slice of a Mach-O universal file. The code in llvm-objdump in in DisassembleMachO() was getting the default CPU then incorrectly setting into the global variable used for the -mcpu option if that was not set. This caused a second call to DisassembleMachO() to use the wrong default CPU when disassembling the next slice in a Mach-O universal file. And would result in bad disassembly and an error message about an recognized processor for the target: % llvm-objdump -d -m -arch all fat.macho-armv7s-arm64 fat.macho-armv7s-arm64 (architecture armv7s): (__TEXT,__text) section armv7: 0: 60 47 bx r12 fat.macho-armv7s-arm64 (architecture arm64): 'cortex-a7' is not a recognized processor for this target (ignoring processor) 'cortex-a7' is not a recognized processor for this target (ignoring processor) (__TEXT,__text) section ___multc3: 0: .long 0x1e620810 rdar://34439149 llvm-svn: 313921 --- .../llvm-objdump/AArch64/Inputs/fat.macho-armv7s-arm64 | Bin 0 -> 33112 bytes .../llvm-objdump/AArch64/macho-fat-arm-disasm.test | 6 ++++++ 2 files changed, 6 insertions(+) create mode 100644 llvm/test/tools/llvm-objdump/AArch64/Inputs/fat.macho-armv7s-arm64 create mode 100644 llvm/test/tools/llvm-objdump/AArch64/macho-fat-arm-disasm.test (limited to 'llvm/test/tools/llvm-objdump/AArch64') diff --git a/llvm/test/tools/llvm-objdump/AArch64/Inputs/fat.macho-armv7s-arm64 b/llvm/test/tools/llvm-objdump/AArch64/Inputs/fat.macho-armv7s-arm64 new file mode 100644 index 00000000000..5a61a78247a Binary files /dev/null and b/llvm/test/tools/llvm-objdump/AArch64/Inputs/fat.macho-armv7s-arm64 differ diff --git a/llvm/test/tools/llvm-objdump/AArch64/macho-fat-arm-disasm.test b/llvm/test/tools/llvm-objdump/AArch64/macho-fat-arm-disasm.test new file mode 100644 index 00000000000..69ff25436b6 --- /dev/null +++ b/llvm/test/tools/llvm-objdump/AArch64/macho-fat-arm-disasm.test @@ -0,0 +1,6 @@ +RUN: llvm-objdump -d -m -no-show-raw-insn -arch all %p/Inputs/fat.macho-armv7s-arm64 | FileCheck %s + +CHECK: (architecture armv7s): +CHECK: bx r12 +CHECK: (architecture arm64): +CHECK: fmul d16, d0, d2 -- cgit v1.2.3