< prev index next >

make/autoconf/flags-cflags.m4

Print this page


   1 #
   2 # Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 202       CXX_OLD="$CXX"
 203       CC="$BUILD_CC"
 204       CXX="$BUILD_CXX"
 205       CFLAGS_OLD="$CFLAGS"
 206       CFLAGS=""
 207       BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
 208       CC="$CC_OLD"
 209       CXX="$CXX_OLD"
 210       CFLAGS="$CFLAGS_OLD"
 211       ;;
 212 
 213     clang)
 214       DISABLE_WARNING_PREFIX="-Wno-"
 215       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 216 
 217       # Additional warnings that are not activated by -Wall and -Wextra
 218       WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \
 219           -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
 220       WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 221 
 222       DISABLED_WARNINGS="unknown-warning-option unused-parameter unused"
 223 
 224       if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 225         # missing-method-return-type triggers in JavaNativeFoundation framework
 226         DISABLED_WARNINGS="$DISABLED_WARNINGS missing-method-return-type"
 227       fi
 228 
 229       ;;
 230 
 231     xlc)
 232       DISABLE_WARNING_PREFIX="-qsuppress="
 233       CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
 234 
 235       # Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
 236       WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
 237       DISABLED_WARNINGS=""
 238       ;;
 239   esac
 240   AC_SUBST(DISABLE_WARNING_PREFIX)
 241   AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
 242   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)


 283     C_O_FLAG_NONE=""
 284     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
 285       C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
 286       C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
 287       C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
 288     elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 289       C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
 290           -xprefetch=auto,explicit $CC_HIGHEST"
 291       C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 292       C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 293     fi
 294   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 295     C_O_FLAG_HIGHEST_JVM="-O3"
 296     C_O_FLAG_HIGHEST="-O3"
 297     C_O_FLAG_HI="-O3"
 298     C_O_FLAG_NORM="-O2"
 299     C_O_FLAG_SIZE="-Os"
 300     C_O_FLAG_DEBUG="-O0"
 301     C_O_FLAG_DEBUG_JVM="-O0"
 302     C_O_FLAG_NONE="-O0"
 303     # -D_FORTIFY_SOURCE=2 hardening option needs optimization (at least -O1) enabled
 304     # set for lower O-levels -U_FORTIFY_SOURCE to overwrite previous settings
 305     if test "x$OPENJDK_TARGET_OS" = xlinux -a "x$DEBUG_LEVEL" = "xfastdebug"; then
 306       ENABLE_FORTIFY_CFLAGS="-D_FORTIFY_SOURCE=2"
 307       DISABLE_FORTIFY_CFLAGS="-U_FORTIFY_SOURCE"
 308       C_O_FLAG_HIGHEST_JVM="${C_O_FLAG_HIGHEST_JVM} ${ENABLE_FORTIFY_CFLAGS}"
 309       C_O_FLAG_HIGHEST="${C_O_FLAG_HIGHEST} ${ENABLE_FORTIFY_CFLAGS}"
 310       C_O_FLAG_HI="${C_O_FLAG_HI} ${ENABLE_FORTIFY_CFLAGS}"
 311       C_O_FLAG_NORM="${C_O_FLAG_NORM} ${ENABLE_FORTIFY_CFLAGS}"
 312       C_O_FLAG_SIZE="${C_O_FLAG_SIZE} ${DISABLE_FORTIFY_CFLAGS}"
 313       C_O_FLAG_DEBUG="${C_O_FLAG_DEBUG} ${DISABLE_FORTIFY_CFLAGS}"
 314       C_O_FLAG_DEBUG_JVM="${C_O_FLAG_DEBUG_JVM} ${DISABLE_FORTIFY_CFLAGS}"
 315       C_O_FLAG_NONE="${C_O_FLAG_NONE} ${DISABLE_FORTIFY_CFLAGS}"
 316     fi
 317   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 318     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 319       # On MacOSX we optimize for size, something
 320       # we should do for all platforms?
 321       C_O_FLAG_HIGHEST_JVM="-Os"
 322       C_O_FLAG_HIGHEST="-Os"
 323       C_O_FLAG_HI="-Os"
 324       C_O_FLAG_NORM="-Os"
 325       C_O_FLAG_DEBUG_JVM=""
 326     else
 327       C_O_FLAG_HIGHEST_JVM="-O3"
 328       C_O_FLAG_HIGHEST="-O3"
 329       C_O_FLAG_HI="-O3"
 330       C_O_FLAG_NORM="-O2"
 331       C_O_FLAG_DEBUG_JVM="-O0"
 332     fi
 333     C_O_FLAG_SIZE="-Os"
 334     C_O_FLAG_DEBUG="-O0"
 335     C_O_FLAG_NONE="-O0"
 336   elif test "x$TOOLCHAIN_TYPE" = xxlc; then


 533   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 534     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector"
 535     TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector"
 536     # technically NOT for CXX (but since this gives *worse* performance, use
 537     # no-strict-aliasing everywhere!)
 538     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing"
 539 
 540   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 541     # Restrict the debug information created by Clang to avoid
 542     # too big object files and speed the build up a little bit
 543     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
 544     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
 545 
 546     # In principle the stack alignment below is cpu- and ABI-dependent and
 547     # should agree with values of StackAlignmentInBytes in various
 548     # src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
 549     # works for all platforms.
 550     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
 551 
 552     if test "x$OPENJDK_TARGET_OS" = xlinux; then
 553       if test "x$DEBUG_LEVEL" = xrelease; then
 554         # Clang does not inline as much as GCC does for functions with "inline" keyword by default.
 555         # This causes noticeable slowdown in pause time for G1, and possibly in other areas.
 556         # Increasing the inline hint threshold avoids the slowdown for Clang-built JVM.
 557         TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mllvm -inlinehint-threshold=100000"
 558       fi
 559       TOOLCHAIN_CFLAGS_JDK="-pipe"
 560       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
 561     fi
 562   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 563     TOOLCHAIN_FLAGS="-errtags -errfmt"
 564     TOOLCHAIN_CFLAGS="-errshort=tags"
 565 
 566     TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
 567     TOOLCHAIN_CFLAGS_JDK_CONLY="-W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
 568     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
 569     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
 570         -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
 571     if test "x$DEBUG_LEVEL" = xslowdebug; then
 572       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
 573       # to setting +d.
 574       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
 575     fi
 576 
 577   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 578     # Suggested additions: -qsrcmsg to get improved error reporting
 579     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt -qstackprotect"  # add on both CFLAGS
 580     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
 581         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
 582         -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno -qstackprotect"
 583   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 584     TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
 585     TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
 586   fi
 587 
 588   # CFLAGS C language level for JDK sources (hotspot only uses C++)
 589   # Ideally we would have a common level across all toolchains so that all sources
 590   # are sure to conform to the same standard. Unfortunately neither our sources nor
 591   # our toolchains are in a condition to support that. But what we loosely aim for is
 592   # C99 level.
 593   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
 594     # This raises the language level for older 4.8 gcc, while lowering it for later
 595     # versions. clang and xlclang support the same flag.
 596     LANGSTD_CFLAGS="-std=c99"
 597   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 598     # We can't turn on -std=c99 without breaking compilation of the splashscreen/png
 599     # utilities. But we can enable c99 as below (previously achieved by using -Xa).
 600     # It is the no_lib that makes the difference.
 601     LANGSTD_CFLAGS="-xc99=all,no_lib"
 602   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 603     # MSVC doesn't support C99/C11 explicitly, unless you compile as C++:
 604     # LANGSTD_CFLAGS="/TP"
 605     # but that requires numerous changes to the sources files. So we are limited
 606     # to C89/C90 plus whatever extensions Visual Studio has decided to implement.
 607     # This is the lowest bar for shared code.
 608     LANGSTD_CFLAGS=""
 609   fi
 610   TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
 611 
 612   # CFLAGS WARNINGS STUFF
 613   # Set JVM_CFLAGS warning handling
 614   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 615     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 616     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 617     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 618 
 619   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 620     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 621 
 622   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 623     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 624     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 625     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 626 
 627   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 628     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 629 
 630   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 631     WARNING_CFLAGS=""  # currently left empty


 826 
 827   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 828     if test "x$FLAGS_CPU" = xx86; then
 829       $1_CFLAGS_CPU_JVM="-arch:IA32"
 830     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 831       if test "x$DEBUG_LEVEL" != xrelease; then
 832         # NOTE: This is probably redundant; -homeparams is default on
 833         # non-release builds.
 834         $1_CFLAGS_CPU_JVM="-homeparams"
 835       fi
 836     fi
 837   fi
 838 
 839   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 840     FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3)
 841     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
 842 
 843     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
 844   fi
 845 
 846   if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
 847     # Check if compiler supports -fmacro-prefix-map. If so, use that to make
 848     # the __FILE__ macro resolve to paths relative to the workspace root.
 849     workspace_root_trailing_slash="${WORKSPACE_ROOT%/}/"
 850     FILE_MACRO_CFLAGS="-fmacro-prefix-map=${workspace_root_trailing_slash}="
 851     FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${FILE_MACRO_CFLAGS}],
 852         PREFIX: $3,
 853         IF_FALSE: [
 854             FILE_MACRO_CFLAGS=
 855         ]
 856     )
 857   fi
 858 
 859   # EXPORT to API
 860   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
 861       $TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
 862       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
 863       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG $FILE_MACRO_CFLAGS"
 864 
 865   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
 866       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
 867       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK \
 868       $FILE_MACRO_CFLAGS"
 869 
 870   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
 871   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
 872   # change in the future.)
 873 
 874   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
 875       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
 876   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \
 877       $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
 878       ${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \
 879       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
 880 
 881   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
 882   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
 883 
 884   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
 885 
 886   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
 887   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
 888   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"


   1 #
   2 # Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.  Oracle designates this
   8 # particular file as subject to the "Classpath" exception as provided
   9 # by Oracle in the LICENSE file that accompanied this code.
  10 #
  11 # This code is distributed in the hope that it will be useful, but WITHOUT
  12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14 # version 2 for more details (a copy is included in the LICENSE file that
  15 # accompanied this code).
  16 #
  17 # You should have received a copy of the GNU General Public License version
  18 # 2 along with this work; if not, write to the Free Software Foundation,
  19 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20 #
  21 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22 # or visit www.oracle.com if you need additional information or have any


 202       CXX_OLD="$CXX"
 203       CC="$BUILD_CC"
 204       CXX="$BUILD_CXX"
 205       CFLAGS_OLD="$CFLAGS"
 206       CFLAGS=""
 207       BUILD_CC_DISABLE_WARNING_PREFIX="-Wno-"
 208       CC="$CC_OLD"
 209       CXX="$CXX_OLD"
 210       CFLAGS="$CFLAGS_OLD"
 211       ;;
 212 
 213     clang)
 214       DISABLE_WARNING_PREFIX="-Wno-"
 215       CFLAGS_WARNINGS_ARE_ERRORS="-Werror"
 216 
 217       # Additional warnings that are not activated by -Wall and -Wextra
 218       WARNINGS_ENABLE_ADDITIONAL="-Wpointer-arith -Wsign-compare -Wreorder \
 219           -Wunused-function -Wundef -Wunused-value -Woverloaded-virtual"
 220       WARNINGS_ENABLE_ALL="-Wall -Wextra -Wformat=2 $WARNINGS_ENABLE_ADDITIONAL"
 221 
 222       DISABLED_WARNINGS="unused-parameter unused"
 223 
 224       if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 225         # missing-method-return-type triggers in JavaNativeFoundation framework
 226         DISABLED_WARNINGS="$DISABLED_WARNINGS missing-method-return-type"
 227       fi
 228 
 229       ;;
 230 
 231     xlc)
 232       DISABLE_WARNING_PREFIX="-qsuppress="
 233       CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
 234 
 235       # Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
 236       WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
 237       DISABLED_WARNINGS=""
 238       ;;
 239   esac
 240   AC_SUBST(DISABLE_WARNING_PREFIX)
 241   AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
 242   AC_SUBST(CFLAGS_WARNINGS_ARE_ERRORS)


 283     C_O_FLAG_NONE=""
 284     if test "x$OPENJDK_TARGET_CPU_ARCH" = "xx86"; then
 285       C_O_FLAG_HIGHEST="-xO4 -Wu,-O4~yz $CC_HIGHEST"
 286       C_O_FLAG_HI="-xO4 -Wu,-O4~yz"
 287       C_O_FLAG_NORM="-xO2 -Wu,-O2~yz"
 288     elif test "x$OPENJDK_TARGET_CPU_ARCH" = "xsparc"; then
 289       C_O_FLAG_HIGHEST="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0 \
 290           -xprefetch=auto,explicit $CC_HIGHEST"
 291       C_O_FLAG_HI="-xO4 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 292       C_O_FLAG_NORM="-xO2 -Wc,-Qrm-s -Wc,-Qiselect-T0"
 293     fi
 294   elif test "x$TOOLCHAIN_TYPE" = xgcc; then
 295     C_O_FLAG_HIGHEST_JVM="-O3"
 296     C_O_FLAG_HIGHEST="-O3"
 297     C_O_FLAG_HI="-O3"
 298     C_O_FLAG_NORM="-O2"
 299     C_O_FLAG_SIZE="-Os"
 300     C_O_FLAG_DEBUG="-O0"
 301     C_O_FLAG_DEBUG_JVM="-O0"
 302     C_O_FLAG_NONE="-O0"














 303   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 304     if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 305       # On MacOSX we optimize for size, something
 306       # we should do for all platforms?
 307       C_O_FLAG_HIGHEST_JVM="-Os"
 308       C_O_FLAG_HIGHEST="-Os"
 309       C_O_FLAG_HI="-Os"
 310       C_O_FLAG_NORM="-Os"
 311       C_O_FLAG_DEBUG_JVM=""
 312     else
 313       C_O_FLAG_HIGHEST_JVM="-O3"
 314       C_O_FLAG_HIGHEST="-O3"
 315       C_O_FLAG_HI="-O3"
 316       C_O_FLAG_NORM="-O2"
 317       C_O_FLAG_DEBUG_JVM="-O0"
 318     fi
 319     C_O_FLAG_SIZE="-Os"
 320     C_O_FLAG_DEBUG="-O0"
 321     C_O_FLAG_NONE="-O0"
 322   elif test "x$TOOLCHAIN_TYPE" = xxlc; then


 519   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 520     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new -fstack-protector"
 521     TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector"
 522     # technically NOT for CXX (but since this gives *worse* performance, use
 523     # no-strict-aliasing everywhere!)
 524     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing"
 525 
 526   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 527     # Restrict the debug information created by Clang to avoid
 528     # too big object files and speed the build up a little bit
 529     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
 530     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
 531 
 532     # In principle the stack alignment below is cpu- and ABI-dependent and
 533     # should agree with values of StackAlignmentInBytes in various
 534     # src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
 535     # works for all platforms.
 536     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
 537 
 538     if test "x$OPENJDK_TARGET_OS" = xlinux; then






 539       TOOLCHAIN_CFLAGS_JDK="-pipe"
 540       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
 541     fi
 542   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 543     TOOLCHAIN_FLAGS="-errtags -errfmt"
 544     TOOLCHAIN_CFLAGS="-errshort=tags"
 545 
 546     TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
 547     TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
 548     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
 549     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
 550         -library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
 551     if test "x$DEBUG_LEVEL" = xslowdebug; then
 552       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
 553       # to setting +d.
 554       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
 555     fi
 556 
 557   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 558     # Suggested additions: -qsrcmsg to get improved error reporting
 559     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt -qstackprotect"  # add on both CFLAGS
 560     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
 561         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \
 562         -qlanglvl=noredefmac -qnortti -qnoeh -qignerrno -qstackprotect"
 563   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 564     TOOLCHAIN_CFLAGS_JVM="-nologo -MD -MP"
 565     TOOLCHAIN_CFLAGS_JDK="-nologo -MD -Zc:wchar_t-"
 566   fi
 567 
























 568   # CFLAGS WARNINGS STUFF
 569   # Set JVM_CFLAGS warning handling
 570   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 571     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 572     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 573     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 574 
 575   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 576     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 577 
 578   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 579     WARNING_CFLAGS_JDK_CONLY="$WARNINGS_ENABLE_ALL_CFLAGS"
 580     WARNING_CFLAGS_JDK_CXXONLY="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 581     WARNING_CFLAGS_JVM="$WARNINGS_ENABLE_ALL_CXXFLAGS"
 582 
 583   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 584     WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
 585 
 586   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 587     WARNING_CFLAGS=""  # currently left empty


 782 
 783   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 784     if test "x$FLAGS_CPU" = xx86; then
 785       $1_CFLAGS_CPU_JVM="-arch:IA32"
 786     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 787       if test "x$DEBUG_LEVEL" != xrelease; then
 788         # NOTE: This is probably redundant; -homeparams is default on
 789         # non-release builds.
 790         $1_CFLAGS_CPU_JVM="-homeparams"
 791       fi
 792     fi
 793   fi
 794 
 795   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 796     FLAGS_SETUP_GCC6_COMPILER_FLAGS($1, $3)
 797     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
 798 
 799     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
 800   fi
 801 













 802   # EXPORT to API
 803   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM \
 804       $TOOLCHAIN_CFLAGS_JVM ${$1_TOOLCHAIN_CFLAGS_JVM} \
 805       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
 806       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
 807 
 808   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
 809       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
 810       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"

 811 
 812   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
 813   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
 814   # change in the future.)
 815 
 816   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
 817       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
 818   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY \
 819       $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
 820       ${$1_TOOLCHAIN_CFLAGS_JDK_CXXONLY} \
 821       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
 822 
 823   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
 824   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"
 825 
 826   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
 827 
 828   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
 829   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
 830   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"


< prev index next >