[PATCH v1 1/1] riscv: treat clang separately in RVV compiler checks
Peter Bergner
bergner@tenstorrent.com
Mon Feb 9 21:35:04 GMT 2026
On 1/21/26 8:36 AM, Yao Zihong wrote:
> The RVV compiler version check unconditionally interprets __GNUC__ as the
> compiler version, regardless of which compiler is used.
When I added the vector check, clang wasn't an option yet, so it was expected
that we'd need to add this type of change once clang supported was added.
Thanks for working on it!
> Detect clang explicitly and apply compiler-specific version checks for
> RVV.
> ---
> sysdeps/riscv/preconfigure | 13 +++++++++++--
> sysdeps/riscv/preconfigure.ac | 13 +++++++++++--
> 2 files changed, 22 insertions(+), 4 deletions(-)
You're missing a "Signed-off-by ..." on this contribution...unless you
have a FSF copyright assignment you're submitting this under?
> diff --git a/sysdeps/riscv/preconfigure.ac b/sysdeps/riscv/preconfigure.ac
> index 99fbb0c9c9..a62b15a88c 100644
> --- a/sysdeps/riscv/preconfigure.ac
> +++ b/sysdeps/riscv/preconfigure.ac
> @@ -8,6 +8,7 @@ riscv*)
> float_abi=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_float_abi_\([^ ]*\) .*/\1/p'`
> atomic=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep '#define __riscv_atomic' | cut -d' ' -f2`
> vector=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | sed -n 's/^#define __riscv_v \(.*\)/\1/p'`
> + is_clang=`$CC $CFLAGS $CPPFLAGS -E -dM -xc /dev/null | grep -q '__clang__' && echo yes || echo no`
Let's move this....
> case "$xlen" in
> 64 | 32)
> @@ -57,8 +58,16 @@ riscv*)
> esac
>
> if test -n "$vector"; then
...to here, so we only check for clang if we know we have vector and need to
check clang and GCC's version numbers. Otherwise the check is unused.
Peter
More information about the Libc-alpha
mailing list