common/autoconf/toolchain.m4
changeset 24911 a039e17f8896
parent 23429 fe4f0848a307
child 25034 d9ca34c227b8
equal deleted inserted replaced
24801:410bccbded9e 24911:a039e17f8896
    22 # or visit www.oracle.com if you need additional information or have any
    22 # or visit www.oracle.com if you need additional information or have any
    23 # questions.
    23 # questions.
    24 #
    24 #
    25 
    25 
    26 ########################################################################
    26 ########################################################################
    27 # This file is responsible for detecting, verifying and setting up the 
    27 # This file is responsible for detecting, verifying and setting up the
    28 # toolchain, i.e. the compiler, linker and related utilities. It will setup 
    28 # toolchain, i.e. the compiler, linker and related utilities. It will setup
    29 # proper paths to the binaries, but it will not setup any flags.
    29 # proper paths to the binaries, but it will not setup any flags.
    30 #
    30 #
    31 # The binaries used is determined by the toolchain type, which is the family of 
    31 # The binaries used is determined by the toolchain type, which is the family of
    32 # compilers and related tools that are used.
    32 # compilers and related tools that are used.
    33 ########################################################################
    33 ########################################################################
    34 
    34 
    35 
    35 
    36 # All valid toolchains, regardless of platform (used by help.m4)
    36 # All valid toolchains, regardless of platform (used by help.m4)
    81   AC_SUBST(SHARED_LIBRARY_SUFFIX)
    81   AC_SUBST(SHARED_LIBRARY_SUFFIX)
    82   AC_SUBST(STATIC_LIBRARY_SUFFIX)
    82   AC_SUBST(STATIC_LIBRARY_SUFFIX)
    83   AC_SUBST(SHARED_LIBRARY)
    83   AC_SUBST(SHARED_LIBRARY)
    84   AC_SUBST(STATIC_LIBRARY)
    84   AC_SUBST(STATIC_LIBRARY)
    85   AC_SUBST(OBJ_SUFFIX)
    85   AC_SUBST(OBJ_SUFFIX)
    86   AC_SUBST(EXE_SUFFIX)  
    86   AC_SUBST(EXE_SUFFIX)
    87 ])
    87 ])
    88 
    88 
    89 # Determine which toolchain type to use, and make sure it is valid for this
    89 # Determine which toolchain type to use, and make sure it is valid for this
    90 # platform. Setup various information about the selected toolchain.
    90 # platform. Setup various information about the selected toolchain.
    91 AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
    91 AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
   115     fi
   115     fi
   116   else
   116   else
   117     # First toolchain type in the list is the default
   117     # First toolchain type in the list is the default
   118     DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
   118     DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
   119   fi
   119   fi
   120   
   120 
   121   if test "x$with_toolchain_type" = xlist; then
   121   if test "x$with_toolchain_type" = xlist; then
   122     # List all toolchains
   122     # List all toolchains
   123     AC_MSG_NOTICE([The following toolchains are valid on this platform:])
   123     AC_MSG_NOTICE([The following toolchains are valid on this platform:])
   124     for toolchain in $VALID_TOOLCHAINS; do
   124     for toolchain in $VALID_TOOLCHAINS; do
   125       toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
   125       toolchain_var_name=TOOLCHAIN_DESCRIPTION_$toolchain
   126       TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
   126       TOOLCHAIN_DESCRIPTION=${!toolchain_var_name}
   127       $PRINTF "  %-10s  %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
   127       $PRINTF "  %-10s  %s\n" $toolchain "$TOOLCHAIN_DESCRIPTION"
   128     done
   128     done
   129     
   129 
   130     exit 0
   130     exit 0
   131   elif test "x$with_toolchain_type" != x; then
   131   elif test "x$with_toolchain_type" != x; then
   132     # User override; check that it is valid
   132     # User override; check that it is valid
   133     if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
   133     if test "x${VALID_TOOLCHAINS/$with_toolchain_type/}" = "x${VALID_TOOLCHAINS}"; then
   134       AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
   134       AC_MSG_NOTICE([Toolchain type $with_toolchain_type is not valid on this platform.])
   166 
   166 
   167   if test "x$TOOLCHAIN_TYPE" = "x$DEFAULT_TOOLCHAIN"; then
   167   if test "x$TOOLCHAIN_TYPE" = "x$DEFAULT_TOOLCHAIN"; then
   168     AC_MSG_NOTICE([Using default toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)])
   168     AC_MSG_NOTICE([Using default toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION)])
   169   else
   169   else
   170     AC_MSG_NOTICE([Using user selected toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION). Default toolchain is $DEFAULT_TOOLCHAIN.])
   170     AC_MSG_NOTICE([Using user selected toolchain $TOOLCHAIN_TYPE ($TOOLCHAIN_DESCRIPTION). Default toolchain is $DEFAULT_TOOLCHAIN.])
   171   fi 
   171   fi
   172 ])
   172 ])
   173 
   173 
   174 # Before we start detecting the toolchain executables, we might need some 
   174 # Before we start detecting the toolchain executables, we might need some
   175 # special setup, e.g. additional paths etc.
   175 # special setup, e.g. additional paths etc.
   176 AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
   176 AC_DEFUN_ONCE([TOOLCHAIN_PRE_DETECTION],
   177 [
   177 [
   178   # FIXME: Is this needed?
   178   # FIXME: Is this needed?
   179   AC_LANG(C++)
   179   AC_LANG(C++)
   182   ORG_CFLAGS="$CFLAGS"
   182   ORG_CFLAGS="$CFLAGS"
   183   ORG_CXXFLAGS="$CXXFLAGS"
   183   ORG_CXXFLAGS="$CXXFLAGS"
   184   ORG_OBJCFLAGS="$OBJCFLAGS"
   184   ORG_OBJCFLAGS="$OBJCFLAGS"
   185 
   185 
   186   # On Windows, we need to detect the visual studio installation first.
   186   # On Windows, we need to detect the visual studio installation first.
   187   # This will change the PATH, but we need to keep that new PATH even 
   187   # This will change the PATH, but we need to keep that new PATH even
   188   # after toolchain detection is done, since the compiler (on x86) uses
   188   # after toolchain detection is done, since the compiler (on x86) uses
   189   # it for DLL resolution in runtime.
   189   # it for DLL resolution in runtime.
   190   if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
   190   if test "x$OPENJDK_BUILD_OS" = "xwindows" && test "x$TOOLCHAIN_TYPE" = "xmicrosoft"; then
   191     TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
   191     TOOLCHAIN_SETUP_VISUAL_STUDIO_ENV
   192     # Reset path to VS_PATH. It will include everything that was on PATH at the time we
   192     # Reset path to VS_PATH. It will include everything that was on PATH at the time we
   206   # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
   206   # FIXME: This was originally only done for AS,NM,GNM,STRIP,MCS,OBJCOPY,OBJDUMP.
   207   if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   207   if test "x$OPENJDK_BUILD_OS" = xsolaris; then
   208     PATH="/usr/ccs/bin:$PATH"
   208     PATH="/usr/ccs/bin:$PATH"
   209   fi
   209   fi
   210 
   210 
   211   # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to 
   211   # Finally add TOOLCHAIN_PATH at the beginning, to allow --with-tools-dir to
   212   # override all other locations.
   212   # override all other locations.
   213   if test "x$TOOLCHAIN_PATH" != x; then
   213   if test "x$TOOLCHAIN_PATH" != x; then
   214     PATH=$TOOLCHAIN_PATH:$PATH
   214     PATH=$TOOLCHAIN_PATH:$PATH
   215   fi
   215   fi
   216 ])
   216 ])
   252       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
   252       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
   253       AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_OUTPUT"])
   253       AC_MSG_NOTICE([The result from running with -V was: "$COMPILER_VERSION_OUTPUT"])
   254       AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
   254       AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
   255       AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
   255       AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
   256     fi
   256     fi
   257     # Remove usage instructions (if present), and 
   257     # Remove usage instructions (if present), and
   258     # collapse compiler output into a single line
   258     # collapse compiler output into a single line
   259     COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
   259     COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
   260         $SED -e 's/ *@<:@Uu@:>@sage:.*//'`
   260         $SED -e 's/ *@<:@Uu@:>@sage:.*//'`
   261     COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
   261     COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
   262         $SED -e "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/"`
   262         $SED -e "s/^.*@<:@ ,\t@:>@$COMPILER_NAME@<:@ ,\t@:>@\(@<:@1-9@:>@\.@<:@0-9@:>@@<:@0-9@:>@*\).*/\1/"`
   280         $SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
   280         $SED -e 's/^.*, V\(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
   281   elif test  "x$TOOLCHAIN_TYPE" = xmicrosoft; then
   281   elif test  "x$TOOLCHAIN_TYPE" = xmicrosoft; then
   282     # There is no specific version flag, but all output starts with a version string.
   282     # There is no specific version flag, but all output starts with a version string.
   283     # First line typically looks something like:
   283     # First line typically looks something like:
   284     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
   284     # Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
   285     COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`    
   285     COMPILER_VERSION_OUTPUT=`$COMPILER 2>&1 | $HEAD -n 1 | $TR -d '\r'`
   286     # Check that this is likely to be Microsoft CL.EXE.
   286     # Check that this is likely to be Microsoft CL.EXE.
   287     $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null
   287     $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "Microsoft.*Compiler" > /dev/null
   288     if test $? -ne 0; then
   288     if test $? -ne 0; then
   289       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
   289       AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
   290       AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
   290       AC_MSG_NOTICE([The result from running it was: "$COMPILER_VERSION_OUTPUT"])
   358   if test "x[$]$1" != x; then
   358   if test "x[$]$1" != x; then
   359     # User has supplied compiler name already, always let that override.
   359     # User has supplied compiler name already, always let that override.
   360     AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
   360     AC_MSG_NOTICE([Will use user supplied compiler $1=[$]$1])
   361     if test "x`basename [$]$1`" = "x[$]$1"; then
   361     if test "x`basename [$]$1`" = "x[$]$1"; then
   362       # A command without a complete path is provided, search $PATH.
   362       # A command without a complete path is provided, search $PATH.
   363       
   363 
   364       AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
   364       AC_PATH_PROGS(POTENTIAL_$1, [$]$1)
   365       if test "x$POTENTIAL_$1" != x; then
   365       if test "x$POTENTIAL_$1" != x; then
   366         $1=$POTENTIAL_$1
   366         $1=$POTENTIAL_$1
   367       else
   367       else
   368         AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
   368         AC_MSG_ERROR([User supplied compiler $1=[$]$1 could not be found])
   373         AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
   373         AC_MSG_ERROR([User supplied compiler $1=[$]$1 does not exist])
   374       fi
   374       fi
   375     fi
   375     fi
   376   else
   376   else
   377     # No user supplied value. Locate compiler ourselves.
   377     # No user supplied value. Locate compiler ourselves.
   378     
   378 
   379     # If we are cross compiling, assume cross compilation tools follows the
   379     # If we are cross compiling, assume cross compilation tools follows the
   380     # cross compilation standard where they are prefixed with the autoconf
   380     # cross compilation standard where they are prefixed with the autoconf
   381     # standard name for the target. For example the binary 
   381     # standard name for the target. For example the binary
   382     # i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
   382     # i686-sun-solaris2.10-gcc will cross compile for i686-sun-solaris2.10.
   383     # If we are not cross compiling, then the default compiler name will be 
   383     # If we are not cross compiling, then the default compiler name will be
   384     # used.
   384     # used.
   385 
   385 
   386     $1=
   386     $1=
   387     # If TOOLCHAIN_PATH is set, check for all compiler names in there first
   387     # If TOOLCHAIN_PATH is set, check for all compiler names in there first
   388     # before checking the rest of the PATH.
   388     # before checking the rest of the PATH.
   448   fi
   448   fi
   449 
   449 
   450   TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
   450   TOOLCHAIN_CHECK_COMPILER_VERSION([$1], [$COMPILER_NAME])
   451 ])
   451 ])
   452 
   452 
   453 # Detect the core components of the toolchain, i.e. the compilers (CC and CXX), 
   453 # Detect the core components of the toolchain, i.e. the compilers (CC and CXX),
   454 # preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the 
   454 # preprocessor (CPP and CXXCPP), the linker (LD), the assembler (AS) and the
   455 # archiver (AR). Verify that the compilers are correct according to the 
   455 # archiver (AR). Verify that the compilers are correct according to the
   456 # toolchain type.
   456 # toolchain type.
   457 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
   457 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
   458 [
   458 [
   459   #
   459   #
   460   # Setup the compilers (CC and CXX)
   460   # Setup the compilers (CC and CXX)
   527   fi
   527   fi
   528   BASIC_FIXUP_EXECUTABLE(AR)
   528   BASIC_FIXUP_EXECUTABLE(AR)
   529 ])
   529 ])
   530 
   530 
   531 # Setup additional tools that is considered a part of the toolchain, but not the
   531 # Setup additional tools that is considered a part of the toolchain, but not the
   532 # core part. Many of these are highly platform-specific and do not exist, 
   532 # core part. Many of these are highly platform-specific and do not exist,
   533 # and/or are not needed on all platforms.
   533 # and/or are not needed on all platforms.
   534 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
   534 AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
   535 [
   535 [
   536   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   536   if test "x$OPENJDK_TARGET_OS" = "xmacosx"; then
   537     AC_PROG_OBJC
   537     AC_PROG_OBJC
   549     AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   549     AC_CHECK_PROG([RC], [rc], [rc],,, [/usr/bin/rc])
   550     BASIC_FIXUP_EXECUTABLE(RC)
   550     BASIC_FIXUP_EXECUTABLE(RC)
   551     AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   551     AC_CHECK_PROG([DUMPBIN], [dumpbin], [dumpbin],,,)
   552     BASIC_FIXUP_EXECUTABLE(DUMPBIN)
   552     BASIC_FIXUP_EXECUTABLE(DUMPBIN)
   553   fi
   553   fi
   554   
   554 
   555   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   555   if test "x$OPENJDK_TARGET_OS" = xsolaris; then
   556     BASIC_PATH_PROGS(STRIP, strip)
   556     BASIC_PATH_PROGS(STRIP, strip)
   557     BASIC_FIXUP_EXECUTABLE(STRIP)
   557     BASIC_FIXUP_EXECUTABLE(STRIP)
   558     BASIC_PATH_PROGS(NM, nm)
   558     BASIC_PATH_PROGS(NM, nm)
   559     BASIC_FIXUP_EXECUTABLE(NM)
   559     BASIC_FIXUP_EXECUTABLE(NM)
   560     BASIC_PATH_PROGS(GNM, gnm)
   560     BASIC_PATH_PROGS(GNM, gnm)
   561     BASIC_FIXUP_EXECUTABLE(GNM)
   561     BASIC_FIXUP_EXECUTABLE(GNM)
   562     
   562 
   563     BASIC_PATH_PROGS(MCS, mcs)
   563     BASIC_PATH_PROGS(MCS, mcs)
   564     BASIC_FIXUP_EXECUTABLE(MCS)
   564     BASIC_FIXUP_EXECUTABLE(MCS)
   565   elif test "x$OPENJDK_TARGET_OS" != xwindows; then
   565   elif test "x$OPENJDK_TARGET_OS" != xwindows; then
   566     # FIXME: we should unify this with the solaris case above.
   566     # FIXME: we should unify this with the solaris case above.
   567     BASIC_CHECK_TOOLS(STRIP, strip)
   567     BASIC_CHECK_TOOLS(STRIP, strip)
   590   fi
   590   fi
   591 ])
   591 ])
   592 
   592 
   593 # Setup the build tools (i.e, the compiler and linker used to build programs
   593 # Setup the build tools (i.e, the compiler and linker used to build programs
   594 # that should be run on the build platform, not the target platform, as a build
   594 # that should be run on the build platform, not the target platform, as a build
   595 # helper). Since the non-cross-compile case uses the normal, target compilers 
   595 # helper). Since the non-cross-compile case uses the normal, target compilers
   596 # for this, we can only do this after these have been setup.
   596 # for this, we can only do this after these have been setup.
   597 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
   597 AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
   598 [  
   598 [
   599   if test "x$COMPILE_TYPE" = "xcross"; then
   599   if test "x$COMPILE_TYPE" = "xcross"; then
   600     # Now we need to find a C/C++ compiler that can build executables for the
   600     # Now we need to find a C/C++ compiler that can build executables for the
   601     # build platform. We can't use the AC_PROG_CC macro, since it can only be
   601     # build platform. We can't use the AC_PROG_CC macro, since it can only be
   602     # used once. Also, we need to do this without adding a tools dir to the
   602     # used once. Also, we need to do this without adding a tools dir to the
   603     # path, otherwise we might pick up cross-compilers which don't use standard
   603     # path, otherwise we might pick up cross-compilers which don't use standard
   604     # naming.
   604     # naming.
   605     
   605 
   606     # FIXME: we should list the discovered compilers as an exclude pattern!
   606     # FIXME: we should list the discovered compilers as an exclude pattern!
   607     # If we do that, we can do this detection before POST_DETECTION, and still
   607     # If we do that, we can do this detection before POST_DETECTION, and still
   608     # find the build compilers in the tools dir, if needed.
   608     # find the build compilers in the tools dir, if needed.
   609     BASIC_PATH_PROGS(BUILD_CC, [cl cc gcc])
   609     BASIC_PATH_PROGS(BUILD_CC, [cl cc gcc])
   610     BASIC_FIXUP_EXECUTABLE(BUILD_CC)
   610     BASIC_FIXUP_EXECUTABLE(BUILD_CC)
   688 
   688 
   689   if test "x$TOOLCHAIN_TYPE" = xgcc; then
   689   if test "x$TOOLCHAIN_TYPE" = xgcc; then
   690     # If this is a --hash-style=gnu system, use --hash-style=both, why?
   690     # If this is a --hash-style=gnu system, use --hash-style=both, why?
   691     HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
   691     HAS_GNU_HASH=`$CC -dumpspecs 2>/dev/null | $GREP 'hash-style=gnu'`
   692     # This is later checked when setting flags.
   692     # This is later checked when setting flags.
   693   fi
   693 
   694 
   694     # "-Og" suppported for GCC 4.8 and later
   695   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed 
   695     CFLAG_OPTIMIZE_DEBUG_FLAG="-Og"
       
   696     FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_OPTIMIZE_DEBUG_FLAG],
       
   697       [HAS_CFLAG_OPTIMIZE_DEBUG=true],
       
   698       [HAS_CFLAG_OPTIMIZE_DEBUG=false])
       
   699 
       
   700     # "-fsanitize=undefined" supported for GCC 4.9 and later
       
   701     CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG="-fsanitize=undefined -fsanitize-recover"
       
   702     FLAGS_COMPILER_CHECK_ARGUMENTS([$CFLAG_DETECT_UNDEFINED_BEHAVIOR_FLAG],
       
   703       [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=true],
       
   704       [HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR=false])
       
   705 
       
   706     # "-z relro" supported in GNU binutils 2.17 and later
       
   707     LINKER_RELRO_FLAG="-Xlinker -z -Xlinker relro"
       
   708     FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_RELRO_FLAG],
       
   709       [HAS_LINKER_RELRO=true],
       
   710       [HAS_LINKER_RELRO=false])
       
   711 
       
   712     # "-z now" supported in GNU binutils 2.11 and later
       
   713     LINKER_NOW_FLAG="-Xlinker -z -Xlinker now"
       
   714     FLAGS_LINKER_CHECK_ARGUMENTS([$LINKER_NOW_FLAG],
       
   715       [HAS_LINKER_NOW=true],
       
   716       [HAS_LINKER_NOW=false])
       
   717   fi
       
   718 
       
   719   # Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
   696   # in executable.'
   720   # in executable.'
   697   USING_BROKEN_SUSE_LD=no
   721   USING_BROKEN_SUSE_LD=no
   698   if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$TOOLCHAIN_TYPE" = xgcc; then
   722   if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$TOOLCHAIN_TYPE" = xgcc; then
   699     AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
   723     AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
   700     echo "SUNWprivate_1.1 { local: *; };" > version-script.map
   724     $ECHO "SUNWprivate_1.1 { local: *; };" > version-script.map
   701     echo "int main() { }" > main.c
   725     $ECHO "int main() { }" > main.c
   702     if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
   726     if $CXX -Xlinker -version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
   703       AC_MSG_RESULT(no)
   727       AC_MSG_RESULT(no)
   704       USING_BROKEN_SUSE_LD=no
   728       USING_BROKEN_SUSE_LD=no
   705     else
   729     else
   706       AC_MSG_RESULT(yes)
   730       AC_MSG_RESULT(yes)