[PATCH] D146114: [RISCV] Allow llvm-objdump to disassemble objects with unrecognised versions of known extensions
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 26 20:40:11 PDT 2023
This revision was automatically updated to reflect the committed changes.
Closed by commit rG91c6174ce359: [RISCV] Allow llvm-objdump to disassemble objects with unrecognised versions of… (authored by asb).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146114/new/
https://reviews.llvm.org/D146114
Files:
llvm/lib/Object/ELFObjectFile.cpp
llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s
Index: llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s
===================================================================
--- llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s
+++ llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s
@@ -1,10 +1,10 @@
# RUN: rm -rf %t && split-file %s %t && cd %t
# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+m,+f,+d,+v noncanonicalized_arch.s -o noncanonicalized_arch.o
-# RUN: llvm-objdump -d noncanonicalized_arch.o | FileCheck %s --check-prefix=NONCANON
+# RUN: not llvm-objdump -d noncanonicalized_arch.o 2>&1 | FileCheck %s -DFILE=noncanonicalized_arch.o --check-prefix=NONCANON
# RUN: llvm-mc -filetype=obj -triple=riscv64 invalid_arch.s -o invalid_arch.o
-# RUN: not llvm-objdump -d invalid_arch.o 2>&1 | FileCheck %s --check-prefix=INVALID
+# RUN: not llvm-objdump -d invalid_arch.o 2>&1 | FileCheck %s -DFILE=invalid_arch.o --check-prefix=INVALID
# RUN: llvm-mc -filetype=obj -triple=riscv32 unknown_i_version.s -o unknown_i_version.o
# RUN: llvm-objdump -d unknown_i_version.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN-I-VERSION
@@ -16,7 +16,8 @@
# RUN: llvm-objdump -d unknown_ext_name.o 2>&1 | FileCheck %s --check-prefix=UNKNOWN-EXT-NAME
#--- noncanonicalized_arch.s
-# NONCANON: vsetvli a3, a2, e8, m8, tu, mu
+# NONCANON: error: '[[FILE]]': arch string must begin with valid base ISA
+# NONCANON-NOT: {{.}}
vsetvli a3, a2, e8, m8, tu, mu
.section .riscv.attributes,"", at 0x70000003
@@ -31,7 +32,8 @@
.Lend:
#--- invalid_arch.s
-# INVALID: string must begin with rv32{i,e,g} or rv64{i,e,g}
+# INVALID: error: '[[FILE]]': arch string must begin with valid base ISA
+# INVALID-NOT: {{.}}
nop
.section .riscv.attributes,"", at 0x70000003
@@ -61,7 +63,7 @@
.Lend:
#--- unknown_ext_version.s
-# UNKNOWN-EXT-VERSION: <unknown>
+# UNKNOWN-EXT-VERSION: cbo.clean (t0)
cbo.clean (t0)
.section .riscv.attributes,"", at 0x70000003
Index: llvm/lib/Object/ELFObjectFile.cpp
===================================================================
--- llvm/lib/Object/ELFObjectFile.cpp
+++ llvm/lib/Object/ELFObjectFile.cpp
@@ -303,12 +303,7 @@
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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D146114.508467.patch
Type: text/x-patch
Size: 2756 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230327/798b3a07/attachment.bin>
More information about the llvm-commits
mailing list