diff --git a/openjdk/common/autoconf/flags.m4 b/openjdk/common/autoconf/flags.m4 index 077efa2..b302b50 100644 --- a/openjdk/common/autoconf/flags.m4 +++ b/openjdk/common/autoconf/flags.m4 @@ -406,6 +406,21 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK], AC_SUBST($2CXXSTD_CXXFLAG) fi + # + # NOTE: check for -mstackrealign needs to be below potential addition of -m32 + # + if test "x$OPENJDK_TARGET_CPU" = xx86 && test "x$OPENJDK_TARGET_OS" = xmacosx -o \ + "x$OPENJDK_TARGET_OS" = xlinux; then + # On 32-bit MacOSX the OS requires C-entry points to be 16 byte aligned. + # While waiting for a better solution, the current workaround is to use -mstackrealign + # This is also required on Linux systems which use libraries compiled with SSE instructions + REALIGN_CFLAG="-mstackrealign" + FLAGS_COMPILER_CHECK_ARGUMENTS([$REALIGN_CFLAG -Werror], [], + AC_MSG_ERROR([The selected compiler $CXX does not support -mstackrealign! Try to put another compiler in the path.]) + ) + AC_SUBST([REALIGN_CFLAG]) + fi + if test "x$CFLAGS" != "x${ADDED_CFLAGS}"; then AC_MSG_WARN([Ignoring CFLAGS($CFLAGS) found in environment. Use --with-extra-cflags]) fi diff --git a/openjdk/common/autoconf/hotspot-spec.gmk.in b/openjdk/common/autoconf/hotspot-spec.gmk.in index f7d3fce..9e8699a 100644 --- a/openjdk/common/autoconf/hotspot-spec.gmk.in +++ b/openjdk/common/autoconf/hotspot-spec.gmk.in @@ -112,7 +112,8 @@ MT:=@HOTSPOT_MT@ RC:=@HOTSPOT_RC@ EXTRA_CFLAGS=@LEGACY_EXTRA_CFLAGS@ $(NO_DELETE_NULL_POINTER_CHECKS_CFLAG) \ - $(NO_LIFETIME_DSE_CFLAG) $(CXXSTD_CXXFLAG) + $(NO_LIFETIME_DSE_CFLAG) $(CXXSTD_CXXFLAG) \ + $(REALIGN_CFLAG) EXTRA_CXXFLAGS=@LEGACY_EXTRA_CXXFLAGS@ EXTRA_LDFLAGS=@LEGACY_EXTRA_LDFLAGS@ EXTRA_ASFLAGS=@LEGACY_EXTRA_ASFLAGS@ diff --git a/openjdk/common/autoconf/spec.gmk.in b/openjdk/common/autoconf/spec.gmk.in index 1950807..3440ff6 100644 --- a/openjdk/common/autoconf/spec.gmk.in +++ b/openjdk/common/autoconf/spec.gmk.in @@ -366,6 +366,7 @@ CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@ NO_DELETE_NULL_POINTER_CHECKS_CFLAG=@NO_DELETE_NULL_POINTER_CHECKS_CFLAG@ NO_LIFETIME_DSE_CFLAG=@NO_LIFETIME_DSE_CFLAG@ +REALIGN_CFLAG=@REALIGN_CFLAG@ CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@ CXX:=@FIXPATH@ @CCACHE@ @CXX@