Index: llvm/lib/Object/ELFObjectFile.cpp =================================================================== --- llvm/lib/Object/ELFObjectFile.cpp +++ 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; 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,7 +1,7 @@ # 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 --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 @@ -16,7 +16,7 @@ # 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: arch string must begin with valid base ISA vsetvli a3, a2, e8, m8, tu, mu .section .riscv.attributes,"",@0x70000003 @@ -31,7 +31,7 @@ .Lend: #--- invalid_arch.s -# INVALID: string must begin with rv32{i,e,g} or rv64{i,g} +# INVALID: arch string must begin with valid base ISA nop .section .riscv.attributes,"",@0x70000003 @@ -61,7 +61,7 @@ .Lend: #--- unknown_ext_version.s -# UNKNOWN-EXT-VERSION: +# UNKNOWN-EXT-VERSION: cbo.clean (t0) cbo.clean (t0) .section .riscv.attributes,"",@0x70000003