diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -303,12 +303,7 @@ std::optional 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; diff --git a/llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s b/llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s --- a/llvm/test/tools/llvm-objdump/ELF/RISCV/riscv-attributes.s +++ b/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,"",@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,"",@0x70000003 @@ -61,7 +63,7 @@ .Lend: #--- unknown_ext_version.s -# UNKNOWN-EXT-VERSION: +# UNKNOWN-EXT-VERSION: cbo.clean (t0) cbo.clean (t0) .section .riscv.attributes,"",@0x70000003