forked from OSchip/llvm-project
[ARM] Fix llvm-objdump disassembly of armv7m object files.
Apparently, the features were getting mixed up, so we'd try to disassemble in ARM mode. Fix sub-architecture detection to compute the correct triple if we're detecting it automatically, so the user doesn't need to pass --triple=thumb etc. It's possible we should be somehow tying the "+thumb-mode" target feature more directly to Tag_CPU_arch_profile? But this seems to work reasonably well, anyway. While I'm here, fix up the other llvm-objdump tests that were explicitly specifying an ARM triple; that shouldn't be necessary. Differential Revision: https://reviews.llvm.org/D106912
This commit is contained in:
parent
660a56956c
commit
4adcff0b70
|
@ -538,9 +538,16 @@ void ELFObjectFileBase::setARMSubArch(Triple &TheTriple) const {
|
|||
case ARMBuildAttrs::v6K:
|
||||
Triple += "v6k";
|
||||
break;
|
||||
case ARMBuildAttrs::v7:
|
||||
Triple += "v7";
|
||||
case ARMBuildAttrs::v7: {
|
||||
Optional<unsigned> ArchProfileAttr =
|
||||
Attributes.getAttributeValue(ARMBuildAttrs::CPU_arch_profile);
|
||||
if (ArchProfileAttr.hasValue() &&
|
||||
ArchProfileAttr.getValue() == ARMBuildAttrs::MicroControllerProfile)
|
||||
Triple += "v7m";
|
||||
else
|
||||
Triple += "v7";
|
||||
break;
|
||||
}
|
||||
case ARMBuildAttrs::v6_M:
|
||||
Triple += "v6m";
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv5t-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv5t-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv5t
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv5te-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv5te-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv5te
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv5tej-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv5tej-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
bxj:
|
||||
bxj r0
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6 -mattr=+vfp2 -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6 -mattr=+vfp2 -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_FP_arch, 1 // VFP2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv6
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6 -mattr=+vfp2 -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6 -mattr=+vfp2 -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_FP_arch, 2 // VFP2
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6k-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6k-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv6k
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6m-elf -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6m-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv6m
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv6t2-elf -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv6t2-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv6t2
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv7a -mattr=+vfp3,+neon,+fp16,+hwdiv-arm,+hwdiv -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv7a -mattr=+vfp3,+neon,+fp16,+hwdiv-arm,+hwdiv -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s --check-prefix=CHECK-THUMB
|
||||
@ RUN: llvm-mc < %s -triple armv7a -mattr=+vfp3,+neon,+fp16,+hwdiv-arm,+hwdiv -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_FP_arch, 0 // disallow vfp
|
||||
|
||||
|
@ -15,6 +14,7 @@ vfp3:
|
|||
|
||||
@CHECK-LABEL: vfp3
|
||||
@CHECK-NOT: 00 0a b6 ee vmov.f32 s0, #5.000000e-01
|
||||
@CHECK: unknown
|
||||
|
||||
neon:
|
||||
vmla.f32 d0, d1, d2
|
||||
|
@ -28,6 +28,7 @@ fp16:
|
|||
|
||||
@CHECK-LABEL: fp16
|
||||
@CHECK-NOT: 02 07 b6 f3 vcvt.f32.f16 q0, d2
|
||||
@CHECK: unknown
|
||||
|
||||
div_arm:
|
||||
udiv r0, r1, r2
|
||||
|
@ -41,4 +42,5 @@ div_thumb:
|
|||
udiv r0, r1, r2
|
||||
|
||||
@CHECK-LABEL: div_thumb
|
||||
@CHECK-THUMB-NOT: b1 fb f2 f0 udiv r0, r1, r2
|
||||
@CHECK-NOT: b1 fb f2 f0 udiv r0, r1, r2
|
||||
@CHECK: unknown
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv7a -mattr=+vfp3,+neon,+fp16,+hwdiv-arm -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv7a -mattr=+vfp3,+neon,+fp16,+hwdiv-arm -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_FP_arch, 3 // VFP3
|
||||
.eabi_attribute Tag_Advanced_SIMD_arch, 2 // SIMDv1 with fp16
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv7m -mattr=+vfp4 -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv7m -mattr=+vfp4 -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_CPU_arch, 10 // v7
|
||||
.eabi_attribute Tag_FP_arch, 0 // VFP4
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv7m-elf -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv7m-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv7m
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv7m -mattr=+vfp4 -filetype=obj | llvm-objdump --triple=thumb -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv7m -mattr=+vfp4 -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_CPU_arch, 10 // v7
|
||||
.eabi_attribute Tag_CPU_arch_profile, 0x4D // 'M' profile
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv8a-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv8a-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.arch armv8a
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
@ RUN: llvm-mc < %s -triple armv8r-elf -filetype=obj | llvm-objdump --triple=arm -d - | FileCheck %s
|
||||
@ RUN: llvm-mc < %s -triple armv8r-elf -filetype=obj | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.eabi_attribute Tag_CPU_arch, 15 // v8_R
|
||||
.eabi_attribute Tag_CPU_arch_profile, 0x52 // 'R' profile
|
||||
|
|
Loading…
Reference in New Issue