[lld] 8b50048 - [lld][RISCV][test] Expand testing in riscv-attributes.s

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 15 06:03:58 PST 2023


Author: Alex Bradbury
Date: 2023-02-15T14:00:54Z
New Revision: 8b5004864aab71859e961af02eb1a5ceeae887f7

URL: https://github.com/llvm/llvm-project/commit/8b5004864aab71859e961af02eb1a5ceeae887f7
DIFF: https://github.com/llvm/llvm-project/commit/8b5004864aab71859e961af02eb1a5ceeae887f7.diff

LOG: [lld][RISCV][test] Expand testing in riscv-attributes.s

This patch is related to the discussion in
<https://discourse.llvm.org/t/rfc-resolving-issues-related-to-extension-versioning-in-risc-v/68472/1>.
It slightly expands the coverage of behaviour for unrecognized
extensions (there are slightly different forms of error for zfoo vs e.g.
'y'), and adds coverage for an extension with an
unrecognized/unsupported version number.

Use "unrecognized" terminology because the expectation is the error
checking will be reduced in a follow-up patch posted for review.

Added: 
    

Modified: 
    lld/test/ELF/riscv-attributes.s

Removed: 
    


################################################################################
diff  --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index 3776673c5f142..a8326eb92aa51 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -14,9 +14,17 @@
 # RUN: ld.lld a.o b.o c.o -o out2
 # RUN: llvm-readobj --arch-specific out2 | FileCheck %s --check-prefix=CHECK2
 
-# RUN: llvm-mc -filetype=obj -triple=riscv64 invalid_ext.s -o invalid_ext.o
-# RUN: not ld.lld invalid_ext.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=INVALID_EXT --implicit-check-not=error:
-# INVALID_EXT: error: invalid_ext.o:(.riscv.attributes): rv64i2p0_y2p0: invalid standard user-level extension 'y'
+# RUN: llvm-mc -filetype=obj -triple=riscv64 unrecognized_ext1.s -o unrecognized_ext1.o
+# RUN: not ld.lld unrecognized_ext1.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNRECOGNIZED_EXT1 --implicit-check-not=error:
+# UNRECOGNIZED_EXT1: error: unrecognized_ext1.o:(.riscv.attributes): rv64i2p0_y2p0: invalid standard user-level extension 'y'
+
+# RUN: llvm-mc -filetype=obj -triple=riscv64 unrecognized_ext2.s -o unrecognized_ext2.o
+# RUN: not ld.lld unrecognized_ext2.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNRECOGNIZED_EXT2 --implicit-check-not=error:
+# UNRECOGNIZED_EXT2: error: unrecognized_ext2.o:(.riscv.attributes): rv64i2p0_zmadeup1p0: unsupported version number 1.0 for extension 'zmadeup'
+
+# RUN: llvm-mc -filetype=obj -triple=riscv64 unrecognized_version.s -o unrecognized_version.o
+# RUN: not ld.lld unrecognized_version.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=UNRECOGNIZED_VERSION --implicit-check-not=error:
+# UNRECOGNIZED_VERSION: error: unrecognized_version.o:(.riscv.attributes): rv64i99p0: unsupported version number 99.0 for extension 'i'
 
 ## A zero value attribute is not printed.
 # RUN: llvm-mc -filetype=obj -triple=riscv64 unaligned_access_0.s -o unaligned_access_0.o
@@ -127,7 +135,7 @@
 .attribute priv_spec, 2
 .attribute priv_spec_minor, 2
 
-#--- invalid_ext.s
+#--- unrecognized_ext1.s
 .section .riscv.attributes,"", at 0x70000003
 .byte 0x41
 .long .Lend-.riscv.attributes-1
@@ -139,6 +147,30 @@
 .asciz "rv64i2p0_y2p0"
 .Lend:
 
+#--- unrecognized_ext2.s
+.section .riscv.attributes,"", at 0x70000003
+.byte 0x41
+.long .Lend-.riscv.attributes-1
+.asciz "riscv"  # vendor
+.Lbegin:
+.byte 1  # Tag_File
+.long .Lend-.Lbegin
+.byte 5  # Tag_RISCV_arch
+.asciz "rv64i2p0_zmadeup1p0"
+.Lend:
+
+#--- unrecognized_version.s
+.section .riscv.attributes,"", at 0x70000003
+.byte 0x41
+.long .Lend-.riscv.attributes-1
+.asciz "riscv"  # vendor
+.Lbegin:
+.byte 1  # Tag_File
+.long .Lend-.Lbegin
+.byte 5  # Tag_RISCV_arch
+.asciz "rv64i99p0"
+.Lend:
+
 #--- unaligned_access_0.s
 .attribute unaligned_access, 0
 


        


More information about the llvm-commits mailing list