annotate make/autoconf/flags-cflags.m4 @ 51872:0ce279d8c9cd

8207941: javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java fails on machines without Arial font [testbug] Reviewed-by: goetz, psadhukhan
author mbaesken
date Tue, 24 Jul 2018 09:27:42 +0200
parents 9f781ce22e7d
children 3965b3332610
rev   line source
ihse@49551 1 #
ihse@49551 2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
ihse@49551 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
ihse@49551 4 #
ihse@49551 5 # This code is free software; you can redistribute it and/or modify it
ihse@49551 6 # under the terms of the GNU General Public License version 2 only, as
ihse@49551 7 # published by the Free Software Foundation. Oracle designates this
ihse@49551 8 # particular file as subject to the "Classpath" exception as provided
ihse@49551 9 # by Oracle in the LICENSE file that accompanied this code.
ihse@49551 10 #
ihse@49551 11 # This code is distributed in the hope that it will be useful, but WITHOUT
ihse@49551 12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
ihse@49551 13 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
ihse@49551 14 # version 2 for more details (a copy is included in the LICENSE file that
ihse@49551 15 # accompanied this code).
ihse@49551 16 #
ihse@49551 17 # You should have received a copy of the GNU General Public License version
ihse@49551 18 # 2 along with this work; if not, write to the Free Software Foundation,
ihse@49551 19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
ihse@49551 20 #
ihse@49551 21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ihse@49551 22 # or visit www.oracle.com if you need additional information or have any
ihse@49551 23 # questions.
ihse@49551 24 #
ihse@49551 25
ihse@49551 26 ################################################################################
ihse@49551 27 #
ihse@49551 28 # Setup flags for C/C++ compiler
ihse@49551 29 #
ihse@49551 30
ihse@49551 31 ###############################################################################
ihse@49551 32 #
ihse@49551 33 # How to compile shared libraries.
ihse@49551 34 #
ihse@49551 35 AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
ihse@49551 36 [
ihse@49551 37 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 38 C_FLAG_REORDER=''
ihse@49551 39
ihse@49551 40 # Default works for linux, might work on other platforms as well.
ihse@49551 41 SHARED_LIBRARY_FLAGS='-shared'
ihse@49551 42 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
ihse@49551 43 SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
ihse@49551 44 SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
ihse@49551 45 SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
ihse@49551 46
ihse@49551 47 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 48 C_FLAG_REORDER=''
ihse@49551 49
ihse@49551 50 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@49551 51 # Linking is different on MacOSX
ihse@49551 52 SHARED_LIBRARY_FLAGS="-dynamiclib -compatibility_version 1.0.0 -current_version 1.0.0"
ihse@49551 53 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,@loader_path$(or [$]1,/.)'
ihse@49551 54 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
ihse@49551 55 SET_SHARED_LIBRARY_NAME='-Wl,-install_name,@rpath/[$]1'
ihse@49551 56 SET_SHARED_LIBRARY_MAPFILE='-Wl,-exported_symbols_list,[$]1'
ihse@49551 57
ihse@49551 58 else
ihse@49551 59 # Default works for linux, might work on other platforms as well.
ihse@49551 60 SHARED_LIBRARY_FLAGS='-shared'
ihse@49551 61 SET_EXECUTABLE_ORIGIN='-Wl,-rpath,\$$ORIGIN[$]1'
ihse@49551 62 SET_SHARED_LIBRARY_NAME='-Wl,-soname=[$]1'
ihse@49551 63 SET_SHARED_LIBRARY_MAPFILE='-Wl,-version-script=[$]1'
ihse@49551 64
ihse@49551 65 # arm specific settings
ihse@49551 66 if test "x$OPENJDK_TARGET_CPU" = "xarm"; then
ihse@49551 67 # '-Wl,-z,origin' isn't used on arm.
ihse@49551 68 SET_SHARED_LIBRARY_ORIGIN='-Wl,-rpath,\$$$$ORIGIN[$]1'
ihse@49551 69 else
ihse@49551 70 SET_SHARED_LIBRARY_ORIGIN="-Wl,-z,origin $SET_EXECUTABLE_ORIGIN"
ihse@49551 71 fi
ihse@49551 72 fi
ihse@49551 73
ihse@49551 74 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 75 C_FLAG_REORDER='-xF'
ihse@49551 76 SHARED_LIBRARY_FLAGS="-G"
ihse@49551 77 SET_EXECUTABLE_ORIGIN='-R\$$ORIGIN[$]1'
ihse@49551 78 SET_SHARED_LIBRARY_ORIGIN="$SET_EXECUTABLE_ORIGIN"
ihse@49551 79 SET_SHARED_LIBRARY_NAME='-h [$]1'
ihse@49551 80 SET_SHARED_LIBRARY_MAPFILE='-M[$]1'
ihse@49551 81
ihse@49551 82 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 83 C_FLAG_REORDER=''
ihse@49551 84 SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
ihse@49551 85 SET_EXECUTABLE_ORIGIN=""
ihse@49551 86 SET_SHARED_LIBRARY_ORIGIN=''
ihse@49551 87 SET_SHARED_LIBRARY_NAME=''
ihse@49551 88 SET_SHARED_LIBRARY_MAPFILE=''
ihse@49551 89
ihse@49551 90 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 91 C_FLAG_REORDER=''
ihse@49551 92 SHARED_LIBRARY_FLAGS="-dll"
ihse@49551 93 SET_EXECUTABLE_ORIGIN=''
ihse@49551 94 SET_SHARED_LIBRARY_ORIGIN=''
ihse@49551 95 SET_SHARED_LIBRARY_NAME=''
ihse@49551 96 SET_SHARED_LIBRARY_MAPFILE='-def:[$]1'
ihse@49551 97 fi
ihse@49551 98
ihse@49551 99 AC_SUBST(C_FLAG_REORDER)
ihse@49551 100 AC_SUBST(SET_EXECUTABLE_ORIGIN)
ihse@49551 101 AC_SUBST(SET_SHARED_LIBRARY_ORIGIN)
ihse@49551 102 AC_SUBST(SET_SHARED_LIBRARY_NAME)
ihse@49551 103 AC_SUBST(SET_SHARED_LIBRARY_MAPFILE)
ihse@49551 104 AC_SUBST(SHARED_LIBRARY_FLAGS)
ihse@49551 105 ])
ihse@49551 106
ihse@49551 107 AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
ihse@49551 108 [
sgehwolf@51769 109 # By default don't set any specific assembler debug
sgehwolf@51769 110 # info flags for toolchains unless we know they work.
sgehwolf@51769 111 # See JDK-8207057.
sgehwolf@51769 112 ASFLAGS_DEBUG_SYMBOLS=""
ihse@49551 113 # Debug symbols
ihse@49551 114 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49587 115 CFLAGS_DEBUG_SYMBOLS="-g"
sgehwolf@51769 116 ASFLAGS_DEBUG_SYMBOLS="-g"
ihse@49551 117 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 118 CFLAGS_DEBUG_SYMBOLS="-g"
sgehwolf@51769 119 ASFLAGS_DEBUG_SYMBOLS="-g"
ihse@49551 120 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 121 # -g0 enables debug symbols without disabling inlining.
ihse@49586 122 CFLAGS_DEBUG_SYMBOLS="-g0 -xs"
ihse@49551 123 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 124 CFLAGS_DEBUG_SYMBOLS="-g"
ihse@49551 125 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49591 126 CFLAGS_DEBUG_SYMBOLS="-Z7 -d2Zi+"
ihse@49551 127 fi
ihse@49551 128
ihse@49551 129 AC_SUBST(CFLAGS_DEBUG_SYMBOLS)
sgehwolf@51769 130 AC_SUBST(ASFLAGS_DEBUG_SYMBOLS)
ihse@49551 131 ])
ihse@49551 132
ihse@49551 133 AC_DEFUN([FLAGS_SETUP_WARNINGS],
ihse@49551 134 [
ihse@49551 135 AC_ARG_ENABLE([warnings-as-errors], [AS_HELP_STRING([--disable-warnings-as-errors],
ihse@49551 136 [do not consider native warnings to be an error @<:@enabled@:>@])])
ihse@49551 137
stuefe@50432 138 # Set default value.
stuefe@50432 139 if test "x$TOOLCHAIN_TYPE" = xxlc; then
stuefe@50432 140 WARNINGS_AS_ERRORS=false
stuefe@50432 141 else
stuefe@50432 142 WARNINGS_AS_ERRORS=true
stuefe@50432 143 fi
stuefe@50432 144
ihse@49551 145 AC_MSG_CHECKING([if native warnings are errors])
ihse@49551 146 if test "x$enable_warnings_as_errors" = "xyes"; then
ihse@49551 147 AC_MSG_RESULT([yes (explicitly set)])
ihse@49551 148 WARNINGS_AS_ERRORS=true
ihse@49551 149 elif test "x$enable_warnings_as_errors" = "xno"; then
stuefe@50432 150 AC_MSG_RESULT([no (explicitly set)])
ihse@49551 151 WARNINGS_AS_ERRORS=false
ihse@49551 152 elif test "x$enable_warnings_as_errors" = "x"; then
stuefe@50432 153 AC_MSG_RESULT([${WARNINGS_AS_ERRORS} (default)])
ihse@49551 154 else
ihse@49551 155 AC_MSG_ERROR([--enable-warnings-as-errors accepts no argument])
ihse@49551 156 fi
ihse@49551 157
ihse@49551 158 AC_SUBST(WARNINGS_AS_ERRORS)
ihse@49551 159
ihse@49551 160 case "${TOOLCHAIN_TYPE}" in
ihse@49551 161 microsoft)
ihse@49551 162 DISABLE_WARNING_PREFIX="-wd"
ihse@49551 163 CFLAGS_WARNINGS_ARE_ERRORS="-WX"
ihse@49551 164 ;;
ihse@49551 165 solstudio)
ihse@49551 166 DISABLE_WARNING_PREFIX="-erroff="
ihse@49551 167 CFLAGS_WARNINGS_ARE_ERRORS="-errtags -errwarn=%all"
ihse@49551 168 ;;
ihse@49551 169 gcc)
ihse@49631 170 DISABLE_WARNING_PREFIX="-Wno-"
ihse@49551 171 CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
ihse@49551 172 # Repeate the check for the BUILD_CC and BUILD_CXX. Need to also reset
ihse@49551 173 # CFLAGS since any target specific flags will likely not work with the
ihse@49551 174 # build compiler
ihse@49551 175 CC_OLD="$CC"
ihse@49551 176 CXX_OLD="$CXX"
ihse@49551 177 CC="$BUILD_CC"
ihse@49551 178 CXX="$BUILD_CXX"
ihse@49551 179 CFLAGS_OLD="$CFLAGS"
ihse@49551 180 CFLAGS=""
ihse@49631 181 BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
ihse@49551 182 CC="$CC_OLD"
ihse@49551 183 CXX="$CXX_OLD"
ihse@49551 184 CFLAGS="$CFLAGS_OLD"
ihse@49551 185 ;;
ihse@49551 186 clang)
ihse@49551 187 DISABLE_WARNING_PREFIX="-Wno-"
ihse@49551 188 CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
ihse@49551 189 ;;
ihse@49551 190 xlc)
ihse@49551 191 DISABLE_WARNING_PREFIX="-qsuppress="
ihse@49551 192 CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
ihse@49551 193 ;;
ihse@49551 194 esac
ihse@49551 195 AC_SUBST(DISABLE_WARNING_PREFIX)
ihse@49551 196 AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
ihse@49551 197 AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)
ihse@49551 198 ])
ihse@49551 199
ihse@49551 200 AC_DEFUN([FLAGS_SETUP_QUALITY_CHECKS],
ihse@49551 201 [
ihse@49551 202 # bounds, memory and behavior checking options
ihse@49551 203 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 204 case $DEBUG_LEVEL in
ihse@49551 205 release )
ihse@49551 206 # no adjustment
ihse@49551 207 ;;
ihse@49551 208 fastdebug )
ihse@49551 209 # no adjustment
ihse@49551 210 ;;
ihse@49551 211 slowdebug )
ihse@49551 212 # FIXME: By adding this to C(XX)FLAGS_DEBUG_OPTIONS/JVM_CFLAGS_SYMBOLS it
ihse@49551 213 # get's added conditionally on whether we produce debug symbols or not.
ihse@49551 214 # This is most likely not really correct.
ihse@49551 215
ihse@49551 216 # Add runtime stack smashing and undefined behavior checks.
ihse@49631 217 CFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
ihse@49631 218 CXXFLAGS_DEBUG_OPTIONS="-fstack-protector-all --param ssp-buffer-size=1"
ihse@49551 219
ihse@49631 220 JVM_CFLAGS_SYMBOLS="$JVM_CFLAGS_SYMBOLS -fstack-protector-all --param ssp-buffer-size=1"
ihse@49551 221 ;;
ihse@49551 222 esac
ihse@49551 223 fi
ihse@49551 224 ])
ihse@49551 225
ihse@49551 226 AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
ihse@49551 227 [
ihse@49551 228 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 229 CC_HIGHEST="-fns -fsimple -fsingle -xbuiltin=%all -xdepend -xrestrict -xlibmil"
ihse@49551 230
ihse@49551 231 C_O_FLAG_HIGHEST_JVM="-xO4"
ihse@49551 232 C_O_FLAG_DEBUG_JVM=""
ihse@49551 233 C_O_FLAG_SIZE=""
ihse@49551 234 C_O_FLAG_DEBUG=""
ihse@49551 235 C_O_FLAG_NONE=""
ihse@49551 236 if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
ihse@49551 237 C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
ihse@49551 238 C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
ihse@49551 239 C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
ihse@49551 240 elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
ihse@49551 241 C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
gadams@51279 242 -xprefetch=auto,explicit $CC_HIGHEST"
ihse@49551 243 C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
ihse@49551 244 C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
ihse@49551 245 fi
ihse@49551 246 elif test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 247 C_O_FLAG_HIGHEST_JVM="-O3"
ihse@49551 248 C_O_FLAG_HIGHEST="-O3"
ihse@49551 249 C_O_FLAG_HI="-O3"
ihse@49551 250 C_O_FLAG_NORM="-O2"
ihse@49551 251 C_O_FLAG_SIZE="-Os"
ihse@49551 252 C_O_FLAG_DEBUG="-O0"
ihse@49551 253 C_O_FLAG_DEBUG_JVM="-O0"
ihse@49551 254 C_O_FLAG_NONE="-O0"
ihse@49551 255 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 256 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@49551 257 # On MacOSX we optimize for size, something
ihse@49551 258 # we should do for all platforms?
ihse@49551 259 C_O_FLAG_HIGHEST_JVM="-Os"
ihse@49551 260 C_O_FLAG_HIGHEST="-Os"
ihse@49551 261 C_O_FLAG_HI="-Os"
ihse@49551 262 C_O_FLAG_NORM="-Os"
ihse@49551 263 C_O_FLAG_DEBUG_JVM=""
ihse@49551 264 else
ihse@49551 265 C_O_FLAG_HIGHEST_JVM="-O3"
ihse@49551 266 C_O_FLAG_HIGHEST="-O3"
ihse@49551 267 C_O_FLAG_HI="-O3"
ihse@49551 268 C_O_FLAG_NORM="-O2"
ihse@49551 269 C_O_FLAG_DEBUG_JVM="-O0"
ihse@49551 270 fi
ihse@49551 271 C_O_FLAG_SIZE="-Os"
ihse@49551 272 C_O_FLAG_DEBUG="-O0"
ihse@49551 273 C_O_FLAG_NONE="-O0"
ihse@49551 274 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 275 C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
ihse@49551 276 C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
ihse@49551 277 C_O_FLAG_HI="-O3 -qinline -qinlglue"
ihse@49551 278 C_O_FLAG_NORM="-O2"
ihse@49551 279 C_O_FLAG_DEBUG="-qnoopt"
ihse@49551 280 # FIXME: Value below not verified.
ihse@49551 281 C_O_FLAG_DEBUG_JVM=""
ihse@49551 282 C_O_FLAG_NONE="-qnoopt"
ihse@49551 283 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 284 C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
ihse@49551 285 C_O_FLAG_HIGHEST="-O2"
ihse@49551 286 C_O_FLAG_HI="-O1"
ihse@49551 287 C_O_FLAG_NORM="-O1"
ihse@49551 288 C_O_FLAG_DEBUG="-Od"
ihse@49551 289 C_O_FLAG_DEBUG_JVM=""
ihse@49551 290 C_O_FLAG_NONE="-Od"
ihse@49551 291 C_O_FLAG_SIZE="-Os"
ihse@49551 292 fi
ihse@49551 293
ihse@49551 294 # Now copy to C++ flags
ihse@49551 295 CXX_O_FLAG_HIGHEST_JVM="$C_O_FLAG_HIGHEST_JVM"
ihse@49551 296 CXX_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST"
ihse@49551 297 CXX_O_FLAG_HI="$C_O_FLAG_HI"
ihse@49551 298 CXX_O_FLAG_NORM="$C_O_FLAG_NORM"
ihse@49551 299 CXX_O_FLAG_DEBUG="$C_O_FLAG_DEBUG"
ihse@49551 300 CXX_O_FLAG_DEBUG_JVM="$C_O_FLAG_DEBUG_JVM"
ihse@49551 301 CXX_O_FLAG_NONE="$C_O_FLAG_NONE"
ihse@49551 302 CXX_O_FLAG_SIZE="$C_O_FLAG_SIZE"
ihse@49551 303
ihse@49551 304 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 305 # In solstudio, also add this to C (but not C++) flags...
ihse@49551 306 C_O_FLAG_HIGHEST="$C_O_FLAG_HIGHEST -xalias_level=basic"
ihse@49551 307 fi
ihse@49551 308
ihse@49551 309 # Adjust optimization flags according to debug level.
ihse@49551 310 case $DEBUG_LEVEL in
ihse@49551 311 release )
ihse@49551 312 # no adjustment
ihse@49551 313 ;;
ihse@49551 314 fastdebug )
ihse@49551 315 # Not quite so much optimization
ihse@49551 316 C_O_FLAG_HI="$C_O_FLAG_NORM"
ihse@49551 317 CXX_O_FLAG_HI="$CXX_O_FLAG_NORM"
ihse@49551 318 ;;
ihse@49551 319 slowdebug )
ihse@49551 320 # Disable optimization
ihse@49551 321 C_O_FLAG_HIGHEST_JVM="$C_O_FLAG_DEBUG_JVM"
ihse@49551 322 C_O_FLAG_HIGHEST="$C_O_FLAG_DEBUG"
ihse@49551 323 C_O_FLAG_HI="$C_O_FLAG_DEBUG"
ihse@49551 324 C_O_FLAG_NORM="$C_O_FLAG_DEBUG"
ihse@49551 325 C_O_FLAG_SIZE="$C_O_FLAG_DEBUG"
ihse@49551 326 CXX_O_FLAG_HIGHEST_JVM="$CXX_O_FLAG_DEBUG_JVM"
ihse@49551 327 CXX_O_FLAG_HIGHEST="$CXX_O_FLAG_DEBUG"
ihse@49551 328 CXX_O_FLAG_HI="$CXX_O_FLAG_DEBUG"
ihse@49551 329 CXX_O_FLAG_NORM="$CXX_O_FLAG_DEBUG"
ihse@49551 330 CXX_O_FLAG_SIZE="$CXX_O_FLAG_DEBUG"
ihse@49551 331 ;;
ihse@49551 332 esac
ihse@49551 333
ihse@49551 334 AC_SUBST(C_O_FLAG_HIGHEST_JVM)
ihse@49551 335 AC_SUBST(C_O_FLAG_HIGHEST)
ihse@49551 336 AC_SUBST(C_O_FLAG_HI)
ihse@49551 337 AC_SUBST(C_O_FLAG_NORM)
ihse@49551 338 AC_SUBST(C_O_FLAG_NONE)
ihse@49551 339 AC_SUBST(C_O_FLAG_SIZE)
ihse@49551 340 AC_SUBST(CXX_O_FLAG_HIGHEST_JVM)
ihse@49551 341 AC_SUBST(CXX_O_FLAG_HIGHEST)
ihse@49551 342 AC_SUBST(CXX_O_FLAG_HI)
ihse@49551 343 AC_SUBST(CXX_O_FLAG_NORM)
ihse@49551 344 AC_SUBST(CXX_O_FLAG_NONE)
ihse@49551 345 AC_SUBST(CXX_O_FLAG_SIZE)
ihse@49551 346 ])
ihse@49551 347
ihse@49551 348 AC_DEFUN([FLAGS_SETUP_CFLAGS],
ihse@49551 349 [
ihse@49551 350 ### CFLAGS
ihse@49551 351
ihse@49551 352 FLAGS_SETUP_CFLAGS_HELPER
ihse@49551 353
ihse@49551 354 FLAGS_OS=$OPENJDK_TARGET_OS
ihse@49551 355 FLAGS_OS_TYPE=$OPENJDK_TARGET_OS_TYPE
ihse@49551 356 FLAGS_CPU=$OPENJDK_TARGET_CPU
ihse@49551 357 FLAGS_CPU_ARCH=$OPENJDK_TARGET_CPU_ARCH
ihse@49551 358 FLAGS_CPU_BITS=$OPENJDK_TARGET_CPU_BITS
ihse@49551 359 FLAGS_CPU_ENDIAN=$OPENJDK_TARGET_CPU_ENDIAN
ihse@49551 360 FLAGS_CPU_LEGACY=$OPENJDK_TARGET_CPU_LEGACY
ihse@49551 361 FLAGS_CPU_LEGACY_LIB=$OPENJDK_TARGET_CPU_LEGACY_LIB
ihse@49551 362
ihse@49551 363 FLAGS_SETUP_CFLAGS_CPU_DEP([TARGET])
ihse@49551 364
ihse@49551 365 FLAGS_OS=$OPENJDK_BUILD_OS
ihse@49551 366 FLAGS_OS_TYPE=$OPENJDK_BUILD_OS_TYPE
ihse@49551 367 FLAGS_CPU=$OPENJDK_BUILD_CPU
ihse@49551 368 FLAGS_CPU_ARCH=$OPENJDK_BUILD_CPU_ARCH
ihse@49551 369 FLAGS_CPU_BITS=$OPENJDK_BUILD_CPU_BITS
ihse@49551 370 FLAGS_CPU_ENDIAN=$OPENJDK_BUILD_CPU_ENDIAN
ihse@49551 371 FLAGS_CPU_LEGACY=$OPENJDK_BUILD_CPU_LEGACY
ihse@49551 372 FLAGS_CPU_LEGACY_LIB=$OPENJDK_BUILD_CPU_LEGACY_LIB
ihse@49551 373
ihse@49551 374 FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
ihse@49551 375
ihse@49551 376 # Tests are only ever compiled for TARGET
ihse@49551 377 CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
ihse@49551 378 CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
ihse@49551 379 CFLAGS_TESTEXE="$CFLAGS_JDKEXE"
ihse@49551 380 CXXFLAGS_TESTEXE="$CXXFLAGS_JDKEXE"
ihse@49551 381
ihse@49551 382 AC_SUBST(CFLAGS_TESTLIB)
ihse@49551 383 AC_SUBST(CFLAGS_TESTEXE)
ihse@49551 384 AC_SUBST(CXXFLAGS_TESTLIB)
ihse@49551 385 AC_SUBST(CXXFLAGS_TESTEXE)
ihse@49551 386 ])
ihse@49551 387
ihse@49551 388 ################################################################################
ihse@49551 389 # platform independent
ihse@49551 390 AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
ihse@49551 391 [
ihse@49551 392 #### OS DEFINES, these should be independent on toolchain
ihse@49551 393 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@49551 394 CFLAGS_OS_DEF_JVM="-DLINUX"
ihse@49551 395 CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
ihse@49551 396 elif test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@49551 397 CFLAGS_OS_DEF_JVM="-DSOLARIS"
ihse@49551 398 CFLAGS_OS_DEF_JDK="-D__solaris__"
ihse@49551 399 elif test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@49551 400 CFLAGS_OS_DEF_JVM="-D_ALLBSD_SOURCE -D_DARWIN_C_SOURCE -D_XOPEN_SOURCE"
ihse@49551 401 CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE -D_DARWIN_UNLIMITED_SELECT"
ihse@49551 402 elif test "x$OPENJDK_TARGET_OS" = xaix; then
ihse@49551 403 CFLAGS_OS_DEF_JVM="-DAIX"
ihse@49551 404 elif test "x$OPENJDK_TARGET_OS" = xbsd; then
ihse@49551 405 CFLAGS_OS_DEF_JDK="-D_ALLBSD_SOURCE"
ihse@49551 406 elif test "x$OPENJDK_TARGET_OS" = xwindows; then
ihse@49551 407 CFLAGS_OS_DEF_JVM="-D_WINDOWS -DWIN32 -D_JNI_IMPLEMENTATION_"
ihse@49551 408 fi
ihse@49551 409
ihse@49551 410 CFLAGS_OS_DEF_JDK="$CFLAGS_OS_DEF_JDK -D$OPENJDK_TARGET_OS_UPPERCASE"
ihse@49551 411
ihse@49551 412 #### GLOBAL DEFINES
ihse@49551 413 # Set some common defines. These works for all compilers, but assume
ihse@49551 414 # -D is universally accepted.
ihse@49551 415
ihse@49551 416 # Always enable optional macros for VM.
ihse@49551 417 ALWAYS_CFLAGS_JVM="-D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS"
ihse@49551 418
ihse@49551 419 # Setup some hard coded includes
ihse@49551 420 ALWAYS_CFLAGS_JDK=" \
ihse@49551 421 -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
ihse@49551 422 -I\$(SUPPORT_OUTPUTDIR)/modules_include/java.base/\$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
ihse@49551 423 -I${TOPDIR}/src/java.base/share/native/libjava \
ihse@49551 424 -I${TOPDIR}/src/java.base/$OPENJDK_TARGET_OS_TYPE/native/libjava \
ihse@49551 425 -I${TOPDIR}/src/hotspot/share/include \
ihse@49551 426 -I${TOPDIR}/src/hotspot/os/${HOTSPOT_TARGET_OS_TYPE}/include"
ihse@49551 427
ihse@49551 428 ###############################################################################
ihse@49551 429
ihse@49551 430 # Adjust flags according to debug level.
ihse@49551 431 # Setup debug/release defines
ihse@49551 432 if test "x$DEBUG_LEVEL" = xrelease; then
ihse@49551 433 DEBUG_CFLAGS_JDK="-DNDEBUG"
ihse@49551 434 if test "x$OPENJDK_TARGET_OS" = xsolaris; then
ihse@49551 435 DEBUG_CFLAGS_JDK="$DEBUG_CFLAGS_JDK -DTRIMMED"
ihse@49551 436 fi
ihse@49551 437 else
ihse@49551 438 DEBUG_CFLAGS_JDK="-DDEBUG"
ihse@49551 439
ihse@49551 440 if test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 441 # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
ihse@49551 442 # Hotspot now overflows its 64K TOC (currently only for debug),
ihse@49551 443 # so for debug we build with '-qpic=large -bbigtoc'.
ihse@49551 444 DEBUG_CFLAGS_JVM="-qpic=large"
ihse@49551 445 fi
ihse@49551 446 fi
ihse@49551 447
ihse@49551 448 if test "x$DEBUG_LEVEL" != xrelease; then
ihse@49551 449 DEBUG_OPTIONS_FLAGS_JDK="$CFLAGS_DEBUG_OPTIONS"
ihse@49551 450 DEBUG_SYMBOLS_CFLAGS_JDK="$CFLAGS_DEBUG_SYMBOLS"
ihse@49551 451 fi
ihse@49551 452
ihse@49551 453 #### TOOLCHAIN DEFINES
ihse@49551 454
ihse@49551 455 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 456 ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
ihse@49551 457 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 458 ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
ihse@49551 459 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 460 ALWAYS_DEFINES_JVM="-DSPARC_WORKS -D_Crun_inline_placement"
ihse@49551 461 ALWAYS_DEFINES_JDK="-DTRACING -DMACRO_MEMSYS_OPS -DBREAKPTS"
ihse@49551 462 ALWAYS_DEFINES_JDK_CXXONLY="-DCC_NOEX"
ihse@49551 463 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 464 ALWAYS_DEFINES_JVM="-D_REENTRANT"
ihse@49551 465 ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -DSTDC"
ihse@49551 466 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 467 ALWAYS_DEFINES_JDK="-DWIN32_LEAN_AND_MEAN -D_CRT_SECURE_NO_DEPRECATE \
ihse@49551 468 -D_CRT_NONSTDC_NO_DEPRECATE -DWIN32 -DIAL"
rwestberg@50221 469 ALWAYS_DEFINES_JVM="-DNOMINMAX -DWIN32_LEAN_AND_MEAN"
ihse@49551 470 fi
ihse@49551 471
ihse@49551 472 ###############################################################################
ihse@49551 473 #
ihse@49551 474 #
ihse@49551 475 # CFLAGS BASIC
ihse@49551 476 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 477 # COMMON to gcc and clang
ihse@49551 478 TOOLCHAIN_CFLAGS_JVM="-pipe -fno-rtti -fno-exceptions \
ihse@49551 479 -fvisibility=hidden -fno-strict-aliasing -fno-omit-frame-pointer"
ihse@49551 480 fi
ihse@49551 481
ihse@49551 482 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 483 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new"
ihse@49551 484 TOOLCHAIN_CFLAGS_JDK="-pipe"
ihse@49551 485 TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!)
ihse@49551 486
ihse@49551 487 CXXSTD_CXXFLAG="-std=gnu++98"
ihse@49551 488 FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
ihse@49551 489 IF_FALSE: [CXXSTD_CXXFLAG=""])
ihse@49551 490 TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
ihse@49551 491 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CXXSTD_CXXFLAG"
ihse@49551 492 ADLC_CXXFLAG="$CXXSTD_CXXFLAG"
ihse@49551 493
ihse@49551 494
ihse@49551 495 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 496 # Restrict the debug information created by Clang to avoid
ihse@49551 497 # too big object files and speed the build up a little bit
ihse@49551 498 # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
ihse@49551 499 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
ihse@49551 500
martin@51415 501 # In principle the stack alignment below is cpu- and ABI-dependent and
martin@51415 502 # should agree with values of StackAlignmentInBytes in various
martin@51415 503 # src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
martin@51415 504 # works for all platforms.
martin@51415 505 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
martin@51415 506
ihse@49551 507 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@49551 508 TOOLCHAIN_CFLAGS_JDK="-pipe"
ihse@49551 509 TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
ihse@49551 510 fi
ihse@49551 511 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 512 TOOLCHAIN_CFLAGS_JDK="-mt"
ihse@49551 513 TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -v -W0,-noglobal" # C only
ihse@49551 514 TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
ihse@49551 515 TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
ihse@49551 516 -library=stlport4 -mt -features=no%except"
ihse@49586 517 if test "x$DEBUG_LEVEL" = xslowdebug; then
ihse@49586 518 # Previously -g was used instead of -g0 for slowdebug; this is equivalent
ihse@49586 519 # to setting +d.
ihse@49586 520 TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
ihse@49586 521 fi
ihse@49586 522
ihse@49551 523 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 524 TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt" # add on both CFLAGS
ihse@49551 525 TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
ihse@49551 526 -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
ihse@49551 527 -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno"
ihse@49551 528 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 529 TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
ihse@49551 530 TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
ihse@49551 531 fi
ihse@49551 532
ihse@49551 533 # CFLAGS WARNINGS STUFF
ihse@49551 534 # Set JVM_CFLAGS warning handling
ihse@49551 535 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 536 # COMMON to gcc and clang
ihse@49551 537 WARNING_CFLAGS_JVM="-Wpointer-arith -Wsign-compare -Wunused-function"
ihse@49551 538 if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
ihse@49551 539 # Non-zero builds have stricter warnings
ihse@49551 540 WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wundef -Wformat=2"
ihse@49551 541 fi
ihse@49551 542
ihse@49551 543 fi
ihse@49551 544 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 545 WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
ihse@49551 546 WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wunused-value -Woverloaded-virtual"
ihse@49551 547
ihse@49551 548 if ! HOTSPOT_CHECK_JVM_VARIANT(zero); then
ihse@49551 549 # Non-zero builds have stricter warnings
ihse@49551 550 WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wreturn-type"
ihse@49551 551 fi
ihse@49551 552 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 553 WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-deprecated"
ihse@49551 554 if test "x$OPENJDK_TARGET_OS" = xlinux; then
ihse@49551 555 WARNING_CFLAGS_JVM="$WARNING_CFLAGS_JVM -Wno-sometimes-uninitialized"
ihse@49551 556 WARNING_CFLAGS_JDK="-Wall -Wextra -Wno-unused -Wno-unused-parameter -Wformat=2"
ihse@49551 557 fi
ihse@49551 558 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 559 WARNING_CFLAGS_JDK_CONLY="-errshort=tags"
ihse@49551 560 WARNING_CFLAGS_JDK_CXXONLY="+w"
ihse@49551 561 WARNING_CFLAGS_JDK="-errtags=yes -errfmt"
ihse@49551 562 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 563 WARNING_CFLAGS="-W3"
ihse@49551 564 WARNING_CFLAGS_JDK="-wd4800"
stuefe@51312 565 WARNING_CFLAGS_JVM="-wd4800"
ihse@49551 566 fi
ihse@49551 567
ihse@49551 568 # Set some additional per-OS defines.
ihse@49551 569
ihse@49551 570 # Additional macosx handling
ihse@49551 571 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@49551 572 OS_CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=$MACOSX_VERSION_MIN_NODOTS \
ihse@49551 573 -mmacosx-version-min=$MACOSX_VERSION_MIN"
ihse@49551 574
ihse@49551 575 if test -n "$MACOSX_VERSION_MAX"; then
ihse@49551 576 OS_CFLAGS="$OS_CFLAGS \
ihse@49551 577 -DMAC_OS_X_VERSION_MAX_ALLOWED=$MACOSX_VERSION_MAX_NODOTS"
ihse@49551 578 fi
ihse@49551 579 fi
ihse@49551 580
ihse@49551 581 # Where does this really belong??
ihse@49551 582 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 583 PICFLAG="-fPIC"
ihse@49551 584 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 585 PICFLAG="-KPIC"
ihse@49551 586 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 587 # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
ihse@49551 588 # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
ihse@49551 589 # will have to patch this single instruction with a call to some out-of-order code which
stuefe@51163 590 # does the load from the TOC. This is of course slower, and we also would have
ihse@49551 591 # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
ihse@49551 592 # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
ihse@49551 593 # can be patched directly by the linker and does not require a jump to out-of-order code.
stuefe@51163 594 #
stuefe@51163 595 # Since large TOC causes perf. overhead, only pay it where we must. Currently this is
stuefe@51163 596 # for all libjvm variants (both gtest and normal) but no other binaries. So, build
stuefe@51163 597 # libjvm with -qpic=large and link with -bbigtoc.
stuefe@51163 598 JVM_PICFLAG="-qpic=large"
stuefe@51163 599 JDK_PICFLAG="-qpic"
ihse@49551 600 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 601 PICFLAG=""
ihse@49551 602 fi
ihse@49551 603
stuefe@51163 604 if test "x$TOOLCHAIN_TYPE" != xxlc; then
stuefe@51163 605 JVM_PICFLAG="$PICFLAG"
stuefe@51163 606 JDK_PICFLAG="$PICFLAG"
stuefe@51163 607 fi
ihse@49551 608
ihse@49551 609 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
ihse@49551 610 # Linking is different on MacOSX
ihse@49551 611 JDK_PICFLAG=''
ihse@49551 612 if test "x$STATIC_BUILD" = xtrue; then
ihse@49551 613 JVM_PICFLAG=""
ihse@49551 614 fi
ihse@49551 615 fi
ihse@49551 616
ihse@49551 617 # Optional POSIX functionality needed by the JVM
ihse@49551 618 #
ihse@49551 619 # Check if clock_gettime is available and in which library. This indicates
ihse@49551 620 # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
ihse@49551 621 # don't let it update LIBS.
ihse@49551 622 save_LIBS="$LIBS"
ihse@49551 623 AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
ihse@49551 624 if test "x$LIBS" = "x-lrt "; then
ihse@49551 625 CLOCK_GETTIME_IN_LIBRT=true
ihse@49551 626 fi
ihse@49551 627 LIBS="$save_LIBS"
ihse@49551 628
ihse@49551 629 if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
ihse@49551 630 OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
ihse@49551 631 if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
ihse@49551 632 OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
ihse@49551 633 fi
ihse@49551 634 fi
ihse@49551 635
ihse@49551 636 # EXPORT
ihse@49551 637 AC_SUBST(ADLC_CXXFLAG)
ihse@49551 638 ])
ihse@49551 639
ihse@49551 640 ################################################################################
ihse@49551 641 # $1 - Either BUILD or TARGET to pick the correct OS/CPU variables to check
ihse@49551 642 # conditionals against.
ihse@49551 643 # $2 - Optional prefix for each variable defined.
ihse@49551 644 AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
ihse@49551 645 [
ihse@49551 646 #### CPU DEFINES, these should (in theory) be independent on toolchain
ihse@49551 647
ihse@49551 648 # Setup target CPU
ihse@49551 649 # Setup endianness
ihse@49551 650 if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
ihse@49551 651 $1_DEFINES_CPU_JVM="-DVM_LITTLE_ENDIAN"
ihse@49551 652 fi
ihse@49551 653 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 654 # The macro _LITTLE_ENDIAN needs to be defined the same to avoid the
ihse@49551 655 # Sun C compiler warning message: warning: macro redefined: _LITTLE_ENDIAN
ihse@49551 656 if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
ihse@49551 657 $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN="
ihse@49551 658 else
ihse@49551 659 $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN="
ihse@49551 660 fi
ihse@49551 661 else
ihse@49551 662 if test "x$FLAGS_CPU_ENDIAN" = xlittle; then
ihse@49551 663 $1_DEFINES_CPU_JDK="-D_LITTLE_ENDIAN"
ihse@49551 664 else
ihse@49551 665 $1_DEFINES_CPU_JDK="-D_BIG_ENDIAN"
ihse@49551 666 fi
ihse@49551 667 fi
ihse@49551 668
ihse@49551 669 # setup CPU bit size
ihse@49551 670 $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
ihse@49551 671 -D$FLAGS_CPU_LEGACY"
ihse@49551 672
ihse@49551 673 if test "x$FLAGS_CPU_BITS" = x64; then
ihse@49551 674 # -D_LP64=1 is only set on linux and mac. Setting on windows causes diff in
ihse@49551 675 # unpack200.exe.
ihse@49551 676 if test "x$FLAGS_OS" = xlinux || test "x$FLAGS_OS" = xmacosx; then
ihse@49551 677 $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
ihse@49551 678 fi
ihse@49551 679 if test "x$FLAGS_OS" != xsolaris && test "x$FLAGS_OS" != xaix; then
ihse@49551 680 # Solaris does not have _LP64=1 in the old build.
ihse@49551 681 # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
ihse@49551 682 $1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
ihse@49551 683 fi
ihse@49551 684 fi
ihse@49551 685
ihse@49551 686 # toolchain dependend, per-cpu
ihse@49551 687 if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 688 if test "x$FLAGS_CPU_ARCH" = xx86; then
ihse@49551 689 $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DcpuIntel -Di586 -D$FLAGS_CPU_LEGACY_LIB"
ihse@49551 690 fi
ihse@49551 691 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 692 if test "x$FLAGS_CPU" = xx86_64; then
ihse@49551 693 $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_AMD64_ -Damd64"
ihse@49551 694 else
ihse@49551 695 $1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_X86_ -Dx86"
ihse@49551 696 fi
ihse@49551 697 fi
ihse@49551 698
ihse@49551 699 # CFLAGS PER CPU
ihse@49551 700 if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 701 # COMMON to gcc and clang
ihse@49551 702 if test "x$FLAGS_CPU" = xx86; then
ihse@49551 703 # Force compatibility with i586 on 32 bit intel platforms.
ihse@49551 704 $1_CFLAGS_CPU="-march=i586"
ihse@49551 705 fi
ihse@49551 706 fi
ihse@49551 707
ihse@49551 708 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 709 if test "x$FLAGS_CPU" = xarm; then
ihse@49551 710 # -Wno-psabi to get rid of annoying "note: the mangling of 'va_list' has changed in GCC 4.4"
ihse@49551 711 $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)\"'"
ihse@49551 712 $1_CFLAGS_CPU_JVM="-DARM"
ihse@49551 713 elif test "x$FLAGS_CPU" = xaarch64; then
ihse@49551 714 if test "x$HOTSPOT_TARGET_CPU_PORT" = xarm64; then
ihse@49551 715 $1_CFLAGS_CPU_JVM="-fsigned-char -DARM"
ihse@49551 716 fi
ihse@49551 717 elif test "x$FLAGS_CPU_ARCH" = xppc; then
ihse@49551 718 $1_CFLAGS_CPU_JVM="-minsert-sched-nops=regroup_exact -mno-multiple -mno-string"
ihse@49551 719 if test "x$FLAGS_CPU" = xppc64; then
ihse@49551 720 # -mminimal-toc fixes `relocation truncated to fit' error for gcc 4.1.
ihse@49551 721 # Use ppc64 instructions, but schedule for power5
ihse@49551 722 $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -mminimal-toc -mcpu=powerpc64 -mtune=power5"
ihse@49551 723 elif test "x$FLAGS_CPU" = xppc64le; then
ihse@49551 724 # Little endian machine uses ELFv2 ABI.
ihse@49551 725 # Use Power8, this is the first CPU to support PPC64 LE with ELFv2 ABI.
ihse@49551 726 $1_CFLAGS_CPU_JVM="${$1_CFLAGS_CPU_JVM} -DABI_ELFv2 -mcpu=power8 -mtune=power8"
ihse@49551 727 fi
ihse@49551 728 elif test "x$FLAGS_CPU" = xs390x; then
ihse@49551 729 $1_CFLAGS_CPU="-mbackchain -march=z10"
ihse@49551 730 fi
ihse@49551 731
ihse@49551 732 if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
ihse@49551 733 # for all archs except arm and ppc, prevent gcc to omit frame pointer
ihse@49551 734 $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
ihse@49551 735 fi
ihse@49551 736
ihse@49551 737 elif test "x$TOOLCHAIN_TYPE" = xclang; then
ihse@49551 738 if test "x$FLAGS_OS" = xlinux; then
ihse@49551 739 # ppc test not really needed for clang
ihse@49551 740 if test "x$FLAGS_CPU_ARCH" != xarm && test "x$FLAGS_CPU_ARCH" != xppc; then
ihse@49551 741 # for all archs except arm and ppc, prevent gcc to omit frame pointer
ihse@49551 742 $1_CFLAGS_CPU_JDK="${$1_CFLAGS_CPU_JDK} -fno-omit-frame-pointer"
ihse@49551 743 fi
ihse@49551 744 fi
ihse@49551 745
ihse@49551 746 elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
ihse@49551 747 if test "x$FLAGS_CPU" = xx86_64; then
ihse@49551 748 # NOTE: -xregs=no%frameptr is supposed to be default on x64
ihse@49551 749 $1_CFLAGS_CPU_JDK="-xregs=no%frameptr"
ihse@49551 750 elif test "x$FLAGS_CPU" = xsparcv9; then
ihse@49551 751 $1_CFLAGS_CPU_JVM="-xarch=sparc"
ihse@49551 752 $1_CFLAGS_CPU_JDK_LIBONLY="-xregs=no%appl"
ihse@49551 753 fi
ihse@49551 754
ihse@49551 755 elif test "x$TOOLCHAIN_TYPE" = xxlc; then
ihse@49551 756 if test "x$FLAGS_CPU" = xppc64; then
ihse@49551 757 $1_CFLAGS_CPU_JVM="-qarch=ppc64"
ihse@49551 758 fi
ihse@49551 759
ihse@49551 760 elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
ihse@49551 761 if test "x$FLAGS_CPU" = xx86; then
ihse@49551 762 $1_CFLAGS_CPU_JVM="-arch:IA32"
ihse@49551 763 elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
ihse@49551 764 if test "x$DEBUG_LEVEL" != xrelease; then
ihse@49551 765 # NOTE: This is probably redundant; -homeparams is default on
ihse@49551 766 # non-release builds.
ihse@49551 767 $1_CFLAGS_CPU_JVM="-homeparams"
ihse@49551 768 fi
ihse@49551 769 fi
ihse@49551 770 fi
ihse@49551 771
ihse@49551 772 if test "x$TOOLCHAIN_TYPE" = xgcc; then
ihse@49551 773 TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($1))
ihse@49551 774 $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
ihse@49551 775
ihse@49631 776 $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
ihse@49551 777 fi
ihse@49551 778
ihse@49551 779 # EXPORT to API
ihse@49551 780 CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM $TOOLCHAIN_CFLAGS_JVM \
ihse@49551 781 $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
ihse@49551 782 $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
ihse@49551 783
ihse@49551 784 CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
ihse@49551 785 $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
ihse@49586 786 $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"
ihse@49551 787
ihse@49551 788 # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
ihse@49551 789 # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
ihse@49551 790 # change in the future.)
ihse@49551 791
ihse@49586 792 CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY \
ihse@49551 793 $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
ihse@49551 794 CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
ihse@49586 795 $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
ihse@49551 796
ihse@49551 797 $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
ihse@49551 798 $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
ihse@49551 799
ihse@49551 800 $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
ihse@49551 801
ihse@49551 802 $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
ihse@49551 803 $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
ihse@49551 804 $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
ihse@49551 805 $2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
ihse@49551 806
ihse@49551 807 AC_SUBST($2JVM_CFLAGS)
ihse@49551 808 AC_SUBST($2CFLAGS_JDKLIB)
ihse@49551 809 AC_SUBST($2CFLAGS_JDKEXE)
ihse@49551 810 AC_SUBST($2CXXFLAGS_JDKLIB)
ihse@49551 811 AC_SUBST($2CXXFLAGS_JDKEXE)
ihse@49551 812 ])
ihse@49551 813
ihse@49551 814 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
ihse@49551 815 # Arguments:
ihse@49551 816 # $1 - Prefix for each variable defined.
ihse@49551 817 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
ihse@49551 818 [
ihse@49551 819 # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
ihse@49551 820 # runs afoul of the more aggressive versions of these optimisations.
ihse@49551 821 # Notably, value range propagation now assumes that the this pointer of C++
ihse@49551 822 # member functions is non-null.
ihse@49551 823 NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
ihse@49551 824 dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
ihse@49551 825 dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
ihse@49551 826 dnl IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
ihse@49551 827 NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
ihse@49551 828 dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
ihse@49551 829 dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
ihse@49551 830 dnl IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
ihse@49551 831 AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])
ihse@49551 832 $1_GCC6_CFLAGS="${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} ${NO_LIFETIME_DSE_CFLAG}"
ihse@49551 833 ])
ihse@49551 834
ihse@49551 835 # Documentation on common flags used for solstudio in HIGHEST.
ihse@49551 836 #
ihse@49551 837 # WARNING: Use of OPTIMIZATION_LEVEL=HIGHEST in your Makefile needs to be
ihse@49551 838 # done with care, there are some assumptions below that need to
ihse@49551 839 # be understood about the use of pointers, and IEEE behavior.
ihse@49551 840 #
ihse@49551 841 # -fns: Use non-standard floating point mode (not IEEE 754)
ihse@49551 842 # -fsimple: Do some simplification of floating point arithmetic (not IEEE 754)
ihse@49551 843 # -fsingle: Use single precision floating point with 'float'
ihse@49551 844 # -xalias_level=basic: Assume memory references via basic pointer types do not alias
ihse@49551 845 # (Source with excessing pointer casting and data access with mixed
ihse@49551 846 # pointer types are not recommended)
ihse@49551 847 # -xbuiltin=%all: Use intrinsic or inline versions for math/std functions
ihse@49551 848 # (If you expect perfect errno behavior, do not use this)
ihse@49551 849 # -xdepend: Loop data dependency optimizations (need -xO3 or higher)
ihse@49551 850 # -xrestrict: Pointer parameters to functions do not overlap
ihse@49551 851 # (Similar to -xalias_level=basic usage, but less obvious sometimes.
ihse@49551 852 # If you pass in multiple pointers to the same data, do not use this)
ihse@49551 853 # -xlibmil: Inline some library routines
ihse@49551 854 # (If you expect perfect errno behavior, do not use this)
ihse@49551 855 # -xlibmopt: Use optimized math routines (CURRENTLY DISABLED)
ihse@49551 856 # (If you expect perfect errno behavior, do not use this)
ihse@49551 857 # Can cause undefined external on Solaris 8 X86 on __sincos, removing for now