diff --git a/lld/ELF/Arch/RISCV.cpp b/lld/ELF/Arch/RISCV.cpp --- a/lld/ELF/Arch/RISCV.cpp +++ b/lld/ELF/Arch/RISCV.cpp @@ -964,16 +964,13 @@ } continue; - // Attributes which use the default handling. - case RISCVAttrs::PRIV_SPEC: - case RISCVAttrs::PRIV_SPEC_MINOR: - case RISCVAttrs::PRIV_SPEC_REVISION: + default: break; } - // Fallback for deprecated priv_spec* and other unknown attributes: retain - // the attribute if all input sections agree on the value. GNU ld uses 0 - // and empty strings as default values which are not dumped to the output. + // Fallback for other unknown attributes: retain the attribute if all + // input sections agree on the value. GNU ld uses 0 and empty strings + // as default values which are not dumped to the output. // TODO Adjust after resolution to // https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/352 if (tag.attr % 2 == 0) { diff --git a/lld/test/ELF/riscv-attributes.s b/lld/test/ELF/riscv-attributes.s --- a/lld/test/ELF/riscv-attributes.s +++ b/lld/test/ELF/riscv-attributes.s @@ -44,12 +44,6 @@ # RUN: not ld.lld a.o b.o c.o diff_stack_align.o -o /dev/null 2>&1 | FileCheck %s --check-prefix=STACK_ALIGN --implicit-check-not=error: # STACK_ALIGN: error: diff_stack_align.o:(.riscv.attributes) has stack_align=32 but a.o:(.riscv.attributes) has stack_align=16 -## The deprecated priv_spec is not handled as GNU ld does. -## Differing priv_spec attributes lead to an absent attribute. -# RUN: llvm-mc -filetype=obj -triple=riscv64 diff_priv_spec.s -o diff_priv_spec.o -# RUN: ld.lld -e 0 --fatal-warnings a.o b.o c.o diff_priv_spec.o -o diff_priv_spec -# RUN: llvm-readobj -A diff_priv_spec | FileCheck /dev/null --implicit-check-not='TagName: priv_spec' - ## Unknown tags currently lead to warnings. # RUN: llvm-mc -filetype=obj -triple=riscv64 unknown13.s -o unknown13.o # RUN: llvm-mc -filetype=obj -triple=riscv64 unknown13a.s -o unknown13a.o @@ -115,16 +109,6 @@ # CHECK2-NEXT: Description: Unaligned access # CHECK2-NEXT: } # CHECK2-NEXT: Attribute { -# CHECK2-NEXT: Tag: 8 -# CHECK2-NEXT: TagName: priv_spec -# CHECK2-NEXT: Value: 2 -# CHECK2-NEXT: } -# CHECK2-NEXT: Attribute { -# CHECK2-NEXT: Tag: 10 -# CHECK2-NEXT: TagName: priv_spec_minor -# CHECK2-NEXT: Value: 2 -# CHECK2-NEXT: } -# CHECK2-NEXT: Attribute { # CHECK2-NEXT: Tag: 5 # CHECK2-NEXT: TagName: arch # CHECK2-NEXT: Value: rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_zicsr2p0_zkt1p0_zve32f1p0_zve32x1p0_zvl32b1p0{{$}} @@ -158,15 +142,11 @@ #--- b.s .attribute stack_align, 16 .attribute arch, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0" -.attribute priv_spec, 2 -.attribute priv_spec_minor, 2 #--- c.s .attribute stack_align, 16 .attribute arch, "rv64i2p1_f2p2_zkt1p0_zve32f1p0_zve32x1p0_zvl32b1p0" .attribute unaligned_access, 1 -.attribute priv_spec, 2 -.attribute priv_spec_minor, 2 #--- unrecognized_ext1.s # UNRECOGNIZED_EXT1: BuildAttributes { @@ -282,10 +262,6 @@ #--- diff_stack_align.s .attribute stack_align, 32 -#--- diff_priv_spec.s -.attribute priv_spec, 3 -.attribute priv_spec_minor, 3 - #--- unknown13.s .attribute 13, "0" #--- unknown13a.s diff --git a/llvm/include/llvm/Support/RISCVAttributes.h b/llvm/include/llvm/Support/RISCVAttributes.h --- a/llvm/include/llvm/Support/RISCVAttributes.h +++ b/llvm/include/llvm/Support/RISCVAttributes.h @@ -29,9 +29,6 @@ STACK_ALIGN = 4, ARCH = 5, UNALIGNED_ACCESS = 6, - PRIV_SPEC = 8, - PRIV_SPEC_MINOR = 10, - PRIV_SPEC_REVISION = 12, }; enum StackAlign { ALIGN_4 = 4, ALIGN_16 = 16 }; diff --git a/llvm/lib/Support/RISCVAttributeParser.cpp b/llvm/lib/Support/RISCVAttributeParser.cpp --- a/llvm/lib/Support/RISCVAttributeParser.cpp +++ b/llvm/lib/Support/RISCVAttributeParser.cpp @@ -17,18 +17,6 @@ RISCVAttrs::ARCH, &ELFAttributeParser::stringAttribute, }, - { - RISCVAttrs::PRIV_SPEC, - &ELFAttributeParser::integerAttribute, - }, - { - RISCVAttrs::PRIV_SPEC_MINOR, - &ELFAttributeParser::integerAttribute, - }, - { - RISCVAttrs::PRIV_SPEC_REVISION, - &ELFAttributeParser::integerAttribute, - }, { RISCVAttrs::STACK_ALIGN, &RISCVAttributeParser::stackAlign, diff --git a/llvm/lib/Support/RISCVAttributes.cpp b/llvm/lib/Support/RISCVAttributes.cpp --- a/llvm/lib/Support/RISCVAttributes.cpp +++ b/llvm/lib/Support/RISCVAttributes.cpp @@ -15,9 +15,6 @@ {STACK_ALIGN, "Tag_stack_align"}, {ARCH, "Tag_arch"}, {UNALIGNED_ACCESS, "Tag_unaligned_access"}, - {PRIV_SPEC, "Tag_priv_spec"}, - {PRIV_SPEC_MINOR, "Tag_priv_spec_minor"}, - {PRIV_SPEC_REVISION, "Tag_priv_spec_revision"}, }; constexpr TagNameMap RISCVAttributeTags{tagData}; diff --git a/llvm/test/MC/RISCV/attribute.s b/llvm/test/MC/RISCV/attribute.s --- a/llvm/test/MC/RISCV/attribute.s +++ b/llvm/test/MC/RISCV/attribute.s @@ -15,12 +15,3 @@ .attribute unaligned_access, 0 # CHECK: attribute 6, 0 - -.attribute priv_spec, 2 -# CHECK: attribute 8, 2 - -.attribute priv_spec_minor, 0 -# CHECK: attribute 10, 0 - -.attribute priv_spec_revision, 0 -# CHECK: attribute 12, 0 diff --git a/llvm/test/MC/RISCV/invalid-attribute.s b/llvm/test/MC/RISCV/invalid-attribute.s --- a/llvm/test/MC/RISCV/invalid-attribute.s +++ b/llvm/test/MC/RISCV/invalid-attribute.s @@ -22,14 +22,5 @@ .attribute unaligned_access, "0" # CHECK: [[@LINE-1]]:30: error: expected numeric constant -.attribute priv_spec, "2" -# CHECK: [[@LINE-1]]:23: error: expected numeric constant - -.attribute priv_spec_minor, "0" -# CHECK: [[@LINE-1]]:29: error: expected numeric constant - -.attribute priv_spec_revision, "0" -# CHECK: [[@LINE-1]]:32: error: expected numeric constant - .attribute arch, 30 # CHECK: [[@LINE-1]]:18: error: expected string constant diff --git a/llvm/test/tools/llvm-readobj/ELF/RISCV/attribute.s b/llvm/test/tools/llvm-readobj/ELF/RISCV/attribute.s --- a/llvm/test/tools/llvm-readobj/ELF/RISCV/attribute.s +++ b/llvm/test/tools/llvm-readobj/ELF/RISCV/attribute.s @@ -27,18 +27,3 @@ # CHECK-OBJ-NEXT: Value: 0 # CHECK-OBJ-NEXT: TagName: unaligned_access # CHECK-OBJ-NEXT: Description: No unaligned access - -.attribute Tag_priv_spec, 2 -# CHECK-OBJ: Tag: 8 -# CHECK-OBJ-NEXT: TagName: priv_spec -# CHECK-OBJ-NEXT: Value: 2 - -.attribute Tag_priv_spec_minor, 0 -# CHECK-OBJ: Tag: 10 -# CHECK-OBJ-NEXT: TagName: priv_spec_minor -# CHECK-OBJ-NEXT: Value: 0 - -.attribute Tag_priv_spec_revision, 0 -# CHECK-OBJ: Tag: 12 -# CHECK-OBJ-NEXT: TagName: priv_spec_revision -# CHECK-OBJ-NEXT: Value: 0