diff options
author | Eli Friedman <efriedma@quicinc.com> | 2021-07-27 12:55:37 -0700 |
---|---|---|
committer | Eli Friedman <efriedma@quicinc.com> | 2021-07-28 11:41:54 -0700 |
commit | 4adcff0b7004dc3c81fb8b1104044a188db8aa89 (patch) | |
tree | cefca65a601dcfc0e6e97cb8952a705577eabcb8 /llvm/lib/Object/ELFObjectFile.cpp | |
parent | 660a56956c32b0bcd850fc12fa8ad0225a6bb880 (diff) | |
download | llvm-4adcff0b7004dc3c81fb8b1104044a188db8aa89.zip llvm-4adcff0b7004dc3c81fb8b1104044a188db8aa89.tar.gz llvm-4adcff0b7004dc3c81fb8b1104044a188db8aa89.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index 6613d79..9efb28c 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -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; |