Even more restructuring.
--- a/make/autoconf/configure.ac Mon Feb 26 14:10:16 2018 +0100
+++ b/make/autoconf/configure.ac Mon Feb 26 14:23:19 2018 +0100
@@ -163,11 +163,9 @@
# First determine the toolchain type (compiler family)
TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE
-# User supplied flags should be used when configure detects compilers
-FLAGS_SETUP_USER_SUPPLIED_FLAGS
-# The sysroot cflags are needed for configure to be able to run the compilers
-FLAGS_SETUP_SYSROOT_FLAGS
-FLAGS_SETUP_GLOBAL_FLAGS
+# The global flags are needed for configure to be able to run the compilers
+# correctly.
+FLAGS_PRE_TOOLCHAIN
# Then detect the actual binaries needed
TOOLCHAIN_PRE_DETECTION
@@ -185,18 +183,15 @@
# Setup Jib dependency tool
TOOLCHAIN_SETUP_JIB
-FLAGS_SETUP_POST_TOOLCHAIN
+# After toolchain setup, we need to process some flags to be able to continue.
+FLAGS_POST_TOOLCHAIN
# Now we can test some aspects on the target using configure macros.
PLATFORM_SETUP_OPENJDK_TARGET_BITS
PLATFORM_SETUP_OPENJDK_TARGET_ENDIANNESS
# Configure flags for the tools
-FLAGS_SETUP_FLAGS_PER_TYPE
-FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION
-FLAGS_SETUP_CFLAGS
-FLAGS_SETUP_LDFLAGS
-FLAGS_SETUP_MISC_FLAGS
+FLAGS_SETUP_FLAGS
#FIXME: REMOVE
FLAGS_SORT_FLAGS(JVM_CFLAGS)
--- a/make/autoconf/flags-cflags.m4 Mon Feb 26 14:10:16 2018 +0100
+++ b/make/autoconf/flags-cflags.m4 Mon Feb 26 14:23:19 2018 +0100
@@ -140,6 +140,37 @@
IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true],
IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false])
fi
+
+ # Debug symbols for JVM_CFLAGS
+ if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
+ if test "x$DEBUG_LEVEL" = xslowdebug; then
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
+ else
+ # -g0 does not disable inlining, which -g does.
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
+ fi
+ elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
+ else
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
+ fi
+ AC_SUBST(JVM_CFLAGS_SYMBOLS)
+
+ # bounds, memory and behavior checking options
+ if test "x$TOOLCHAIN_TYPE" = xgcc; then
+ case $DEBUG_LEVEL in
+ slowdebug )
+ # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
+ # get's added conditionally on whether we produce debug symbols or not.
+ # This is most likely not really correct.
+
+ if test "x$STACK_PROTECTOR_CFLAG" != x; then
+ JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
+ fi
+ ;;
+ esac
+ fi
])
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
--- a/make/autoconf/flags-ldflags.m4 Mon Feb 26 14:10:16 2018 +0100
+++ b/make/autoconf/flags-ldflags.m4 Mon Feb 26 14:23:19 2018 +0100
@@ -28,7 +28,7 @@
AC_DEFUN([FLAGS_SETUP_LDFLAGS],
[
- FLAGS_SETUP_LINKER_FLAGS_FOR_JDK_HELPER
+ FLAGS_SETUP_LDFLAGS_HELPER
# Setup the target toolchain
@@ -42,14 +42,14 @@
else
TARGET_JVM_VARIANT_PATH=server
fi
- FLAGS_SETUP_LINKER_FLAGS_FOR_JDK_CPU_DEP([TARGET])
+ FLAGS_SETUP_LDFLAGS_CPU_DEP([TARGET])
# Setup the build toolchain
# When building a buildjdk, it's always only the server variant
BUILD_JVM_VARIANT_PATH=server
- FLAGS_SETUP_LINKER_FLAGS_FOR_JDK_CPU_DEP([BUILD], [OPENJDK_BUILD_])
+ FLAGS_SETUP_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE ${TARGET_LDFLAGS_JDK_LIBPATH}"
@@ -60,7 +60,7 @@
################################################################################
# CPU independent LDFLAGS setup, used for both target and build toolchain.
-AC_DEFUN([FLAGS_SETUP_LINKER_FLAGS_FOR_JDK_HELPER],
+AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
[
# Setup basic LDFLAGS
if test "x$TOOLCHAIN_TYPE" = xgcc; then
@@ -174,7 +174,7 @@
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
# conditionals against.
# $2 - Optional prefix for each variable defined.
-AC_DEFUN([FLAGS_SETUP_LINKER_FLAGS_FOR_JDK_CPU_DEP],
+AC_DEFUN([FLAGS_SETUP_LDFLAGS_CPU_DEP],
[
# Setup CPU-dependent basic LDFLAGS. These can differ between the target and
# build toolchain.
--- a/make/autoconf/flags-other.m4 Mon Feb 26 14:10:16 2018 +0100
+++ b/make/autoconf/flags-other.m4 Mon Feb 26 14:23:19 2018 +0100
@@ -28,18 +28,6 @@
# Setup flags for other tools than C/C++ compiler
#
-AC_DEFUN_ONCE([FLAGS_SETUP_MISC_FLAGS],
-[
- FLAGS_SETUP_ARFLAGS
- FLAGS_SETUP_STRIPFLAGS
- FLAGS_SETUP_RCFLAGS
-
- FLAGS_SETUP_ASFLAGS
- FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
- FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
-])
-
-
AC_DEFUN([FLAGS_SETUP_ARFLAGS],
[
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
--- a/make/autoconf/flags.m4 Mon Feb 26 14:10:16 2018 +0100
+++ b/make/autoconf/flags.m4 Mon Feb 26 14:23:19 2018 +0100
@@ -233,8 +233,13 @@
AC_SUBST($1SYSROOT_LDFLAGS)
])
-AC_DEFUN_ONCE([FLAGS_SETUP_GLOBAL_FLAGS],
+AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
[
+ # We should always include user supplied flags
+ FLAGS_SETUP_USER_SUPPLIED_FLAGS
+ # The sysroot flags are needed for configure to be able to run the compilers
+ FLAGS_SETUP_SYSROOT_FLAGS
+
if test "x$TOOLCHAIN_TYPE" = xxlc; then
MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
elif test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
@@ -354,15 +359,10 @@
AC_SUBST(CXX_FLAG_DEPS)
])
-AC_DEFUN_ONCE([FLAGS_SETUP_POST_TOOLCHAIN],
+AC_DEFUN_ONCE([FLAGS_POST_TOOLCHAIN],
[
FLAGS_SETUP_TOOLCHAIN_CONTROL
- if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- # silence copyright notice and other headers.
- COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
- fi
-
if test "x$BUILD_SYSROOT" != x; then
FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
else
@@ -374,7 +374,7 @@
])
-AC_DEFUN([FLAGS_SETUP_FLAGS_PER_TYPE],
+AC_DEFUN([FLAGS_SETUP_FLAGS],
[
FLAGS_SETUP_MACOSX_VERSION
FLAGS_SETUP_ABI_PROFILE
@@ -383,42 +383,26 @@
FLAGS_SETUP_DEBUG_SYMBOLS
FLAGS_SETUP_QUALITY_CHECKS
FLAGS_SETUP_OPTIMIZATION
+
+ FLAGS_SETUP_CFLAGS
+ FLAGS_SETUP_LDFLAGS
+
+ FLAGS_SETUP_ARFLAGS
+ FLAGS_SETUP_STRIPFLAGS
+ FLAGS_SETUP_RCFLAGS
+
+ FLAGS_SETUP_ASFLAGS
+ FLAGS_SETUP_ASFLAGS_CPU_DEP([TARGET])
+ FLAGS_SETUP_ASFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
])
-AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION],
+AC_DEFUN([FLAGS_SETUP_CFLAGS],
[
- # Debug symbols for JVM_CFLAGS
- if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -xs"
- if test "x$DEBUG_LEVEL" = xslowdebug; then
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
- else
- # -g0 does not disable inlining, which -g does.
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g0"
- fi
- elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -Z7 -d2Zi+"
- else
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -g"
- fi
- AC_SUBST(JVM_CFLAGS_SYMBOLS)
+ # FIXME: How to handle this?
+ if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+ # silence copyright notice and other headers.
+ COMMON_CCXXFLAGS="$COMMON_CCXXFLAGS -nologo"
- # bounds, memory and behavior checking options
- if test "x$TOOLCHAIN_TYPE" = xgcc; then
- case $DEBUG_LEVEL in
- slowdebug )
- # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
- # get's added conditionally on whether we produce debug symbols or not.
- # This is most likely not really correct.
-
- if test "x$STACK_PROTECTOR_CFLAG" != x; then
- JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS $STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
- fi
- ;;
- esac
- fi
-
- if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$DEBUG_LEVEL" != xrelease; then
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
JVM_CFLAGS="$JVM_CFLAGS -homeparams"
@@ -426,27 +410,9 @@
fi
fi
- # Optional POSIX functionality needed by the JVM
- #
- # Check if clock_gettime is available and in which library. This indicates
- # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
- # don't let it update LIBS.
- save_LIBS="$LIBS"
- AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
- if test "x$LIBS" = "x-lrt "; then
- CLOCK_GETTIME_IN_LIBRT=true
- fi
- LIBS="$save_LIBS"
-
-])
-
-
-AC_DEFUN([FLAGS_SETUP_CFLAGS],
-[
-
### CFLAGS
- FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER
+ FLAGS_SETUP_CFLAGS_HELPER
FLAGS_OS=$OPENJDK_TARGET_OS
FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
@@ -457,7 +423,7 @@
FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
- FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_CPU_DEP([TARGET])
+ FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
FLAGS_OS=$OPENJDK_BUILD_OS
FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
@@ -468,7 +434,7 @@
FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
- FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_CPU_DEP([BUILD], [OPENJDK_BUILD_])
+ FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
# Tests are only ever compiled for TARGET
CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
@@ -484,7 +450,7 @@
################################################################################
# platform independent
-AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER],
+AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
[
#### OS DEFINES, these should be independent on toolchain
if test "x$OPENJDK_TARGET_OS" = xlinux; then
@@ -699,7 +665,18 @@
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
fi
- # Optional POSIX functionality needed by the VM
+
+ # Optional POSIX functionality needed by the JVM
+ #
+ # Check if clock_gettime is available and in which library. This indicates
+ # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
+ # don't let it update LIBS.
+ save_LIBS="$LIBS"
+ AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
+ if test "x$LIBS" = "x-lrt "; then
+ CLOCK_GETTIME_IN_LIBRT=true
+ fi
+ LIBS="$save_LIBS"
if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
@@ -716,7 +693,7 @@
# $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
# conditionals against.
# $2 - Optional prefix for each variable defined.
-AC_DEFUN([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_CPU_DEP],
+AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
[
#### CPU DEFINES, these should be independent on toolchain