[lld] 179a24c - [lld][test][RISCV] Don't use incorrectly normalised arch string in riscv-attributes-place.s
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 19 11:18:03 PST 2023
Author: Alex Bradbury
Date: 2023-02-19T19:15:32Z
New Revision: 179a24c2f149933868e2a69b94200d7f4dcf18c5
URL: https://github.com/llvm/llvm-project/commit/179a24c2f149933868e2a69b94200d7f4dcf18c5
DIFF: https://github.com/llvm/llvm-project/commit/179a24c2f149933868e2a69b94200d7f4dcf18c5.diff
LOG: [lld][test][RISCV] Don't use incorrectly normalised arch string in riscv-attributes-place.s
Per the psABI, the arch string should be normalised to (amongest other
things) always include the full version of each extension in form
zfoo1p0. riscv-attributes-place.s didn't conform to this, which is not a
problem for the current parsing logic, but this behaviour would change
with a patch I'm about to propose.
This makes riscv-sttributes-place.s feature a valid arch string, and
maintains test coverage for this particular form of invalid arch string
by adding it to riscv-attributes.s.
Added:
Modified:
lld/test/ELF/riscv-attributes-place.s
lld/test/ELF/riscv-attributes.s
Removed:
################################################################################
diff --git a/lld/test/ELF/riscv-attributes-place.s b/lld/test/ELF/riscv-attributes-place.s
index 4d265bd045c71..5fe2c8b1c7ddd 100644
--- a/lld/test/ELF/riscv-attributes-place.s
+++ b/lld/test/ELF/riscv-attributes-place.s
@@ -22,7 +22,7 @@
.byte 1 # Tag_File
.long .Lend-.Lbegin
.byte 5 # Tag_RISCV_arch
-.asciz "rv64i2"
+.asciz "rv64i2p0"
.Lend:
.section .riscv.b,""
diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s
index a8326eb92aa51..bf6a0a1861cb6 100644
--- a/lld/test/ELF/riscv-attributes.s
+++ b/lld/test/ELF/riscv-attributes.s
@@ -26,6 +26,10 @@
# 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'
+# RUN: llvm-mc -filetype=obj -triple=riscv64 invalid_arch1.s -o invalid_arch1.o
+# RUN: ld.lld -e 0 invalid_arch1.o -o invalid_arch1
+# RUN: llvm-readobj --arch-specific invalid_arch1 | FileCheck %s --check-prefix=INVALID_ARCH1
+
## A zero value attribute is not printed.
# RUN: llvm-mc -filetype=obj -triple=riscv64 unaligned_access_0.s -o unaligned_access_0.o
# RUN: ld.lld -e 0 --fatal-warnings a.o unaligned_access_0.o -o unaligned_access_0
@@ -171,6 +175,34 @@
.asciz "rv64i99p0"
.Lend:
+#--- invalid_arch1.s
+# INVALID_ARCH1: BuildAttributes {
+# INVALID_ARCH1-NEXT: FormatVersion: 0x41
+# INVALID_ARCH1-NEXT: Section 1 {
+# INVALID_ARCH1-NEXT: SectionLength: 25
+# INVALID_ARCH1-NEXT: Vendor: riscv
+# INVALID_ARCH1-NEXT: Tag: Tag_File (0x1)
+# INVALID_ARCH1-NEXT: Size: 15
+# INVALID_ARCH1-NEXT: FileAttributes {
+# INVALID_ARCH1-NEXT: Attribute {
+# INVALID_ARCH1-NEXT: Tag: 5
+# INVALID_ARCH1-NEXT: TagName: arch
+# INVALID_ARCH1-NEXT: Value: rv64i2p0
+# INVALID_ARCH1-NEXT: }
+# INVALID_ARCH1-NEXT: }
+# INVALID_ARCH1-NEXT: }
+# INVALID_ARCH1-NEXT: }
+.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 "rv64i2"
+.Lend:
+
#--- unaligned_access_0.s
.attribute unaligned_access, 0
More information about the llvm-commits
mailing list