< prev index next >

make/autoconf/flags-cflags.m4

Print this page




 747 
 748   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 749     if test "x$FLAGS_CPU" = xx86; then
 750       $1_CFLAGS_CPU_JVM="-arch:IA32"
 751     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 752       if test "x$DEBUG_LEVEL" != xrelease; then
 753         # NOTE: This is probably redundant; -homeparams is default on
 754         # non-release builds.
 755         $1_CFLAGS_CPU_JVM="-homeparams"
 756       fi
 757     fi
 758   fi
 759 
 760   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 761     TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($1))
 762     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
 763 
 764     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
 765   fi
 766 





















 767   # EXPORT to API
 768   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM $TOOLCHAIN_CFLAGS_JVM \
 769       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
 770       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
 771 
 772   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
 773       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
 774       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"
 775 
 776   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
 777   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
 778   # change in the future.)
 779 
 780   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
 781       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
 782   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
 783       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
 784 


 785   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
 786   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} ${$1_TOOLCHAIN_CFLAGS}"

 787 
 788   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
 789 
 790   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
 791   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
 792   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 793   $2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 794 
 795   AC_SUBST($2JVM_CFLAGS)
 796   AC_SUBST($2CFLAGS_JDKLIB)
 797   AC_SUBST($2CFLAGS_JDKEXE)
 798   AC_SUBST($2CXXFLAGS_JDKLIB)
 799   AC_SUBST($2CXXFLAGS_JDKEXE)

 800 ])
 801 
 802 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
 803 # Arguments:
 804 # $1 - Prefix for each variable defined.
 805 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
 806 [
 807   # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
 808   # runs afoul of the more aggressive versions of these optimisations.
 809   # Notably, value range propagation now assumes that the this pointer of C++
 810   # member functions is non-null.
 811   NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
 812   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
 813   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
 814   dnl                                        IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
 815   NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
 816   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
 817   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
 818   dnl                                        IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
 819   AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])




 747 
 748   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 749     if test "x$FLAGS_CPU" = xx86; then
 750       $1_CFLAGS_CPU_JVM="-arch:IA32"
 751     elif test "x$OPENJDK_TARGET_CPU" = xx86_64; then
 752       if test "x$DEBUG_LEVEL" != xrelease; then
 753         # NOTE: This is probably redundant; -homeparams is default on
 754         # non-release builds.
 755         $1_CFLAGS_CPU_JVM="-homeparams"
 756       fi
 757     fi
 758   fi
 759 
 760   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 761     TOOLCHAIN_CHECK_COMPILER_VERSION(VERSION: 6, PREFIX: $2, IF_AT_LEAST: FLAGS_SETUP_GCC6_COMPILER_FLAGS($1))
 762     $1_TOOLCHAIN_CFLAGS="${$1_GCC6_CFLAGS}"
 763 
 764     $1_WARNING_CFLAGS_JVM="-Wno-format-zero-length -Wtype-limits -Wuninitialized"
 765   fi
 766 
 767   case $TOOLCHAIN_TYPE in
 768     gcc)
 769       $2NO_SPECULATIVE_CTI_CFLAGS="-mindirect-branch=thunk \
 770           -mfunction-return=thunk -mindirect-branch-register"
 771       ;;
 772     microsoft)
 773       $2NO_SPECULATIVE_CTI_CFLAGS="-Qspectre"
 774       ;;
 775     *)
 776       $2NO_SPECULATIVE_CTI_CFLAGS=""
 777       ;;
 778   esac
 779   if test -n "${$2NO_SPECULATIVE_CTI_CFLAGS}"; then
 780     FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${$2NO_SPECULATIVE_CTI_CFLAGS}],
 781         IF_FALSE: [
 782           AC_MSG_WARN([Spectre mitigations not available with compiler version])
 783           $2NO_SPECULATIVE_CTI_CFLAGS=""
 784         ]
 785     )
 786   fi
 787 
 788   # EXPORT to API
 789   CFLAGS_JVM_COMMON="$ALWAYS_CFLAGS_JVM $ALWAYS_DEFINES_JVM $TOOLCHAIN_CFLAGS_JVM \
 790       $OS_CFLAGS $OS_CFLAGS_JVM $CFLAGS_OS_DEF_JVM $DEBUG_CFLAGS_JVM \
 791       $WARNING_CFLAGS $WARNING_CFLAGS_JVM $JVM_PICFLAG"
 792 
 793   CFLAGS_JDK_COMMON="$ALWAYS_CFLAGS_JDK $ALWAYS_DEFINES_JDK $TOOLCHAIN_CFLAGS_JDK \
 794       $OS_CFLAGS $CFLAGS_OS_DEF_JDK $DEBUG_CFLAGS_JDK $DEBUG_OPTIONS_FLAGS_JDK \
 795       $WARNING_CFLAGS $WARNING_CFLAGS_JDK $DEBUG_SYMBOLS_CFLAGS_JDK"
 796 
 797   # Use ${$2EXTRA_CFLAGS} to block EXTRA_CFLAGS to be added to build flags.
 798   # (Currently we don't have any OPENJDK_BUILD_EXTRA_CFLAGS, but that might
 799   # change in the future.)
 800 
 801   CFLAGS_JDK_COMMON_CONLY="$TOOLCHAIN_CFLAGS_JDK_CONLY  \
 802       $WARNING_CFLAGS_JDK_CONLY ${$2EXTRA_CFLAGS}"
 803   CFLAGS_JDK_COMMON_CXXONLY="$ALWAYS_DEFINES_JDK_CXXONLY $TOOLCHAIN_CFLAGS_JDK_CXXONLY \
 804       $WARNING_CFLAGS_JDK_CXXONLY ${$2EXTRA_CXXFLAGS}"
 805 
 806   # The jdk libraries always use the speculative calls mitigations, while it's
 807   # optional for the JVM.
 808   $1_CFLAGS_JVM="${$1_DEFINES_CPU_JVM} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JVM} ${$1_TOOLCHAIN_CFLAGS} ${$1_WARNING_CFLAGS_JVM}"
 809   $1_CFLAGS_JDK="${$1_DEFINES_CPU_JDK} ${$1_CFLAGS_CPU} ${$1_CFLAGS_CPU_JDK} \
 810       ${$1_TOOLCHAIN_CFLAGS} ${$2NO_SPECULATIVE_CTI_CFLAGS}"
 811 
 812   $2JVM_CFLAGS="$CFLAGS_JVM_COMMON ${$1_CFLAGS_JVM} ${$2EXTRA_CXXFLAGS}"
 813 
 814   $2CFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CONLY ${$1_CFLAGS_JDK}"
 815   $2CXXFLAGS_JDKEXE="$CFLAGS_JDK_COMMON $CFLAGS_JDK_COMMON_CXXONLY ${$1_CFLAGS_JDK}"
 816   $2CFLAGS_JDKLIB="${$2CFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 817   $2CXXFLAGS_JDKLIB="${$2CXXFLAGS_JDKEXE} $JDK_PICFLAG ${$1_CFLAGS_CPU_JDK_LIBONLY}"
 818 
 819   AC_SUBST($2JVM_CFLAGS)
 820   AC_SUBST($2CFLAGS_JDKLIB)
 821   AC_SUBST($2CFLAGS_JDKEXE)
 822   AC_SUBST($2CXXFLAGS_JDKLIB)
 823   AC_SUBST($2CXXFLAGS_JDKEXE)
 824   AC_SUBST($2NO_SPECULATIVE_CTI_CFLAGS)
 825 ])
 826 
 827 # FLAGS_SETUP_GCC6_COMPILER_FLAGS([PREFIX])
 828 # Arguments:
 829 # $1 - Prefix for each variable defined.
 830 AC_DEFUN([FLAGS_SETUP_GCC6_COMPILER_FLAGS],
 831 [
 832   # These flags are required for GCC 6 builds as undefined behaviour in OpenJDK code
 833   # runs afoul of the more aggressive versions of these optimisations.
 834   # Notably, value range propagation now assumes that the this pointer of C++
 835   # member functions is non-null.
 836   NO_DELETE_NULL_POINTER_CHECKS_CFLAG="-fno-delete-null-pointer-checks"
 837   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
 838   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_DELETE_NULL_POINTER_CHECKS_CFLAG -Werror],
 839   dnl                                        IF_FALSE: [NO_DELETE_NULL_POINTER_CHECKS_CFLAG=""])
 840   NO_LIFETIME_DSE_CFLAG="-fno-lifetime-dse"
 841   dnl Argument check is disabled until FLAGS_COMPILER_CHECK_ARGUMENTS handles cross-compilation
 842   dnl FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$NO_LIFETIME_DSE_CFLAG -Werror],
 843   dnl                                        IF_FALSE: [NO_LIFETIME_DSE_CFLAG=""])
 844   AC_MSG_NOTICE([GCC >= 6 detected; adding ${NO_DELETE_NULL_POINTER_CHECKS_CFLAG} and ${NO_LIFETIME_DSE_CFLAG}])


< prev index next >