Skip to content

Commit 130b0cd

Browse files
Vladimir Ivanovmagicus
andcommitted
8353217: Build libsleef on macos-aarch64
Co-authored-by: Magnus Ihse Bursie <[email protected]> Reviewed-by: erikj, kvn, ihse
1 parent 209e72d commit 130b0cd

File tree

175 files changed

+40
-44
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+40
-44
lines changed

make/autoconf/flags-cflags.m4

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,9 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
924924
# Check whether the compiler supports the Arm C Language Extensions (ACLE)
925925
# for SVE. Set SVE_CFLAGS to -march=armv8-a+sve if it does.
926926
# ACLE and this flag are required to build the aarch64 SVE related functions in
927-
# libvectormath.
928-
if test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then
927+
# libvectormath. Apple Silicon does not support SVE; use macOS as a proxy for
928+
# that check.
929+
if test "x$OPENJDK_TARGET_CPU" = "xaarch64" && test "x$OPENJDK_TARGET_CPU" = "xlinux"; then
929930
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
930931
AC_LANG_PUSH(C)
931932
OLD_CFLAGS="$CFLAGS"

make/modules/jdk.incubator.vector/Lib.gmk

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,51 +27,46 @@
2727

2828
include LibCommon.gmk
2929

30-
################################################################################
31-
## Build libjsvml
32-
################################################################################
30+
ifeq ($(INCLUDE_COMPILER2), true)
3331

34-
ifeq ($(call isTargetOs, linux windows)+$(call isTargetCpu, x86_64)+$(INCLUDE_COMPILER2), true+true+true)
35-
$(eval $(call SetupJdkLibrary, BUILD_LIBJSVML, \
36-
NAME := jsvml, \
37-
LDFLAGS_windows := -defaultlib:msvcrt, \
38-
))
32+
##############################################################################
33+
## Build libjsvml
34+
##############################################################################
3935

40-
TARGETS += $(BUILD_LIBJSVML)
41-
endif
36+
ifeq ($(call isTargetOs, linux windows)+$(call isTargetCpu, x86_64), true+true)
37+
$(eval $(call SetupJdkLibrary, BUILD_LIBJSVML, \
38+
NAME := jsvml, \
39+
LDFLAGS_windows := -defaultlib:msvcrt, \
40+
))
4241

43-
################################################################################
44-
## Build libsleef
45-
################################################################################
42+
TARGETS += $(BUILD_LIBJSVML)
43+
endif
4644

47-
ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, riscv64)+$(INCLUDE_COMPILER2), true+true+true)
48-
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
49-
NAME := sleef, \
50-
OPTIMIZATION := HIGH, \
51-
SRC := libsleef/lib, \
52-
EXTRA_SRC := libsleef/generated, \
53-
DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \
54-
DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \
55-
CFLAGS := -march=rv64gcv, \
56-
CFLAGS_FILTER_OUT := -ftrivial-auto-var-init=pattern, \
57-
))
45+
##############################################################################
46+
## Build libsleef
47+
##############################################################################
5848

59-
TARGETS += $(BUILD_LIBSLEEF)
60-
endif
49+
ifeq ($(call isTargetOs, linux macosx)+$(call isTargetCpu, aarch64 riscv64), true+true)
50+
ifeq ($(call isTargetCpu, riscv64), true)
51+
LIBSLEEF_CFLAGS := -march=rv64gcv
52+
endif
53+
54+
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
55+
NAME := sleef, \
56+
OPTIMIZATION := HIGH, \
57+
SRC := libsleef/lib, \
58+
EXTRA_SRC := libsleef/generated, \
59+
DISABLED_WARNINGS_gcc := unused-function sign-compare \
60+
tautological-compare ignored-qualifiers, \
61+
DISABLED_WARNINGS_clang := unused-function sign-compare \
62+
tautological-compare ignored-qualifiers, \
63+
CFLAGS := $(LIBSLEEF_CFLAGS), \
64+
vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \
65+
))
6166

62-
ifeq ($(call isTargetOs, linux)+$(call isTargetCpu, aarch64)+$(INCLUDE_COMPILER2), true+true+true)
63-
$(eval $(call SetupJdkLibrary, BUILD_LIBSLEEF, \
64-
NAME := sleef, \
65-
OPTIMIZATION := HIGH, \
66-
SRC := libsleef/lib, \
67-
EXTRA_SRC := libsleef/generated, \
68-
DISABLED_WARNINGS_gcc := unused-function sign-compare tautological-compare ignored-qualifiers, \
69-
DISABLED_WARNINGS_clang := unused-function sign-compare tautological-compare ignored-qualifiers, \
70-
vector_math_sve.c_CFLAGS := $(SVE_CFLAGS), \
71-
CFLAGS_FILTER_OUT := -ftrivial-auto-var-init=pattern, \
72-
))
67+
TARGETS += $(BUILD_LIBSLEEF)
68+
endif
7369

74-
TARGETS += $(BUILD_LIBSLEEF)
7570
endif
7671

7772
################################################################################

src/jdk.incubator.vector/linux/native/libsleef/README.md renamed to src/jdk.incubator.vector/unix/native/libsleef/README.md

Lines changed: 4 additions & 4 deletions

0 commit comments

Comments
 (0)