There's some potential to cleanup Solaris linker version checks: * gcc_AC_INITFINI_ARRAY in acinclude.m4 is unused, but still serves as documentation for the various variants of ld version strings. This is now moved to configure.ac.
* Solaris 11.4 has (or shortly will have) some changes to the version numbering: until now this is something like ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.2560 but will become ld: Solaris ELF Utilities: 11.4-1.3123 like the rest of Solaris binutils (ar, nm, ...) already have. The patch below accomodates both formats. Bootstrapped without regressions on i386-pc-solaris2.11.4, i386-pc-solaris2.10, to be installed on mainline shortly. Rainer -- ----------------------------------------------------------------------------- Rainer Orth, Center for Biotechnology, Bielefeld University 2017-10-26 Rainer Orth <r...@cebitec.uni-bielefeld.de> * acinclude.m4 (gcc_AC_INITFINI_ARRAY): Don't require gcc_SUN_LD_VERSION. (gcc_GAS_CHECK_FEATURE): Remove. * configure.ac (ld_vers) <*-*-solaris2*>: Move comments from gcc_AC_INITFINI_ARRAY here. Update for Solaris 11.4 changes. * configure: Regenerate.
# HG changeset patch # Parent d45c8c8a41993c685d1de58840fc675b4cb7b5c0 Cleanup Solaris linker version checks diff --git a/gcc/acinclude.m4 b/gcc/acinclude.m4 --- a/gcc/acinclude.m4 +++ b/gcc/acinclude.m4 @@ -277,8 +277,7 @@ fi fi]) AC_DEFUN([gcc_AC_INITFINI_ARRAY], -[AC_REQUIRE([gcc_SUN_LD_VERSION])dnl -AC_ARG_ENABLE(initfini-array, +[AC_ARG_ENABLE(initfini-array, [ --enable-initfini-array use .init_array/.fini_array sections], [], [ AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support, @@ -556,43 +555,6 @@ if test $[$2] != yes; then $8 fi])]) -dnl gcc_SUN_LD_VERSION -dnl -dnl Determines Sun linker version numbers, setting gcc_cv_sun_ld_vers to -dnl the complete version number and gcc_cv_sun_ld_vers_{major, minor} to -dnl the corresponding fields. -dnl -dnl ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version -dnl numbers can be used in ld.so.1 feature checks even if a different -dnl linker is configured. -dnl -AC_DEFUN([gcc_SUN_LD_VERSION], -[changequote(,)dnl -if test "x${build}" = "x${target}" && test "x${build}" = "x${host}"; then - case "${target}" in - *-*-solaris2*) - # - # Solaris 2 ld -V output looks like this for a regular version: - # - # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699 - # - # but test versions add stuff at the end: - # - # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 - # - gcc_cv_sun_ld_ver=`/usr/ccs/bin/ld -V 2>&1` - if echo "$gcc_cv_sun_ld_ver" | grep 'Solaris Link Editors' > /dev/null; then - gcc_cv_sun_ld_vers=`echo $gcc_cv_sun_ld_ver | sed -n \ - -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` - gcc_cv_sun_ld_vers_major=`expr "$gcc_cv_sun_ld_vers" : '\([0-9]*\)'` - gcc_cv_sun_ld_vers_minor=`expr "$gcc_cv_sun_ld_vers" : '[0-9]*\.\([0-9]*\)'` - fi - ;; - esac -fi -changequote([,])dnl -]) - dnl GCC_TARGET_TEMPLATE(KEY) dnl ------------------------ dnl Define KEY as a valid configure key on the target machine. diff --git a/gcc/configure.ac b/gcc/configure.ac --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2587,15 +2587,25 @@ if test $in_tree_ld != yes ; then else case "${target}" in *-*-solaris2*) - # See acinclude.m4 (gcc_SUN_LD_VERSION) for the version number - # format. + # Solaris 2 ld -V output looks like this for a regular version: # - # Don't reuse gcc_gv_sun_ld_vers_* in case a linker other than - # /usr/ccs/bin/ld has been configured. + # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1699 + # + # but test versions add stuff at the end: + # + # ld: Software Generation Utilities - Solaris Link Editors: 5.11-1.1701:onnv-ab196087-6931056-03/25/10 + # + # In Solaris 11.4, this was changed to + # + # ld: Solaris ELF Utilities: 11.4-1.3123 + # + # ld and ld.so.1 are guaranteed to be updated in lockstep, so ld version + # numbers can be used in ld.so.1 feature checks even if a different + # linker is configured. ld_ver=`$gcc_cv_ld -V 2>&1` - if echo "$ld_ver" | grep 'Solaris Link Editors' > /dev/null; then + if echo "$ld_ver" | $EGREP 'Solaris Link Editors|Solaris ELF Utilities' > /dev/null; then ld_vers=`echo $ld_ver | sed -n \ - -e 's,^.*: 5\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\1,p'` + -e 's,^.*: \(5\|1[0-9]\)\.[0-9][0-9]*-\([0-9]\.[0-9][0-9]*\).*$,\2,p'` ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'` ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'` fi