PATCH: Require binutils version 2.15.92 for COMDAT group

H. J. Lu hjl@lucon.org
Mon Sep 27 19:08:00 GMT 2004


On Tue, Sep 21, 2004 at 11:04:27PM -0700, Mark Mitchell wrote:
> H. J. Lu wrote:
> 
> >The COMDAT group patch was checked into gcc mainline today. It tries
> >to detect if binutils supports COMDAT group or not. Unfortunately,
> >the simple test
> >
> >.section .text,"axG",%progbits,.foo,comdat
> >
> >isn't enough. Many more COMDAT group binutils bug fixes after
> >
> >http://sources.redhat.com/ml/binutils/2004-04/msg00705.html
> >
> >are needed for a working binutils with COMDAT group support. There are
> >testcases for each COMDAT group bug fix. But some of them are target
> >dependent. The first working COMDAT group binutils is the Linux
> >binutils 2.15.91.0.2. I suggest we bump BFD version to 2.15.92 so that
> >gcc can check 2.15.92 for COMDAT group support.
> >
> OK.
> 

Here is the patch.


H.J.
----
2004-09-27  H.J. Lu  <hongjiu.lu@intel.com>

	* configure.ac: Set ld_vers_major, ld_vers_minor and
	ld_vers_patch for GNU linker. Support linker version x.x.x.x.x.
	Require GNU linker 20040727/2.15.92 or newer for comdat group.
	* configure: Regenerated.

--- gcc/configure.ac.comdat	2004-09-27 09:08:25.000000000 -0700
+++ gcc/configure.ac	2004-09-27 11:18:34.000000000 -0700
@@ -2087,8 +2087,12 @@ changequote(,)dnl
 	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)$,\1,p' \
 	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
 	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p' \
-	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p'`
+	-e 's,^.*[ 	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[ 	].*$,\1,p' \
+	-e 's,^.*[	 ]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)[	 ].*$,\1,p'`
     ld_date=`echo $ld_ver | sed -n 's,^.*\([2-9][0-9][0-9][0-9]\)[-]*\([01][0-9]\)[-]*\([0-3][0-9]\).*$,\1\2\3,p'`
+    ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
+    ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
+    ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
     if test 0"$ld_date" -lt 20020404; then
       if test -n "$ld_date"; then
 	# If there was date string, but was earlier than 2002-04-04, fail
@@ -2097,9 +2101,6 @@ changequote(,)dnl
 	# If there was no date string nor ld version number, something is wrong
 	gcc_cv_ld_hidden=no
       else
-	ld_vers_major=`expr "$ld_vers" : '\([0-9]*\)'`
-	ld_vers_minor=`expr "$ld_vers" : '[0-9]*\.\([0-9]*\)'`
-	ld_vers_patch=`expr "$ld_vers" : '[0-9]*\.[0-9]*\.\([0-9]*\)'`
 	test -z "$ld_vers_patch" && ld_vers_patch=0
 	if test "$ld_vers_major" -lt 2; then
 	  gcc_cv_ld_hidden=no
@@ -2240,15 +2241,34 @@ AC_DEFINE_UNQUOTED(HAVE_GAS_SHF_MERGE,
 [Define 0/1 if your assembler supports marking sections with SHF_MERGE flag.])
 
 gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group,
- [elf,2,15,91], [--fatal-warnings],
+ [elf,2,15,92], [--fatal-warnings],
  [.section .text,"axG",@progbits,.foo,comdat])
 if test $gcc_cv_as_comdat_group = yes; then
   gcc_cv_as_comdat_group_percent=no
 else
  gcc_GAS_CHECK_FEATURE(COMDAT group support, gcc_cv_as_comdat_group_percent,
-   [elf,2,15,91], [--fatal-warnings],
+   [elf,2,15,92], [--fatal-warnings],
    [.section .text,"axG",%progbits,.foo,comdat])
 fi
+if test $in_tree_ld != yes && test x"$ld_vers" != x; then
+  comdat_group=yes
+  if test 0"$ld_date" -lt 20040727; then
+    if test -n "$ld_date"; then
+      # If there was date string, but was earlier than 2002-07-27, fail
+      comdat_group=no
+    elif test "$ld_vers_major" -lt 2; then
+      comdat_group=no
+    elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -lt 15; then
+      comdat_group=no
+    elif test "$ld_vers_major" -eq 2 -a "$ld_vers_minor" -eq 15 -a "$ld_vers_patch" -lt 92; then
+      comdat_group=no
+    fi
+  fi
+  if test $comdat_group = no; then
+    gcc_cv_as_comdat_group=no
+    gcc_cv_as_comdat_group_percent=no
+  fi
+fi
 AC_DEFINE_UNQUOTED(HAVE_GAS_COMDAT_GROUP,
   [`if test $gcc_cv_as_comdat_group = yes || test $gcc_cv_as_comdat_group_percent = yes; then echo 1; else echo 0; fi`],
 [Define 0/1 if your assembler supports COMDAT group.])



More information about the Gcc-patches mailing list