8353217: Build libsleef on macos-aarch64

Co-authored-by: Magnus Ihse Bursie <ihse@openjdk.org>
Reviewed-by: erikj, kvn, ihse
This commit is contained in:
Vladimir Ivanov 2025-04-02 19:42:30 +00:00
parent 209e72d311
commit 130b0cdaa6
175 changed files with 45 additions and 49 deletions

View File

@ -924,8 +924,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
# Check whether the compiler supports the Arm C Language Extensions (ACLE)
# for SVE. Set SVE_CFLAGS to -march=armv8-a+sve if it does.
# ACLE and this flag are required to build the aarch64 SVE related functions in
# libvectormath.
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
# libvectormath. Apple Silicon does not support SVE; use macOS as a proxy for
# that check.
if test "x$OPENJDK_TARGET_CPU" = "xaarch64" && test "x$OPENJDK_TARGET_CPU" = "xlinux"; then
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
AC_LANG_PUSH(C)
OLD_CFLAGS="$CFLAGS"

View File

@ -27,51 +27,46 @@
include LibCommon.gmk
################################################################################
## Build libjsvml
################################################################################
ifeq ($(INCLUDE_COMPILER2), true)
ifeq ($(call isTargetOs, linux windows)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2), true+true+true)
$(eval $(call SetupJdkLibrary, BUILD_LIBJSVML, \
NAME := jsvml, \
LDFLAGS_windows := -defaultlib:msvcrt, \
))
##############################################################################
## Build libjsvml
##############################################################################
ifeq ($(call isTargetOs, linux windows)+$(call isTargetCpu, x86_64), true+true)
$(eval $(call SetupJdkLibrary, BUILD_LIBJSVML, \
NAME := jsvml, \
LDFLAGS_windows := -defaultlib:msvcrt, \
))
TARGETS += $(BUILD_LIBJSVML)
endif
##############################################################################
## Build libsleef
##############################################################################
ifeq ($(call isTargetOs, linux macosx)+$(call isTargetCpu, aarch64 riscv64), true+true)
ifeq ($(call isTargetCpu, riscv64), true)
LIBSLEEF_CFLAGS := -march=rv64gcv
endif
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
NAME := sleef, \
OPTIMIZATION := HIGH, \
SRC := libsleef/lib, \
EXTRA_SRC := libsleef/generated, \
DISABLED_WARNINGS_gcc := unused-function sign-compare \
tautological-compare ignored-qualifiers, \
DISABLED_WARNINGS_clang := unused-function sign-compare \
tautological-compare ignored-qualifiers, \
CFLAGS := $(LIBSLEEF_CFLAGS), \
vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \
))
TARGETS += $(BUILD_LIBSLEEF)
endif
TARGETS += $(BUILD_LIBJSVML)
endif
################################################################################
## Build libsleef
################################################################################
ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, riscv64)+$(INCLUDE_COMPILER2), true+true+true)
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
NAME := sleef, \
OPTIMIZATION := HIGH, \
SRC := libsleef/lib, \
EXTRA_SRC := libsleef/generated, \
DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \
DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \
CFLAGS := -march=rv64gcv, \
CFLAGS_FILTER_OUT := -ftrivial-auto-var-init=pattern, \
))
TARGETS += $(BUILD_LIBSLEEF)
endif
ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64)+$(INCLUDE_COMPILER2), true+true+true)
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
NAME := sleef, \
OPTIMIZATION := HIGH, \
SRC := libsleef/lib, \
EXTRA_SRC := libsleef/generated, \
DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \
DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \
vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \
CFLAGS_FILTER_OUT := -ftrivial-auto-var-init=pattern, \
))
TARGETS += $(BUILD_LIBSLEEF)
endif
################################################################################

View File

@ -10,7 +10,7 @@ git tag `3.6.1` and git commit hash `6ee14bcae5fe92c2ff8b000d5a01102dab08d774`.
# About the libsleef integration in the JDK
The upstream original source code is available in
`src/jdk.incubator.vector/linux/native/libsleef/upstream`. However, this code is
`src/jdk.incubator.vector/unix/native/libsleef/upstream`. However, this code is
not directly usable in the JDK build system, but is instead used as the base for
the generation of additional souce code files. This generation is done by
the libsleef CMake files. If this should have been done at build time, it would
@ -19,14 +19,14 @@ have meant adding CMake as a required dependency to build the JDK.
Instead, we create these generated files only once, when we import a new
version of the libsleef source code, and check in the generated files into
the JDK source tree. The generated files reside in
`src/jdk.incubator.vector/linux/native/libsleef/generated`.
`src/jdk.incubator.vector/unix/native/libsleef/generated`.
# Import instructions
To update the version of libsleef that is used in the JDK, clone
`https://github.com/shibatch/sleef.git`, and copy all files, except the `docs`,
`.github` and `.git` directories, into
`src/jdk.incubator.vector/linux/native/libsleef/upstream`.
`src/jdk.incubator.vector/unix/native/libsleef/upstream`.
The libsleef source code does not follow the JDK whitespace rules as enforced by
jcheck. You will need to remove trailing whitespace, and expand tabs to 8
@ -51,4 +51,4 @@ then generate the updated libsleef source code by
`make update-sleef-source CONF=riscv64`.
Finally, verify with git that the local changes made to the files in
`src/jdk.incubator.vector/linux/native/libsleef/generated` look okay.
`src/jdk.incubator.vector/unix/native/libsleef/generated` look okay.

Some files were not shown because too many files have changed in this diff Show More