]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add workaround for missing riscv_hwprobe syscall (258)
authorMark Wielaard <mark@klomp.org>
Fri, 9 May 2025 11:46:44 +0000 (13:46 +0200)
committerMark Wielaard <mark@klomp.org>
Fri, 9 May 2025 11:46:44 +0000 (13:46 +0200)
On riscv newer glibc (2.41) will probe instruction support using the
riscv_hwprobe syscall. Since Valgrind currently doesn't have a wrapper
for riscv_hwprobe that causes a Warning. Since the RISC-V Hardware
Probing Interface is non-trivial and we don't really implement
extended riscv instructions anyway work around that by "implementing"
riscv_hwprobe as sys_ni_syscall so it generates an ENOSYS and glibc
will silently fall back to not using any extended instructions.

https://docs.kernel.org/arch/riscv/hwprobe.html

https://bugs.kde.org/show_bug.cgi?id=503253

coregrind/m_syswrap/syswrap-riscv64-linux.c
include/vki/vki-scnums-riscv64-linux.h

index e0146f2b0dad4a8f97cf7d3f144e2dc56181c4dd..ebf9c3105339d160ba204e27653730a1627c1931 100644 (file)
@@ -545,6 +545,7 @@ static SyscallTableEntry syscall_main_table[] = {
    LINXY(__NR_perf_event_open, sys_perf_event_open),               /* 241 */
    LINXY(__NR_accept4, sys_accept4),                               /* 242 */
    LINXY(__NR_recvmmsg, sys_recvmmsg),                             /* 243 */
+   GENX_(__NR_riscv_hwprobe, sys_ni_syscall),                      /* 258 */
    PLAX_(__NR_riscv_flush_icache, sys_riscv_flush_icache),         /* 259 */
    GENXY(__NR_wait4, sys_wait4),                                   /* 260 */
    LINXY(__NR_prlimit64, sys_prlimit64),                           /* 261 */
index e4cc04a608b48ee127ff4bca92241850008a5402..17b6839f8a84f823c1943f7eba008d8451a27040 100644 (file)
 #define __NR_mmap __NR3264_mmap
 #define __NR_fadvise64 __NR3264_fadvise64
 
+#define __NR_riscv_hwprobe (__NR_arch_specific_syscall + 14)
 #define __NR_riscv_flush_icache (__NR_arch_specific_syscall + 15)
 
 #endif /* __VKI_SCNUMS_RISCV64_LINUX_H */