Author: Alex Bradbury Date: 2023-02-27T09:14:42+01:00 New Revision: ab91ea89b60e8708e5b9b4fcfc6b94c42e8bd02b
URL: https://github.com/llvm/llvm-project/commit/ab91ea89b60e8708e5b9b4fcfc6b94c42e8bd02b DIFF: https://github.com/llvm/llvm-project/commit/ab91ea89b60e8708e5b9b4fcfc6b94c42e8bd02b.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. (cherry picked from commit 179a24c2f149933868e2a69b94200d7f4dcf18c5) 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 4d265bd045c7..5fe2c8b1c7dd 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 a8326eb92aa5..bf6a0a1861cb 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,"",@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 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits