https://sourceware.org/bugzilla/show_bug.cgi?id=34234
--- Comment #1 from Sourceware Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Kito Cheng <[email protected]>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9bd59f3804bc5752059459567dcfe8816873dada commit 9bd59f3804bc5752059459567dcfe8816873dada Author: Jin Ma <[email protected]> Date: Wed Dec 2 20:06:22 2026 +0800 RISC-V: Support the ELF atomic ABI attribute Linking objects that declare different atomic ABIs can silently discard Tag_RISCV_atomic_abi. Merge it according to the RISC-V ELF psABI so that A6C and A7 inputs cannot be linked together and compatible inputs retain the correct ABI. Check the first input as well as subsequent inputs, and distinguish an invalid value from a conflict between two known ABIs. Accept the symbolic tag in GAS and decode it in readelf. The tag number, values, and merge rules are documented in the RISC-V ELF psABI (Tag_RISCV_atomic_abi): https://github.com/riscv-non-isa/riscv-elf-psabi-doc/blob/master/riscv-elf.adoc#tag_riscv_atomic_abi-14-uleb128version The tag was introduced in https://github.com/riscv-non-isa/riscv-elf-psabi-doc/pull/385. An earlier implementation of this attribute is available in Kito Cheng's riscv-binutils-gdb fork: https://github.com/kito-cheng/riscv-binutils-gdb/commit/30207822354a605ccac368e2e86940475f27dec0 The check covers object files, as the psABI merge policy specifies. Shared libraries are not examined; their attribute sections are no longer reachable when the attributes are merged, so extending the check to them is left for discussion. bfd/ * elfxx-riscv.c (riscv_check_attr_range): New function. (riscv_merge_atomic_abi): Likewise. (riscv_merge_attributes): Use riscv_merge_atomic_abi for Tag_RISCV_atomic_abi on all inputs. binutils/ * readelf.c (riscv_attr_tag, display_riscv_attribute): Decode the atomic ABI attribute. gas/ * config/tc-riscv.c (riscv_convert_symbolic_attribute): Recognize atomic_abi. * doc/c-riscv.texi: Document the attribute. * testsuite/gas/riscv/attribute-atomic-abi-a6c.d: New test. * testsuite/gas/riscv/attribute-atomic-abi-a6s.d: Likewise. * testsuite/gas/riscv/attribute-atomic-abi-a7.d: Likewise. * testsuite/gas/riscv/attribute-atomic-abi.s: New test source. include/ * elf/riscv.h (Tag_RISCV_atomic_abi): Define the tag and its values. ld/ PR ld/34234 * testsuite/ld-riscv-elf/attr-merge-atomic-abi-a6c.d: New test. * testsuite/ld-riscv-elf/attr-merge-atomic-abi-a6s.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-atomic-abi-a7.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-atomic-abi-incompatible.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-atomic-abi-incompatible-reverse.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-atomic-abi-invalid.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-atomic-abi.s: New test source. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Run the new tests. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=34234 Co-authored-by: Kito Cheng <[email protected]> -- You are receiving this mail because: You are on the CC list for the bug.
