aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Object/ELFObjectFile.cpp
diff options
context:
space:
mode:
authorAlex Bradbury <asb@igalia.com>2023-03-27 04:38:16 +0100
committerAlex Bradbury <asb@igalia.com>2023-03-27 04:38:16 +0100
commit91c6174ce35969d7f0d73c645fa47b813e0d99d3 (patch)
tree7e79be8a2d079cd9a410f92fdc4d4e32dbdb6826 /llvm/lib/Object/ELFObjectFile.cpp
parent062065888f645bbe6a8eec99ba58487a539afd62 (diff)
downloadllvm-91c6174ce35969d7f0d73c645fa47b813e0d99d3.zip
llvm-91c6174ce35969d7f0d73c645fa47b813e0d99d3.tar.gz
llvm-91c6174ce35969d7f0d73c645fa47b813e0d99d3.tar.bz2
[RISCV] Allow llvm-objdump to disassemble objects with unrecognised versions of known extensions
This Moves ELFObjectFile to using RISCVISAInfo::parseNormalizedArchString which is not an NFC, as the test changes show. D144353 transitioned LLD to using this function, which is specialised to parsing arch strings in the normalised format specified in the psABI rather than user-authored strings accepted in `-march`, which has greater flexibility. parseNormalizedArchString does not ignore or produce an error for ISA extensions with a version that isn't recognised/supported by LLVM. As current GCC is marking its objects with a higher version of the A, F, and D extensions than LLVM (see [extension versioning discussion](https://discourse.llvm.org/t/rfc-resolving-issues-related-to-extension-versioning-in-risc-v/68472) this massively improves the usability of llvm-objdump with such binaries. Differential Revision: https://reviews.llvm.org/D146114
Diffstat (limited to 'llvm/lib/Object/ELFObjectFile.cpp')
-rw-r--r--llvm/lib/Object/ELFObjectFile.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp
index b9343d6..8149df5 100644
--- a/llvm/lib/Object/ELFObjectFile.cpp
+++ b/llvm/lib/Object/ELFObjectFile.cpp
@@ -303,12 +303,7 @@ Expected<SubtargetFeatures> ELFObjectFileBase::getRISCVFeatures() const {
std::optional<StringRef> Attr =
Attributes.getAttributeString(RISCVAttrs::ARCH);
if (Attr) {
- // Suppress version checking for experimental extensions to prevent erroring
- // when getting any unknown version of experimental extension.
- auto ParseResult = RISCVISAInfo::parseArchString(
- *Attr, /*EnableExperimentalExtension=*/true,
- /*ExperimentalExtensionVersionCheck=*/false,
- /*IgnoreUnknown=*/true);
+ auto ParseResult = RISCVISAInfo::parseNormalizedArchString(*Attr);
if (!ParseResult)
return ParseResult.takeError();
auto &ISAInfo = *ParseResult;