]> git.ipfire.org Git - thirdparty/glibc.git/commit
riscv: Add RVV strcpy for both multiarch and non-multiarch builds
authorYao Zihong <zihong.plct@isrc.iscas.ac.cn>
Mon, 20 Apr 2026 21:19:08 +0000 (16:19 -0500)
committerPeter Bergner <bergner@tenstorrent.com>
Tue, 21 Apr 2026 18:19:46 +0000 (13:19 -0500)
commit40fb13ac3de0dbd792d9fe09230dc0d0d4cde444
tree051cf5ea94cb8d9d447599dac938c81faff46029
parent79a7d01c9e91cd00f0acdd8d93b2ed852c70ae1f
riscv: Add RVV strcpy for both multiarch and non-multiarch builds

This patch adds an RVV-optimized implementation of strcpy for RISC-V and
enables it for both multiarch (IFUNC) and non-multiarch builds.

The implementation integrates Hau Hsu's 2023 RVV work under a unified
ifunc-based framework. A vectorized version (__strcpy_vector) is added
alongside the generic fallback (__strcpy_generic). The runtime resolver
selects the RVV variant when RISCV_HWPROBE_KEY_IMA_EXT_0 reports vector
support (RVV).

Currently, the resolver still selects the RVV variant even when the RVV
extension is disabled via prctl(). As a consequence, any process that
has RVV disabled via prctl() will receive SIGILL when calling strcpy().

Co-authored-by: Hau Hsu <hau.hsu@sifive.com>
Co-authored-by: Jerry Shih <jerry.shih@sifive.com>
Signed-off-by: Yao Zihong <zihong.plct@isrc.iscas.ac.cn>
Reviewed-by: Peter Bergner <bergner@tenstorrent.com>
sysdeps/riscv/multiarch/strcpy-generic.c [new file with mode: 0644]
sysdeps/riscv/multiarch/strcpy-vector.S [new file with mode: 0644]
sysdeps/riscv/rvv/strcpy.S [new file with mode: 0644]
sysdeps/unix/sysv/linux/riscv/multiarch/Makefile
sysdeps/unix/sysv/linux/riscv/multiarch/ifunc-impl-list.c
sysdeps/unix/sysv/linux/riscv/multiarch/strcpy.c [new file with mode: 0644]