8198724: Refactor FLAGS handling in configure

Reviewed-by: erikj
This commit is contained in:
Magnus Ihse Bursie 2018-03-02 10:59:25 +01:00
parent 77d0099725
commit b64d0ef66d
14 changed files with 1478 additions and 1380 deletions

View File

@ -163,10 +163,9 @@ JDKOPT_SETUP_STATIC_BUILD
# 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
# 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
@ -184,17 +183,15 @@ TOOLCHAIN_SETUP_JTREG
# Setup Jib dependency tool
TOOLCHAIN_SETUP_JIB
FLAGS_SETUP_INIT_FLAGS
# 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_COMPILER_FLAGS_FOR_LIBS
FLAGS_SETUP_COMPILER_FLAGS_FOR_OPTIMIZATION
FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK
FLAGS_SETUP_COMPILER_FLAGS_MISC
FLAGS_SETUP_FLAGS
# Setup debug symbols (need objcopy from the toolchain for that)
JDKOPT_SETUP_DEBUG_SYMBOLS

View File

@ -0,0 +1,899 @@
#
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
#
# Setup flags for C/C++ compiler
#
###############################################################################
#
# How to compile shared libraries.
#
AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
[
if test "x$TOOLCHAIN_TYPE" = xgcc; then
C_FLAG_REORDER=''
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
elif test "x$TOOLCHAIN_TYPE" = xclang; then
C_FLAG_REORDER=''
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Linking is different on MacOSX
SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0"
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)'
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
else
# Default works for linux, might work on other platforms as well.
SHARED_LIBRARY_FLAGS='-shared'
SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
# arm specific settings
if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
# '-Wl,-z,origin' isn't used on arm.
SET_SHARED_LIBRARY_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
else
SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
fi
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
C_FLAG_REORDER='-xF'
SHARED_LIBRARY_FLAGS="-G"
SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
SET_SHARED_LIBRARY_NAME='-h [$]1'
SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
C_FLAG_REORDER=''
SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
SET_EXECUTABLE_ORIGIN=""
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE=''
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_FLAG_REORDER=''
SHARED_LIBRARY_FLAGS="-dll"
SET_EXECUTABLE_ORIGIN=''
SET_SHARED_LIBRARY_ORIGIN=''
SET_SHARED_LIBRARY_NAME=''
SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
fi
AC_SUBST(C_FLAG_REORDER)
AC_SUBST(SET_EXECUTABLE_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
AC_SUBST(SET_SHARED_LIBRARY_NAME)
AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
AC_SUBST(SHARED_LIBRARY_FLAGS)
])
AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
[
# Debug symbols
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_CPU_BITS" = "x64" && test "x$DEBUG_LEVEL" = "xfastdebug"; then
CFLAGS_DEBUG_SYMBOLS="-g1"
else
CFLAGS_DEBUG_SYMBOLS="-g"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
CFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
CFLAGS_DEBUG_SYMBOLS="-g -xs"
# -g0 enables debug symbols without disabling inlining.
CXXFLAGS_DEBUG_SYMBOLS="-g0 -xs"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
CFLAGS_DEBUG_SYMBOLS="-g"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CFLAGS_DEBUG_SYMBOLS="-Zi"
fi
if test "x$CXXFLAGS_DEBUG_SYMBOLS" = x; then
# If we did not specify special flags for C++, use C version
CXXFLAGS_DEBUG_SYMBOLS="$CFLAGS_DEBUG_SYMBOLS"
fi
AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
AC_SUBST(CXXFLAGS_DEBUG_SYMBOLS)
# FIXME: This was never used in the old build. What to do with it?
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# "-Og" suppported for GCC 4.8 and later
CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG],
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)
])
AC_DEFUN([FLAGS_SETUP_WARNINGS],
[
AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
[do not consider native warnings to be an error @<:@enabled@:>@])])
AC_MSG_CHECKING([if native warnings are errors])
if test "x$enable_warnings_as_errors" = "xyes"; then
AC_MSG_RESULT([yes (explicitly set)])
WARNINGS_AS_ERRORS=true
elif test "x$enable_warnings_as_errors" = "xno"; then
AC_MSG_RESULT([no])
WARNINGS_AS_ERRORS=false
elif test "x$enable_warnings_as_errors" = "x"; then
AC_MSG_RESULT([yes (default)])
WARNINGS_AS_ERRORS=true
else
AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
fi
AC_SUBST(WARNINGS_AS_ERRORS)
case "${TOOLCHAIN_TYPE}" in
microsoft)
DISABLE_WARNING_PREFIX="-wd"
CFLAGS_WARNINGS_ARE_ERRORS="-WX"
;;
solstudio)
DISABLE_WARNING_PREFIX="-erroff="
CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
;;
gcc)
# Prior to gcc 4.4, a -Wno-X where X is unknown for that version of gcc will cause an error
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
IF_TRUE: [GCC_CAN_DISABLE_WARNINGS=true],
IF_FALSE: [GCC_CAN_DISABLE_WARNINGS=false]
)
if test "x$GCC_CAN_DISABLE_WARNINGS" = "xtrue"; then
DISABLE_WARNING_PREFIX="-Wno-"
else
DISABLE_WARNING_PREFIX=
fi
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
# Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
# CFLAGS since any target specific flags will likely not work with the
# build compiler
CC_OLD="$CC"
CXX_OLD="$CXX"
CC="$BUILD_CC"
CXX="$BUILD_CXX"
CFLAGS_OLD="$CFLAGS"
CFLAGS=""
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [-Wno-this-is-a-warning-that-do-not-exist],
IF_TRUE: [BUILD_CC_CAN_DISABLE_WARNINGS=true],
IF_FALSE: [BUILD_CC_CAN_DISABLE_WARNINGS=false]
)
if test "x$BUILD_CC_CAN_DISABLE_WARNINGS" = "xtrue"; then
BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
else
BUILD_CC_DISABLE_WARNING_PREFIX=
fi
CC="$CC_OLD"
CXX="$CXX_OLD"
CFLAGS="$CFLAGS_OLD"
;;
clang)
DISABLE_WARNING_PREFIX="-Wno-"
CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
;;
xlc)
DISABLE_WARNING_PREFIX="-qsuppress="
CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
;;
esac
AC_SUBST(DISABLE_WARNING_PREFIX)
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
])
AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
[
# bounds, memory and behavior checking options
if test "x$TOOLCHAIN_TYPE" = xgcc; then
case $DEBUG_LEVEL in
release )
# no adjustment
;;
fastdebug )
# no adjustment
;;
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.
# Add runtime stack smashing and undefined behavior checks.
# Not all versions of gcc support -fstack-protector
STACK_PROTECTOR_CFLAG="-fstack-protector-all"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$STACK_PROTECTOR_CFLAG -Werror],
IF_FALSE: [STACK_PROTECTOR_CFLAG=""])
CFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
CXXFLAGS_DEBUG_OPTIONS="$STACK_PROTECTOR_CFLAG --param ssp-buffer-size=1"
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_OPTIMIZATION],
[
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
C_O_FLAG_HIGHEST_JVM="-xO4"
C_O_FLAG_DEBUG_JVM=""
C_O_FLAG_SIZE=""
C_O_FLAG_DEBUG=""
C_O_FLAG_NONE=""
if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
-xprefetch=auto,explicit -xchip=ultra $CC_HIGHEST"
C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
fi
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
C_O_FLAG_HIGHEST_JVM="-O3"
C_O_FLAG_HIGHEST="-O3"
C_O_FLAG_HI="-O3"
C_O_FLAG_NORM="-O2"
C_O_FLAG_SIZE="-Os"
C_O_FLAG_DEBUG="-O0"
C_O_FLAG_DEBUG_JVM="-O0"
C_O_FLAG_NONE="-O0"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# On MacOSX we optimize for size, something
# we should do for all platforms?
C_O_FLAG_HIGHEST_JVM="-Os"
C_O_FLAG_HIGHEST="-Os"
C_O_FLAG_HI="-Os"
C_O_FLAG_NORM="-Os"
C_O_FLAG_DEBUG_JVM=""
else
C_O_FLAG_HIGHEST_JVM="-O3"
C_O_FLAG_HIGHEST="-O3"
C_O_FLAG_HI="-O3"
C_O_FLAG_NORM="-O2"
C_O_FLAG_DEBUG_JVM="-O0"
fi
C_O_FLAG_SIZE="-Os"
C_O_FLAG_DEBUG="-O0"
C_O_FLAG_NONE="-O0"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
C_O_FLAG_HI="-O3 -qinline -qinlglue"
C_O_FLAG_NORM="-O2"
C_O_FLAG_DEBUG="-qnoopt"
# FIXME: Value below not verified.
C_O_FLAG_DEBUG_JVM=""
C_O_FLAG_NONE="-qnoopt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
C_O_FLAG_HIGHEST="-O2"
C_O_FLAG_HI="-O1"
C_O_FLAG_NORM="-O1"
C_O_FLAG_DEBUG="-Od"
C_O_FLAG_DEBUG_JVM=""
C_O_FLAG_NONE="-Od"
C_O_FLAG_SIZE="-Os"
fi
# Now copy to C++ flags
CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
CXX_O_FLAG_HI="$C_O_FLAG_HI"
CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
# In solstudio, also add this to C (but not C++) flags...
C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic"
fi
# Adjust optimization flags according to debug level.
case $DEBUG_LEVEL in
release )
# no adjustment
;;
fastdebug )
# Not quite so much optimization
C_O_FLAG_HI="$C_O_FLAG_NORM"
CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
;;
slowdebug )
# Disable optimization
C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
C_O_FLAG_HI="$C_O_FLAG_DEBUG"
C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
;;
esac
AC_SUBST(C_O_FLAG_HIGHEST_JVM)
AC_SUBST(C_O_FLAG_HIGHEST)
AC_SUBST(C_O_FLAG_HI)
AC_SUBST(C_O_FLAG_NORM)
AC_SUBST(C_O_FLAG_NONE)
AC_SUBST(C_O_FLAG_SIZE)
AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
AC_SUBST(CXX_O_FLAG_HIGHEST)
AC_SUBST(CXX_O_FLAG_HI)
AC_SUBST(CXX_O_FLAG_NORM)
AC_SUBST(CXX_O_FLAG_NONE)
AC_SUBST(CXX_O_FLAG_SIZE)
])
AC_DEFUN([FLAGS_SETUP_CFLAGS],
[
### CFLAGS
FLAGS_SETUP_CFLAGS_HELPER
FLAGS_OS=$OPENJDK_TARGET_OS
FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
FLAGS_CPU=$OPENJDK_TARGET_CPU
FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
FLAGS_OS=$OPENJDK_BUILD_OS
FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
FLAGS_CPU=$OPENJDK_BUILD_CPU
FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
# Tests are only ever compiled for TARGET
CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
AC_SUBST(CFLAGS_TESTLIB)
AC_SUBST(CFLAGS_TESTEXE)
AC_SUBST(CXXFLAGS_TESTLIB)
AC_SUBST(CXXFLAGS_TESTEXE)
])
################################################################################
# platform independent
AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
[
#### OS DEFINES, these should be independent on toolchain
if test "x$OPENJDK_TARGET_OS" = xlinux; then
CFLAGS_OS_DEF_JVM="-DLINUX"
CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
CFLAGS_OS_DEF_JVM="-DSOLARIS"
CFLAGS_OS_DEF_JDK="-D__solaris__"
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
CFLAGS_OS_DEF_JVM="-DAIX"
elif test "x$OPENJDK_TARGET_OS" = xbsd; then
CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
fi
# Setup target OS define. Use OS target name but in upper case.
OPENJDK_TARGET_OS_UPPERCASE=`$ECHO $OPENJDK_TARGET_OS | $TR 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
#### GLOBAL DEFINES
# Set some common defines. These works for all compilers, but assume
# -D is universally accepted.
# Always enable optional macros for VM.
ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
# Setup some hard coded includes
ALWAYS_CFLAGS_JDK=" \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
-I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
-I${TOPDIR}/src/java.base/share/native/libjava \
-I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
-I${TOPDIR}/src/hotspot/share/include \
-I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include"
###############################################################################
# Adjust flags according to debug level.
# Setup debug/release defines
if test "x$DEBUG_LEVEL" = xrelease; then
DEBUG_CFLAGS_JDK="-DNDEBUG"
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED"
fi
else
DEBUG_CFLAGS_JDK="-DDEBUG"
if test "x$TOOLCHAIN_TYPE" = xxlc; then
# We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
# Hotspot now overflows its 64K TOC (currently only for debug),
# so for debug we build with '-qpic=large -bbigtoc'.
DEBUG_CFLAGS_JVM="-qpic=large"
fi
fi
if test "x$DEBUG_LEVEL" != xrelease; then
DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
DEBUG_SYMBOLS_CXXFLAGS_JDK="$CXXFLAGS_DEBUG_SYMBOLS"
fi
#### TOOLCHAIN DEFINES
if test "x$TOOLCHAIN_TYPE" = xgcc; then
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement"
ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ALWAYS_DEFINES_JVM="-D_REENTRANT"
ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \
-D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL"
fi
###############################################################################
#
#
# CFLAGS BASIC
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
-fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new"
TOOLCHAIN_CFLAGS_JDK="-pipe"
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!)
CXXSTD_CXXFLAG="-std=gnu++98"
FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
IF_FALSE: [CXXSTD_CXXFLAG=""])
TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CXXSTD_CXXFLAG"
ADLC_CXXFLAG="$CXXSTD_CXXFLAG"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
# Restrict the debug information created by Clang to avoid
# too big object files and speed the build up a little bit
# (see http://llvm.org/bugs/show_bug.cgi?id=7554)
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
TOOLCHAIN_CFLAGS_JDK="-pipe"
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
TOOLCHAIN_CFLAGS_JDK="-mt"
TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -v -W0,-noglobal" # C only
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
-library=stlport4 -mt -features=no%except"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt" # add on both CFLAGS
TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
-qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
-qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
fi
# CFLAGS WARNINGS STUFF
# Set JVM_CFLAGS warning handling
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function"
if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
# Non-zero builds have stricter warnings
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wundef -Wformat=2"
fi
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wunused-value -Woverloaded-virtual"
if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
# Non-zero builds have stricter warnings
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wreturn-type"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-deprecated"
if test "x$OPENJDK_TARGET_OS" = xlinux; then
WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized"
WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
WARNING_CFLAGS_JDK_CONLY="-errshort=tags"
WARNING_CFLAGS_JDK_CXXONLY="+w"
WARNING_CFLAGS_JDK="-errtags=yes -errfmt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
WARNING_CFLAGS="-W3"
WARNING_CFLAGS_JDK="-wd4800"
fi
# Set some additional per-OS defines.
# Additional macosx handling
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
-mmacosx-version-min=$MACOSX_VERSION_MIN"
if test -n "$MACOSX_VERSION_MAX"; then
OS_CFLAGS="$OS_CFLAGS \
-DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
fi
fi
# Where does this really belong??
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
PICFLAG="-fPIC"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
PICFLAG="-KPIC"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
# one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
# will have to patch this single instruction with a call to some out-of-order code which
# does the load from the TOC. This is of course slow. But in that case we also would have
# to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
# With 'qpic=large' the compiler will by default generate a two-instruction sequence which
# can be patched directly by the linker and does not require a jump to out-of-order code.
# Another alternative instead of using 'qpic=large -bbigtoc' may be to use '-qminimaltoc'
# instead. This creates a distinct TOC for every compilation unit (and thus requires two
# loads for accessing a global variable). But there are rumors that this may be seen as a
# 'performance feature' because of improved code locality of the symbols used in a
# compilation unit.
PICFLAG="-qpic"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
PICFLAG=""
fi
JVM_PICFLAG="$PICFLAG"
JDK_PICFLAG="$PICFLAG"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Linking is different on MacOSX
JDK_PICFLAG=''
if test "x$STATIC_BUILD" = xtrue; then
JVM_PICFLAG=""
fi
fi
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 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"
if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
fi
fi
# EXPORT
AC_SUBST(ADLC_CXXFLAG)
])
################################################################################
# $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_CFLAGS_CPU_DEP],
[
#### CPU DEFINES, these should (in theory) be independent on toolchain
# Setup target CPU
# Setup endianness
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
$1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN"
fi
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
# The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
# Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN="
else
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN="
fi
else
if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
$1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN"
else
$1_DEFINES_CPU_JDK="-D_BIG_ENDIAN"
fi
fi
# setup CPU bit size
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
-D$FLAGS_CPU_LEGACY"
if test "x$FLAGS_CPU_BITS" = x64; then
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
# unpack200.exe.
if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
fi
if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then
# Solaris does not have _LP64=1 in the old build.
# xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
fi
fi
# toolchain dependend, per-cpu
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
if test "x$FLAGS_CPU_ARCH" = xx86; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$FLAGS_CPU" = xx86_64; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
else
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
fi
fi
# CFLAGS PER CPU
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# COMMON to gcc and clang
if test "x$FLAGS_CPU" = xx86; then
# Force compatibility with i586 on 32 bit intel platforms.
$1_CFLAGS_CPU="-march=i586"
fi
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$FLAGS_CPU" = xarm; then
# -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
$1_CFLAGS_CPU="-fsigned-char -Wno-psabi $ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS -DJDK_ARCH_ABI_PROP_NAME='\"\$(JDK_ARCH_ABI_PROP_NAME)\"'"
$1_CFLAGS_CPU_JVM="-DARM"
elif test "x$FLAGS_CPU" = xaarch64; then
if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
$1_CFLAGS_CPU_JVM="-fsigned-char -DARM"
fi
elif test "x$FLAGS_CPU_ARCH" = xppc; then
$1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
if test "x$FLAGS_CPU" = xppc64; then
# -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
# Use ppc64 instructions, but schedule for power5
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
elif test "x$FLAGS_CPU" = xppc64le; then
# Little endian machine uses ELFv2 ABI.
# Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
$1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8"
fi
elif test "x$FLAGS_CPU" = xs390x; then
$1_CFLAGS_CPU="-mbackchain -march=z10"
fi
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
# for all archs except arm and ppc, prevent gcc to omit frame pointer
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$FLAGS_OS" = xlinux; then
# ppc test not really needed for clang
if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
# for all archs except arm and ppc, prevent gcc to omit frame pointer
$1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
fi
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
if test "x$FLAGS_CPU" = xx86_64; then
# NOTE: -xregs=no%frameptr is supposed to be default on x64
$1_CFLAGS_CPU_JDK="-xregs=no%frameptr"
elif test "x$FLAGS_CPU" = xsparcv9; then
$1_CFLAGS_CPU_JVM="-xarch=sparc"
$1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl"
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
if test "x$FLAGS_CPU" = xppc64; then
$1_CFLAGS_CPU_JVM="-qarch=ppc64"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$FLAGS_CPU" = xx86; then
$1_CFLAGS_CPU_JVM="-arch:IA32"
elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
if test "x$DEBUG_LEVEL" != xrelease; then
# NOTE: This is probably redundant; -homeparams is default on
# non-release builds.
$1_CFLAGS_CPU_JVM="-homeparams"
fi
fi
fi
if test "x$TOOLCHAIN_TYPE" = xgcc; then
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($1))
$1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: [4.8], PREFIX: $2,
IF_AT_LEAST: [
# These flags either do not work or give spurious warnings prior to gcc 4.8.
$1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
]
)
fi
# EXPORT to API
CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM $TOOLCHAIN_CFLAGS_JVM \
$OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
$WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
$OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
$WARNING_CFLAGS $WARNING_CFLAGS_JDK"
# Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
# (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
# change in the future.)
CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY $DEBUG_SYMBOLS_CFLAGS_JDK \
$WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
$DEBUG_SYMBOLS_CXXFLAGS_JDK $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
$1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
$1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
$2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
$2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
$2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
$2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
$2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
AC_SUBST($2JVM_CFLAGS)
AC_SUBST($2CFLAGS_JDKLIB)
AC_SUBST($2CFLAGS_JDKEXE)
AC_SUBST($2CXXFLAGS_JDKLIB)
AC_SUBST($2CXXFLAGS_JDKEXE)
])
# FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
# Arguments:
# $1 - Prefix for each variable defined.
AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
[
# These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
# runs afoul of the more aggressive versions of these optimisations.
# Notably, value range propagation now assumes that the this pointer of C++
# member functions is non-null.
NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
$1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
])
# Documentation on common flags used for solstudio in HIGHEST.
#
# WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
# done with care, there are some assumptions below that need to
# be understood about the use of pointers, and IEEE behavior.
#
# -fns: Use non-standard floating point mode (not IEEE 754)
# -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
# -fsingle: Use single precision floating point with 'float'
# -xalias_level=basic: Assume memory references via basic pointer types do not alias
# (Source with excessing pointer casting and data access with mixed
# pointer types are not recommended)
# -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
# (If you expect perfect errno behavior, do not use this)
# -xdepend: Loop data dependency optimizations (need -xO3 or higher)
# -xrestrict: Pointer parameters to functions do not overlap
# (Similar to -xalias_level=basic usage, but less obvious sometimes.
# If you pass in multiple pointers to the same data, do not use this)
# -xlibmil: Inline some library routines
# (If you expect perfect errno behavior, do not use this)
# -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
# (If you expect perfect errno behavior, do not use this)
# Can cause undefined external on Solaris 8 X86 on __sincos, removing for now

View File

@ -0,0 +1,234 @@
#
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
#
AC_DEFUN([FLAGS_SETUP_LDFLAGS],
[
FLAGS_SETUP_LDFLAGS_HELPER
# Setup the target toolchain
# On some platforms (mac) the linker warns about non existing -L dirs.
# For any of the variants server, client or minimal, the dir matches the
# variant name. The "main" variant should be used for linking. For the
# rest, the dir is just server.
if HOTSPOT_CHECK_JVM_VARIANT(server) || HOTSPOT_CHECK_JVM_VARIANT(client) \
|| HOTSPOT_CHECK_JVM_VARIANT(minimal); then
TARGET_JVM_VARIANT_PATH=$JVM_VARIANT_MAIN
else
TARGET_JVM_VARIANT_PATH=server
fi
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_LDFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
LDFLAGS_TESTLIB="$LDFLAGS_JDKLIB"
LDFLAGS_TESTEXE="$LDFLAGS_JDKEXE ${TARGET_LDFLAGS_JDK_LIBPATH}"
AC_SUBST(LDFLAGS_TESTLIB)
AC_SUBST(LDFLAGS_TESTEXE)
])
################################################################################
# CPU independent LDFLAGS setup, used for both target and build toolchain.
AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
[
# Setup basic LDFLAGS
if test "x$TOOLCHAIN_TYPE" = xgcc; then
# "-z relro" supported in GNU binutils 2.17 and later
LINKER_RELRO_FLAG="-Wl,-z,relro"
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG],
IF_TRUE: [HAS_LINKER_RELRO=true],
IF_FALSE: [HAS_LINKER_RELRO=false])
# "-z now" supported in GNU binutils 2.11 and later
LINKER_NOW_FLAG="-Wl,-z,now"
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG],
IF_TRUE: [HAS_LINKER_NOW=true],
IF_FALSE: [HAS_LINKER_NOW=false])
# If this is a --hash-style=gnu system, use --hash-style=both, why?
# We have previously set HAS_GNU_HASH if this is the case
if test -n "$HAS_GNU_HASH"; then
BASIC_LDFLAGS="-Wl,--hash-style=both"
LIBJSIG_HASHSTYLE_LDFLAGS="-Wl,--hash-style=both"
fi
# And since we now know that the linker is gnu, then add -z defs, to forbid
# undefined symbols in object files.
BASIC_LDFLAGS="$BASIC_LDFLAGS -Wl,-z,defs"
BASIC_LDFLAGS_JVM_ONLY="-Wl,-z,noexecstack -Wl,-O1"
BASIC_LDFLAGS_JDK_LIB_ONLY="-Wl,-z,noexecstack"
LIBJSIG_NOEXECSTACK_LDFLAGS="-Wl,-z,noexecstack"
if test "x$HAS_LINKER_RELRO" = "xtrue"; then
BASIC_LDFLAGS_JVM_ONLY="$BASIC_LDFLAGS_JVM_ONLY $LINKER_RELRO_FLAG"
fi
elif test "x$TOOLCHAIN_TYPE" = xclang; then
BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
-stdlib=libstdc++ -fPIC"
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
BASIC_LDFLAGS="-Wl,-z,defs"
BASIC_LDFLAGS_ONLYCXX="-norunpath"
BASIC_LDFLAGS_ONLYCXX_JDK_ONLY="-xnolib"
BASIC_LDFLAGS_JDK_ONLY="-ztext"
BASIC_LDFLAGS_JVM_ONLY="-library=%none -mt -z noversion"
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
BASIC_LDFLAGS="-b64 -brtl -bnolibpath -bexpall -bernotok -btextpsize:64K \
-bdatapsize:64K -bstackpsize:64K"
BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BASIC_LDFLAGS="-nologo -opt:ref"
BASIC_LDFLAGS_JDK_ONLY="-incremental:no"
BASIC_LDFLAGS_JVM_ONLY="-opt:icf,8 -subsystem:windows -base:0x8000000"
fi
# Setup OS-dependent LDFLAGS
if test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Assume clang or gcc.
# FIXME: We should really generalize SET_SHARED_LIBRARY_ORIGIN instead.
OS_LDFLAGS_JVM_ONLY="-Wl,-rpath,@loader_path/. -Wl,-rpath,@loader_path/.."
OS_LDFLAGS_JDK_ONLY="-mmacosx-version-min=$MACOSX_VERSION_MIN"
fi
fi
# Setup debug level-dependent LDFLAGS
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x$OPENJDK_TARGET_OS" = xlinux; then
if test x$DEBUG_LEVEL = xrelease; then
DEBUGLEVEL_LDFLAGS_JDK_ONLY="$DEBUGLEVEL_LDFLAGS_JDK_ONLY -Wl,-O1"
else
# mark relocations read only on (fast/slow) debug builds
if test "x$HAS_LINKER_RELRO" = "xtrue"; then
DEBUGLEVEL_LDFLAGS_JDK_ONLY="$LINKER_RELRO_FLAG"
fi
fi
if test x$DEBUG_LEVEL = xslowdebug; then
if test "x$HAS_LINKER_NOW" = "xtrue"; then
# do relocations at load
DEBUGLEVEL_LDFLAGS="$LINKER_NOW_FLAG"
fi
fi
fi
elif test "x$TOOLCHAIN_TYPE" = xxlc; then
# We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
# Hotspot now overflows its 64K TOC (currently only for debug),
# so we build with '-qpic=large -bbigtoc'.
if test "x$DEBUG_LEVEL" != xrelease; then
DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
fi
fi
# Setup LDFLAGS for linking executables
if test "x$TOOLCHAIN_TYPE" = xgcc; then
EXECUTABLE_LDFLAGS="$EXECUTABLE_LDFLAGS -Wl,--allow-shlib-undefined"
fi
# Export some intermediate variables for compatibility
LDFLAGS_CXX_JDK="$BASIC_LDFLAGS_ONLYCXX $BASIC_LDFLAGS_ONLYCXX_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY"
AC_SUBST(LDFLAGS_CXX_JDK)
AC_SUBST(LIBJSIG_HASHSTYLE_LDFLAGS)
AC_SUBST(LIBJSIG_NOEXECSTACK_LDFLAGS)
])
################################################################################
# $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_LDFLAGS_CPU_DEP],
[
# Setup CPU-dependent basic LDFLAGS. These can differ between the target and
# build toolchain.
if test "x$TOOLCHAIN_TYPE" = xgcc; then
if test "x${OPENJDK_$1_CPU}" = xx86; then
$1_CPU_LDFLAGS_JVM_ONLY="-march=i586"
elif test "x$OPENJDK_$1_CPU" = xarm; then
$1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
$1_CPU_LDFLAGS="$ARM_ARCH_TYPE_FLAGS $ARM_FLOAT_TYPE_FLAGS"
elif test "x$FLAGS_CPU" = xaarch64; then
if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
$1_CPU_LDFLAGS_JVM_ONLY="${$1_CPU_LDFLAGS_JVM_ONLY} -fsigned-char"
fi
fi
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
if test "x${OPENJDK_$1_CPU}" = "xsparcv9"; then
$1_CPU_LDFLAGS_JVM_ONLY="-xarch=sparc"
fi
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x${OPENJDK_$1_CPU}" = "xx86"; then
$1_CPU_LDFLAGS="-safeseh"
# NOTE: Old build added -machine. Probably not needed.
$1_CPU_LDFLAGS_JVM_ONLY="-machine:I386"
$1_CPU_EXECUTABLE_LDFLAGS="-stack:327680"
else
$1_CPU_LDFLAGS_JVM_ONLY="-machine:AMD64"
$1_CPU_EXECUTABLE_LDFLAGS="-stack:1048576"
fi
fi
# JVM_VARIANT_PATH depends on if this is build or target...
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
$1_LDFLAGS_JDK_LIBPATH="-libpath:${OUTPUTDIR}/support/modules_libs/java.base"
else
$1_LDFLAGS_JDK_LIBPATH="-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
-L\$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/${$1_JVM_VARIANT_PATH}"
fi
# Export variables according to old definitions, prefix with $2 if present.
LDFLAGS_JDK_COMMON="$BASIC_LDFLAGS $BASIC_LDFLAGS_JDK_ONLY \
$OS_LDFLAGS_JDK_ONLY $DEBUGLEVEL_LDFLAGS_JDK_ONLY ${$2EXTRA_LDFLAGS}"
$2LDFLAGS_JDKLIB="$LDFLAGS_JDK_COMMON $BASIC_LDFLAGS_JDK_LIB_ONLY \
${$1_LDFLAGS_JDK_LIBPATH} $SHARED_LIBRARY_FLAGS"
$2LDFLAGS_JDKEXE="$LDFLAGS_JDK_COMMON $EXECUTABLE_LDFLAGS \
${$1_CPU_EXECUTABLE_LDFLAGS}"
$2JVM_LDFLAGS="$BASIC_LDFLAGS $BASIC_LDFLAGS_JVM_ONLY $OS_LDFLAGS_JVM_ONLY \
$DEBUGLEVEL_LDFLAGS $DEBUGLEVEL_LDFLAGS_JVM_ONLY $BASIC_LDFLAGS_ONLYCXX \
${$1_CPU_LDFLAGS} ${$1_CPU_LDFLAGS_JVM_ONLY} ${$2EXTRA_LDFLAGS}"
AC_SUBST($2LDFLAGS_JDKLIB)
AC_SUBST($2LDFLAGS_JDKEXE)
AC_SUBST($2JVM_LDFLAGS)
])

View File

@ -0,0 +1,126 @@
#
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
################################################################################
#
# Setup flags for other tools than C/C++ compiler
#
AC_DEFUN([FLAGS_SETUP_ARFLAGS],
[
# FIXME: figure out if we should select AR flags depending on OS or toolchain.
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ARFLAGS="-r -mmacosx-version-min=$MACOSX_VERSION_MIN"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
ARFLAGS="-X64"
elif test "x$OPENJDK_TARGET_OS" = xwindows; then
# lib.exe is used as AR to create static libraries.
ARFLAGS="-nologo -NODEFAULTLIB:MSVCRT"
else
ARFLAGS=""
fi
AC_SUBST(ARFLAGS)
])
AC_DEFUN([FLAGS_SETUP_STRIPFLAGS],
[
## Setup strip.
# FIXME: should this really be per platform, or should it be per toolchain type?
# strip is not provided by clang or solstudio; so guessing platform makes most sense.
# FIXME: we should really only export STRIPFLAGS from here, not POST_STRIP_CMD.
if test "x$OPENJDK_TARGET_OS" = xlinux; then
STRIPFLAGS="-g"
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
STRIPFLAGS="-x"
elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
STRIPFLAGS="-S"
elif test "x$OPENJDK_TARGET_OS" = xaix; then
STRIPFLAGS="-X32_64"
fi
AC_SUBST(STRIPFLAGS)
])
AC_DEFUN([FLAGS_SETUP_RCFLAGS],
[
# On Windows, we need to set RC flags.
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
RC_FLAGS="-nologo -l0x409"
JVM_RCFLAGS="-nologo"
if test "x$DEBUG_LEVEL" = xrelease; then
RC_FLAGS="$RC_FLAGS -DNDEBUG"
JVM_RCFLAGS="$JVM_RCFLAGS -DNDEBUG"
fi
# The version variables used to create RC_FLAGS may be overridden
# in a custom configure script, or possibly the command line.
# Let those variables be expanded at make time in spec.gmk.
# The \$ are escaped to the shell, and the $(...) variables
# are evaluated by make.
RC_FLAGS="$RC_FLAGS \
-D\"JDK_VERSION_STRING=\$(VERSION_STRING)\" \
-D\"JDK_COMPANY=\$(COMPANY_NAME)\" \
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
-D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_FEATURE)\" \
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
JVM_RCFLAGS="$JVM_RCFLAGS \
-D\"HS_BUILD_ID=\$(VERSION_STRING)\" \
-D\"HS_COMPANY=\$(COMPANY_NAME)\" \
-D\"JDK_DOTVER=\$(VERSION_NUMBER_FOUR_POSITIONS)\" \
-D\"HS_COPYRIGHT=Copyright $COPYRIGHT_YEAR\" \
-D\"HS_NAME=\$(PRODUCT_NAME) \$(VERSION_SHORT)\" \
-D\"JDK_VER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\" \
-D\"HS_FNAME=jvm.dll\" \
-D\"HS_INTERNAL_NAME=jvm\""
fi
AC_SUBST(RC_FLAGS)
AC_SUBST(JVM_RCFLAGS)
])
################################################################################
# platform independent
AC_DEFUN([FLAGS_SETUP_ASFLAGS],
[
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
JVM_BASIC_ASFLAGS="-x assembler-with-cpp -mno-omit-leaf-frame-pointer -mstack-alignment=16"
fi
])
################################################################################
# $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_ASFLAGS_CPU_DEP],
[
# Misuse EXTRA_CFLAGS to mimic old behavior
$2JVM_ASFLAGS="$JVM_BASIC_ASFLAGS ${$2EXTRA_CFLAGS}"
AC_SUBST($2JVM_ASFLAGS)
])

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -277,13 +277,9 @@ AC_DEFUN_ONCE([HOTSPOT_SETUP_JVM_FEATURES],
if test "x$OPENJDK_TARGET_CPU" = xarm; then
HOTSPOT_TARGET_CPU=arm_32
HOTSPOT_TARGET_CPU_DEFINE="ARM32"
JVM_LDFLAGS="$JVM_LDFLAGS -fsigned-char"
JVM_CFLAGS="$JVM_CFLAGS -DARM -fsigned-char"
elif test "x$OPENJDK_TARGET_CPU" = xaarch64 && test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
HOTSPOT_TARGET_CPU=arm_64
HOTSPOT_TARGET_CPU_ARCH=arm
JVM_LDFLAGS="$JVM_LDFLAGS -fsigned-char"
JVM_CFLAGS="$JVM_CFLAGS -DARM -fsigned-char"
fi
# Verify that dependencies are met for explicitly set features.

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -81,6 +81,9 @@ AC_DEFUN_ONCE([LIB_SETUP_STD_LIBS],
if test "x$TOOLCHAIN_TYPE" = xsolstudio && test "x$LIBCXX" = x; then
LIBCXX="${SYSROOT}/usr/lib${OPENJDK_TARGET_CPU_ISADIR}/libCrun.so.1"
fi
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
LIBCXX_JVM="-lCrun"
fi
AC_SUBST(LIBCXX)

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -101,6 +101,68 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBRARIES],
LIB_SETUP_BUNDLED_LIBS
LIB_SETUP_MISC_LIBS
LIB_SETUP_SOLARIS_STLPORT
if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ALWAYS_LIBS="-lc"
else
ALWAYS_LIBS=""
fi
BASIC_JDKLIB_LIBS=""
if test "x$TOOLCHAIN_TYPE" != xmicrosoft; then
BASIC_JDKLIB_LIBS="-ljava -ljvm"
fi
BASIC_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS $ALWAYS_LIBS"
# Math library
if test "x$OPENJDK_TARGET_OS" != xsolaris; then
BASIC_JVM_LIBS="$LIBM"
else
# FIXME: This hard-coded path is not really proper.
if test "x$OPENJDK_TARGET_CPU" = xx86_64; then
BASIC_SOLARIS_LIBM_LIBS="/usr/lib/amd64/libm.so.1"
elif test "x$OPENJDK_TARGET_CPU" = xsparcv9; then
BASIC_SOLARIS_LIBM_LIBS="/usr/lib/sparcv9/libm.so.1"
fi
BASIC_JVM_LIBS="$BASIC_SOLARIS_LIBM_LIBS"
fi
# Dynamic loading library
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBDL"
fi
# Threading library
if test "x$OPENJDK_TARGET_OS" = xlinux || test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lpthread"
elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lthread"
fi
if test "x$OPENJDK_TARGET_OS" = xsolaris; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS -lsocket -lsched -ldoor -ldemangle -lnsl \
-lrt"
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $LIBCXX_JVM"
fi
if test "x$OPENJDK_TARGET_OS" = xwindows; then
BASIC_JVM_LIBS="$BASIC_JVM_LIBS kernel32.lib user32.lib gdi32.lib winspool.lib \
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib \
wsock32.lib winmm.lib version.lib psapi.lib"
fi
BASIC_JVM_LIBS="$BASIC_JVM_LIBS $ALWAYS_LIBS"
JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
JDKEXE_LIBS=""
JVM_LIBS="$BASIC_JVM_LIBS"
OPENJDK_BUILD_JDKLIB_LIBS="$BASIC_JDKLIB_LIBS"
OPENJDK_BUILD_JVM_LIBS="$BASIC_JVM_LIBS"
AC_SUBST(JDKLIB_LIBS)
AC_SUBST(JDKEXE_LIBS)
AC_SUBST(JVM_LIBS)
AC_SUBST(OPENJDK_BUILD_JDKLIB_LIBS)
AC_SUBST(OPENJDK_BUILD_JVM_LIBS)
])
################################################################################

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -403,15 +403,6 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
OPENJDK_$1_BUNDLE_PLATFORM="${OPENJDK_$1_OS_BUNDLE}-${OPENJDK_$1_CPU_BUNDLE}"
AC_SUBST(OPENJDK_$1_BUNDLE_PLATFORM)
if test "x$OPENJDK_$1_CPU_BITS" = x64; then
# -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
# unpack200.exe. This variable is used in
# FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK_HELPER.
if test "x$OPENJDK_$1_OS" = xlinux || test "x$OPENJDK_$1_OS" = xmacosx; then
OPENJDK_$1_ADD_LP64="-D_LP64=1"
fi
fi
if test "x$COMPILE_TYPE" = "xcross"; then
# FIXME: ... or should this include reduced builds..?
DEFINE_CROSS_COMPILE_ARCH="CROSS_COMPILE_ARCH:=$OPENJDK_$1_CPU_LEGACY"
@ -563,31 +554,6 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_OS_VERSION],
AC_SUBST(OS_VERSION_MICRO)
])
# Support macro for PLATFORM_SETUP_OPENJDK_TARGET_BITS.
# Add -mX to various FLAGS variables.
AC_DEFUN([PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS],
[
# When we add flags to the "official" CFLAGS etc, we need to
# keep track of these additions in ADDED_CFLAGS etc. These
# will later be checked to make sure only controlled additions
# have been made to CFLAGS etc.
ADDED_CFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
ADDED_CXXFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
ADDED_LDFLAGS=" ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
CFLAGS="${CFLAGS}${ADDED_CFLAGS}"
CXXFLAGS="${CXXFLAGS}${ADDED_CXXFLAGS}"
LDFLAGS="${LDFLAGS}${ADDED_LDFLAGS}"
CFLAGS_JDK="${CFLAGS_JDK}${ADDED_CFLAGS}"
CXXFLAGS_JDK="${CXXFLAGS_JDK}${ADDED_CXXFLAGS}"
LDFLAGS_JDK="${LDFLAGS_JDK}${ADDED_LDFLAGS}"
JVM_CFLAGS="$JVM_CFLAGS $ADDED_CFLAGS"
JVM_LDFLAGS="$JVM_LDFLAGS $ADDED_LDFLAGS"
JVM_ASFLAGS="$JVM_ASFLAGS $ADDED_CFLAGS"
])
AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
[
###############################################################################
@ -597,22 +563,6 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
# is made at runtime.)
#
if test "x$OPENJDK_TARGET_OS" = xsolaris || test "x$OPENJDK_TARGET_OS" = xaix; then
# Always specify -m flag on Solaris
# And -q on AIX because otherwise the compiler produces 32-bit objects by default
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
elif test "x$COMPILE_TYPE" = xreduced; then
if test "x$OPENJDK_TARGET_OS_TYPE" = xunix; then
# Specify -m if running reduced on unix platforms
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
fi
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
JVM_CFLAGS="$JVM_CFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
JVM_LDFLAGS="$JVM_LDFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
JVM_ASFLAGS="$JVM_ASFLAGS ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}"
fi
# Make compilation sanity check
AC_CHECK_HEADERS([stdio.h], , [
AC_MSG_NOTICE([Failed to compile stdio.h. This likely implies missing compile dependencies.])
@ -635,33 +585,14 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_TARGET_BITS],
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
# This situation may happen on 64-bit platforms where the compiler by default only generates 32-bit objects
# Let's try to implicitely set the compilers target architecture and retry the test
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS).])
AC_MSG_NOTICE([Retrying with platforms compiler target bits flag to ${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}])
PLATFORM_SET_COMPILER_TARGET_BITS_FLAGS
# We have to unset 'ac_cv_sizeof_int_p' first, otherwise AC_CHECK_SIZEOF will use the previously cached value!
unset ac_cv_sizeof_int_p
# And we have to undef the definition of SIZEOF_INT_P in confdefs.h by the previous invocation of AC_CHECK_SIZEOF
cat >>confdefs.h <<_ACEOF
#undef SIZEOF_INT_P
_ACEOF
AC_CHECK_SIZEOF([int *], [1111])
TESTED_TARGET_CPU_BITS=`expr 8 \* $ac_cv_sizeof_int_p`
if test "x$TESTED_TARGET_CPU_BITS" != "x$OPENJDK_TARGET_CPU_BITS"; then
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
if test "x$COMPILE_TYPE" = xreduced; then
HELP_MSG_MISSING_DEPENDENCY([reduced])
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
elif test "x$COMPILE_TYPE" = xcross; then
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
fi
AC_MSG_ERROR([Cannot continue.])
AC_MSG_NOTICE([The tested number of bits in the target ($TESTED_TARGET_CPU_BITS) differs from the number of bits expected to be found in the target ($OPENJDK_TARGET_CPU_BITS)])
if test "x$COMPILE_TYPE" = xreduced; then
HELP_MSG_MISSING_DEPENDENCY([reduced])
AC_MSG_NOTICE([You are doing a reduced build. Check that you have 32-bit libraries installed. $HELP_MSG])
elif test "x$COMPILE_TYPE" = xcross; then
AC_MSG_NOTICE([You are doing a cross-compilation. Check that you have all target platform libraries installed.])
fi
AC_MSG_ERROR([Cannot continue.])
fi
fi

View File

@ -423,7 +423,7 @@ CFLAGS_WARNINGS_ARE_ERRORS:=@CFLAGS_WARNINGS_ARE_ERRORS@
WARNINGS_AS_ERRORS := @WARNINGS_AS_ERRORS@
CFLAGS_CCACHE:=@CFLAGS_CCACHE@
CXXSTD_CXXFLAG=@CXXSTD_CXXFLAG@
ADLC_CXXFLAG=@ADLC_CXXFLAG@
# Tools that potentially need to be cross compilation aware.
CC:=@FIXPATH@ @CCACHE@ @ICECC@ @CC@
@ -436,8 +436,8 @@ CXXFLAGS_JDKLIB:=@CXXFLAGS_JDKLIB@
CFLAGS_JDKEXE:=@CFLAGS_JDKEXE@
CXXFLAGS_JDKEXE:=@CXXFLAGS_JDKEXE@
LDFLAGS_HASH_STYLE := @LDFLAGS_HASH_STYLE@
LDFLAGS_NO_EXEC_STACK := @LDFLAGS_NO_EXEC_STACK@
LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@
LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@
JVM_CFLAGS := @JVM_CFLAGS@
JVM_CFLAGS_SYMBOLS := @JVM_CFLAGS_SYMBOLS@
@ -524,7 +524,6 @@ SET_SHARED_LIBRARY_MAPFILE=@SET_SHARED_LIBRARY_MAPFILE@
# Options for C/CXX compiler to be used if linking is performed
# using reorder file
C_FLAG_REORDER:=@C_FLAG_REORDER@
CXX_FLAG_REORDER:=@CXX_FLAG_REORDER@
#
# Options for generating debug symbols

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -783,7 +783,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
fi
BUILD_SYSROOT="$BUILD_DEVKIT_SYSROOT"
FLAGS_SETUP_SYSROOT_FLAGS([BUILD_])
# Fallback default of just /bin if DEVKIT_PATH is not defined
if test "x$BUILD_DEVKIT_TOOLCHAIN_PATH" = x; then
@ -830,8 +829,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
BUILD_AS="$AS"
BUILD_OBJCOPY="$OBJCOPY"
BUILD_STRIP="$STRIP"
BUILD_SYSROOT_CFLAGS="$SYSROOT_CFLAGS"
BUILD_SYSROOT_LDFLAGS="$SYSROOT_LDFLAGS"
BUILD_AR="$AR"
TOOLCHAIN_PREPARE_FOR_VERSION_COMPARISONS([], [OPENJDK_BUILD_])
@ -843,8 +840,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
AC_SUBST(BUILD_LDCXX)
AC_SUBST(BUILD_NM)
AC_SUBST(BUILD_AS)
AC_SUBST(BUILD_SYSROOT_CFLAGS)
AC_SUBST(BUILD_SYSROOT_LDFLAGS)
AC_SUBST(BUILD_AR)
])
@ -876,24 +871,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
# If this is a --hash-style=gnu system, use --hash-style=both, why?
HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
# This is later checked when setting flags.
# "-Og" suppported for GCC 4.8 and later
CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CFLAG_OPTIMIZE_DEBUG_FLAG],
IF_TRUE: [HAS_CFLAG_OPTIMIZE_DEBUG=true],
IF_FALSE: [HAS_CFLAG_OPTIMIZE_DEBUG=false])
# "-z relro" supported in GNU binutils 2.17 and later
LINKER_RELRO_FLAG="-Wl,-z,relro"
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_RELRO_FLAG],
IF_TRUE: [HAS_LINKER_RELRO=true],
IF_FALSE: [HAS_LINKER_RELRO=false])
# "-z now" supported in GNU binutils 2.11 and later
LINKER_NOW_FLAG="-Wl,-z,now"
FLAGS_LINKER_CHECK_ARGUMENTS(ARGUMENT: [$LINKER_NOW_FLAG],
IF_TRUE: [HAS_LINKER_NOW=true],
IF_FALSE: [HAS_LINKER_NOW=false])
fi
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed

View File

@ -567,7 +567,7 @@ define SetupNativeCompilationBody
ifneq ($$($1_REORDER), )
$1_EXTRA_CFLAGS += $$(C_FLAG_REORDER)
$1_EXTRA_CXXFLAGS += $$(CXX_FLAG_REORDER)
$1_EXTRA_CXXFLAGS += $$(C_FLAG_REORDER)
endif
# Pass the library name for static JNI library naming

View File

@ -52,7 +52,7 @@ ifeq ($(call check-jvm-feature, compiler2), true)
endif
# Set the C++ standard if supported
ADLC_CFLAGS += $(CXXSTD_CXXFLAG)
ADLC_CFLAGS += $(ADLC_CXXFLAG)
# NOTE: The old build didn't set -DASSERT for windows but it doesn't seem to
# hurt.

View File

@ -36,7 +36,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(STATIC_BUILD), false)
ifeq ($(OPENJDK_TARGET_OS), linux)
LIBJSIG_CFLAGS := -fPIC -D_GNU_SOURCE -D_REENTRANT $(EXTRA_CFLAGS)
LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE) ${LDFLAGS_NO_EXEC_STACK} $(EXTRA_CFLAGS)
LIBJSIG_LDFLAGS := $(LIBJSIG_HASHSTYLE_LDFLAGS) ${LIBJSIG_NOEXECSTACK_LDFLAGS} $(EXTRA_CFLAGS)
LIBJSIG_LIBS := $(LIBDL)
# NOTE: The old build compiled this library without -soname.
@ -76,7 +76,7 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
else ifeq ($(OPENJDK_TARGET_OS), macosx)
LIBJSIG_CFLAGS := -m64 -D_GNU_SOURCE -pthread -mno-omit-leaf-frame-pointer -mstack-alignment=16 -fPIC
LIBJSIG_LDFLAGS := $(LDFLAGS_HASH_STYLE)
LIBJSIG_LDFLAGS := $(LIBJSIG_HASHSTYLE_LDFLAGS)
else
$(error Unknown target OS $(OPENJDK_TARGET_OS) in CompileLibjsig.gmk)
endif