RFR: 8341880: RISC-V: riscv_vector.h native build fails with gcc13 after JDK-8320500
Fei Yang
fyang at openjdk.org
Fri Oct 11 02:41:17 UTC 2024
On Thu, 10 Oct 2024 07:37:43 GMT, SendaoYan <syan at openjdk.org> wrote:
> Hi all,
> The file `src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c` introduced by [JDK-8341880](https://bugs.openjdk.org/browse/JDK-8341880) native build fails by fedora OS shipped gcc13.
> Gcc13 doesn't have `__riscv_v_intrinsic` macro by default, and do have `__riscv_v_intrinsic` macro with option: `-march=rv64gcv`. So I think the CFLAGS should not set `-march=rv64gcv`, because gcc13 doesn't have `riscv_vector.h`.
>
> 
>
>
> gcc version infomation:
>
> /usr/bin/gcc -v
> Using built-in specs.
> COLLECT_GCC=/usr/bin/gcc
> COLLECT_LTO_WRAPPER=/usr/libexec/gcc/riscv64-redhat-linux/13/lto-wrapper
> Target: riscv64-redhat-linux
> Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,m2,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace --with-libstdcxx-zoneinfo=/usr/share/zoneinfo --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-13.2.1-20230728/obj-riscv64-redhat-linux/isl-install --enable-gnu-indirect-function --with-arch=rv64gc --with-abi=lp64d --with-multilib-list=lp64d --build=riscv64-redhat-linux --with-build-config=bootstrap-lto --enable-link-serialization=1
> Thread model: posix
> Supported LTO compression algorithms: zlib zstd
> gcc version 13.2.1 20230728 (Red Hat 13.2.1-1) (GCC)
>
>
> Additonal testing:
>
> - [ ] riscv64 native release debug-level build with gcc13
> - [ ] riscv64 native fastdebug debug-level build with gcc13
> - [ ] riscv64 native release debug-level build with gcc14
> - [ ] riscv64 native fastdebug debug-level build with gcc14
So I tried following change, seems to work:
diff --git a/src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c b/src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c
index 4515457fa89..4911d45dfa4 100644
--- a/src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c
+++ b/src/jdk.incubator.vector/linux/native/libsleef/lib/vector_math_rvv.c
@@ -31,6 +31,8 @@
// At run-time, if the library is found and the bridge functions are available in the
// library, then the java vector API will call into the bridge functions and sleef.
+#if __GNUC__ >= 14 || (defined(__clang_major__) && __clang_major__ >= 17)
+
#ifdef __riscv_v_intrinsic
#include <stdint.h>
@@ -118,3 +120,5 @@ DEFINE_VECTOR_MATH_BINARY_RVV(hypotdx_u05, vdouble_rvvm1_sleef)
#undef DEFINE_VECTOR_MATH_BINARY_RVV
#endif /* __riscv_v_intrinsic */
+
+#endif
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21442#issuecomment-2406434778
More information about the build-dev
mailing list