This has been tested with gcc trunk on openSUSE Tumbleweed on the HiFive Unleashed.
Although 32-bit support for Linux on RISC-V has lagged, you can build and boot a 32-bit kernel and it will eventually be more mainstream. Is the reason for not adding RISCV32 here that it was only tested on the HiFive Unleashed? It's possible to get prebuilt 32-bit disk images (and patches to build them yourself) that can be tested with, for instance, QEMU. See for instance . Also, I don't know how problematic it would be to add RISCV32 to the list without testing.
I have two comments/queries below.
I don't feel it's an issue that this doesn't support RISC-V 32, though the patch title and summary should be updated to reflect this, and a build requesting risc-v 32 should hard error.
What's the justification here? I'm not familiar with the sanitizer syscall interface, but it would be good to have a comment explaining why risc-v is the only architecture that doesn't use rename or renameat.
Please can you confirm that this will cause build errors if __riscv_xlen is 32 (like it will in sanitizer_platform_limits_posix.cpp)?
renameat is obsolete, renameat2 is the new generic default.
A definition of struct_kernel_stat_sz and struct_kernel_stat64_sz is required. That's how you find out that this needs porting.
@schwab Sorry there's been a delay reviewing this. I think it's probably fallen down the crack between "people who are familiar with RISC-V", and "people who are familiar with the sanitizers".
On the RISC-V side, I think @luismarques is your guy, so I've named him as a reviewer. Please also find someone from the sanitizers team who can review this work.
I think I've found the error. Comment inline
I'm getting compiler errors around these accesses. My sysroot thinks that __gregs isn't a field in this struct, it thinks the field is gregs (It's pointing to /opt/riscv-gcc-toolchain/sysroot/usr/include/bits/sigcontext.h:28:17 as the declaration for the gregs field.
I think this is the version of that file on github: https://github.com/riscv/riscv-glibc/blob/06983fe/sysdeps/unix/sysv/linux/riscv/bits/sigcontext.h#L27 (that git version matches the one used by https://github.com/riscv/riscv-gnu-toolchain)
Ok, It took several days of fighting crosstool-ng, but I finally have a riscv64-unknown-linux-gnu toolchain with glibc 2.30.
I'm happy this builds. I'm going to re-land the patch now. Sorry for the delay.
Just not one had yet put the work to explicitly support it, and be sure that was being done properly --- no deeper reason than that. Regarding riscv32, these is the sanitizer support for Linux, and Linux's RV32 support is being worked on. In particular, there are ABI issues that should be resolved now to avoid the year 2038 problem, and not cause breaking changes to address that at a later point.