[RFC PATCH v2 0/4] riscv: Add hwcaps-subdir support for profiles
Yao Zihong
zihong.plct@isrc.iscas.ac.cn
Tue Sep 30 00:56:52 GMT 2025
Changes since v1
----------------
- Fixed comment wording issues in header files.
- Corrected a bug in resolver example.
- Minor cleanups (identifiers, commit message clarity).
Hi all,
This series synchronizes the RISC-V hwprobe UAPI header, and adds support
for glibc hwcaps-subdirectories keyed on RISC-V profile levels (starting
with RVA20U64, RVA22U64, and RVA23U64). It also includes a small test
suite to validate selection of profile-specific optimized objects.
The motivation is to enable distribution maintainers and users to ship
optimized libraries (e.g. memcpy variants) only for the relevant RISC-V
profiles, reducing binary size while still allowing generic fallbacks.
The design follows the x86 hwcaps-subdir mechanism.
Request for comments
--------------------
Feedback on any aspect of the design is welcome. In particular, I would
like confirmation on:
- Whether the profile-based subdirectory scheme aligns with glibc’s
intended multiarch design and direction.
- Whether the current probing coverage for each profile level is
sufficient and appropriate.
Yao Zihong (4):
riscv: Sync hwprobe.h for compatibility
riscv: Add hwcaps-subdir support for RVA20U64
riscv: Add hwcaps-subdir support for RVA22U64 and RVA23U64
riscv: Add test for hwcaps-subdir
elf/Makefile | 2 +-
elf/tst-glibc-hwcaps-cache.script | 10 +
sysdeps/riscv/Makefile | 39 ++++
sysdeps/riscv/get-profile-level.h | 82 +++++++
sysdeps/riscv/multiarch/memcpy-generic.c | 5 +
sysdeps/riscv/multiarch/memcpy_noalignment.S | 5 +
sysdeps/riscv/multiarch/memcpy_vector.S | 54 +++++
sysdeps/riscv/profile-ifunc-macros.h | 69 ++++++
sysdeps/riscv/profile-level.h | 121 ++++++++++
sysdeps/riscv/rv64/dl-hwcaps-subdirs.c | 48 ++++
sysdeps/riscv/tst-glibc-hwcaps.c | 64 ++++++
.../unix/sysv/linux/riscv/multiarch/Makefile | 1 +
.../linux/riscv/multiarch/ifunc-impl-list.c | 19 +-
.../unix/sysv/linux/riscv/multiarch/memcpy.c | 18 +-
sysdeps/unix/sysv/linux/riscv/sys/hwprobe.h | 212 ++++++++++++++++++
15 files changed, 741 insertions(+), 8 deletions(-)
create mode 100644 sysdeps/riscv/get-profile-level.h
create mode 100644 sysdeps/riscv/multiarch/memcpy_vector.S
create mode 100644 sysdeps/riscv/profile-ifunc-macros.h
create mode 100644 sysdeps/riscv/profile-level.h
create mode 100644 sysdeps/riscv/rv64/dl-hwcaps-subdirs.c
create mode 100644 sysdeps/riscv/tst-glibc-hwcaps.c
--
2.47.2
More information about the Libc-alpha
mailing list