< prev index next >

make/autoconf/flags-cflags.m4

Print this page
8205649: Make clang stack flags independent of OS
Reviewed-by: erikj


 474 
 475   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 476     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new"
 477     TOOLCHAIN_CFLAGS_JDK="-pipe"
 478     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!)
 479 
 480     CXXSTD_CXXFLAG="-std=gnu++98"
 481     FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
 482                                                  IF_FALSE: [CXXSTD_CXXFLAG=""])
 483     TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
 484     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CXXSTD_CXXFLAG"
 485     ADLC_CXXFLAG="$CXXSTD_CXXFLAG"
 486 
 487 
 488   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 489     # Restrict the debug information created by Clang to avoid
 490     # too big object files and speed the build up a little bit
 491     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
 492     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
 493 






 494     if test "x$OPENJDK_TARGET_OS" = xlinux; then
 495       TOOLCHAIN_CFLAGS_JDK="-pipe"
 496       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
 497     fi
 498   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 499     TOOLCHAIN_CFLAGS_JDK="-mt"
 500     TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -v -W0,-noglobal" # C only
 501     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
 502     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
 503         -library=stlport4 -mt -features=no%except"
 504     if test "x$DEBUG_LEVEL" = xslowdebug; then
 505       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
 506       # to setting +d.
 507       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
 508     fi
 509 
 510   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 511     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt"  # add on both CFLAGS
 512     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
 513         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \


 582     # Since large TOC causes perf. overhead, only pay it where we must. Currently this is
 583     # for all libjvm variants (both gtest and normal) but no other binaries. So, build
 584     # libjvm with -qpic=large and link with -bbigtoc.
 585     JVM_PICFLAG="-qpic=large"
 586     JDK_PICFLAG="-qpic"
 587   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 588     PICFLAG=""
 589   fi
 590 
 591   if test "x$TOOLCHAIN_TYPE" != xxlc; then
 592     JVM_PICFLAG="$PICFLAG"
 593     JDK_PICFLAG="$PICFLAG"
 594   fi
 595 
 596   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 597     # Linking is different on MacOSX
 598     JDK_PICFLAG=''
 599     if test "x$STATIC_BUILD" = xtrue; then
 600       JVM_PICFLAG=""
 601     fi
 602   fi
 603 
 604   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 605     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
 606   fi
 607 
 608   # Optional POSIX functionality needed by the JVM
 609   #
 610   # Check if clock_gettime is available and in which library. This indicates
 611   # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
 612   # don't let it update LIBS.
 613   save_LIBS="$LIBS"
 614   AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
 615   if test "x$LIBS" = "x-lrt "; then
 616     CLOCK_GETTIME_IN_LIBRT=true
 617   fi
 618   LIBS="$save_LIBS"
 619 
 620   if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
 621     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
 622     if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
 623       OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
 624     fi
 625   fi




 474 
 475   if test "x$TOOLCHAIN_TYPE" = xgcc; then
 476     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fcheck-new"
 477     TOOLCHAIN_CFLAGS_JDK="-pipe"
 478     TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX (but since this gives *worse* performance, use no-strict-aliasing everywhere!)
 479 
 480     CXXSTD_CXXFLAG="-std=gnu++98"
 481     FLAGS_CXX_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [$CXXSTD_CXXFLAG -Werror],
 482                                                  IF_FALSE: [CXXSTD_CXXFLAG=""])
 483     TOOLCHAIN_CFLAGS_JDK_CXXONLY="$CXXSTD_CXXFLAG"
 484     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $CXXSTD_CXXFLAG"
 485     ADLC_CXXFLAG="$CXXSTD_CXXFLAG"
 486 
 487 
 488   elif test "x$TOOLCHAIN_TYPE" = xclang; then
 489     # Restrict the debug information created by Clang to avoid
 490     # too big object files and speed the build up a little bit
 491     # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
 492     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -flimit-debug-info"
 493 
 494     # In principle the stack alignment below is cpu- and ABI-dependent and
 495     # should agree with values of StackAlignmentInBytes in various
 496     # src/hotspot/cpu/*/globalDefinitions_*.hpp files, but this value currently
 497     # works for all platforms.
 498     TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -mno-omit-leaf-frame-pointer -mstack-alignment=16"
 499 
 500     if test "x$OPENJDK_TARGET_OS" = xlinux; then
 501       TOOLCHAIN_CFLAGS_JDK="-pipe"
 502       TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
 503     fi
 504   elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
 505     TOOLCHAIN_CFLAGS_JDK="-mt"
 506     TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -v -W0,-noglobal" # C only
 507     TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
 508     TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
 509         -library=stlport4 -mt -features=no%except"
 510     if test "x$DEBUG_LEVEL" = xslowdebug; then
 511       # Previously -g was used instead of -g0 for slowdebug; this is equivalent
 512       # to setting +d.
 513       TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM +d"
 514     fi
 515 
 516   elif test "x$TOOLCHAIN_TYPE" = xxlc; then
 517     TOOLCHAIN_CFLAGS_JDK="-qchars=signed -qfullpath -qsaveopt"  # add on both CFLAGS
 518     TOOLCHAIN_CFLAGS_JVM="-qtune=balanced \
 519         -qalias=noansi -qstrict -qtls=default -qlanglvl=c99vla \


 588     # Since large TOC causes perf. overhead, only pay it where we must. Currently this is
 589     # for all libjvm variants (both gtest and normal) but no other binaries. So, build
 590     # libjvm with -qpic=large and link with -bbigtoc.
 591     JVM_PICFLAG="-qpic=large"
 592     JDK_PICFLAG="-qpic"
 593   elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
 594     PICFLAG=""
 595   fi
 596 
 597   if test "x$TOOLCHAIN_TYPE" != xxlc; then
 598     JVM_PICFLAG="$PICFLAG"
 599     JDK_PICFLAG="$PICFLAG"
 600   fi
 601 
 602   if test "x$OPENJDK_TARGET_OS" = xmacosx; then
 603     # Linking is different on MacOSX
 604     JDK_PICFLAG=''
 605     if test "x$STATIC_BUILD" = xtrue; then
 606       JVM_PICFLAG=""
 607     fi




 608   fi
 609 
 610   # Optional POSIX functionality needed by the JVM
 611   #
 612   # Check if clock_gettime is available and in which library. This indicates
 613   # availability of CLOCK_MONOTONIC for hotspot. But we don't need to link, so
 614   # don't let it update LIBS.
 615   save_LIBS="$LIBS"
 616   AC_SEARCH_LIBS(clock_gettime, rt, [HAS_CLOCK_GETTIME=true], [])
 617   if test "x$LIBS" = "x-lrt "; then
 618     CLOCK_GETTIME_IN_LIBRT=true
 619   fi
 620   LIBS="$save_LIBS"
 621 
 622   if test "x$HAS_CLOCK_GETTIME" = "xtrue"; then
 623     OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DSUPPORTS_CLOCK_MONOTONIC"
 624     if test "x$CLOCK_GETTIME_IN_LIBRT" = "xtrue"; then
 625       OS_CFLAGS_JVM="$OS_CFLAGS_JVM -DNEEDS_LIBRT"
 626     fi
 627   fi


< prev index next >