patches/binutils/2.15.91.0.2/binutils-dup-sections.patch
changeset 9 22fec39016f4
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.15.91.0.2/binutils-dup-sections.patch	Sun Mar 04 20:09:22 2007 +0000
     1.3 @@ -0,0 +1,68 @@
     1.4 +See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
     1.5 +
     1.6 +Date: Fri, 20 Aug 2004 21:13:43 -0400
     1.7 +From: Daniel Jacobowitz <drow at false dot org>
     1.8 +To: binutils at sources dot redhat dot com
     1.9 +Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
    1.10 +Message-ID: <20040821011342.GA30319@nevyn.them.org>
    1.11 +Mail-Followup-To: binutils at sources dot redhat dot com
    1.12 +References: <20040818145518.GA9774@nevyn.them.org> <20040819055040.GA11820@lucon.org> <20040819080034.GE21716@bubble.modra.org> <20040820173240.GA17678@nevyn.them.org> <20040821003737.GB16016@bubble.modra.org>
    1.13 +In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
    1.14 +
    1.15 +On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
    1.16 +> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
    1.17 +> > Thanks.  How's this?
    1.18 +> 
    1.19 +> As you might have guessed from my rather slack review of your previous
    1.20 +> patch, I trust you enough to give the OK without proper review.  But
    1.21 +> since you asked...  :)
    1.22 +
    1.23 +Checked in as so.
    1.24 +
    1.25 +-- 
    1.26 +Daniel Jacobowitz
    1.27 +
    1.28 +[ rediffed against binutils-2.15.91.0.2, with some elbow grease ]
    1.29 +
    1.30 +2004-08-20  Daniel Jacobowitz  <dan@debian.org>
    1.31 +
    1.32 +	* elflink.c (_bfd_elf_section_already_linked): Handle
    1.33 +	SEC_LINK_DUPLICATES_SAME_CONTENTS.
    1.34 +--- binutils-2.15.91.0.2/bfd/elflink.c.old	2004-07-27 21:36:08.000000000 -0700
    1.35 ++++ binutils-2.15.91.0.2/bfd/elflink.c	2004-08-26 06:38:07.000000000 -0700
    1.36 +@@ -9359,6 +9359,35 @@
    1.37 + 		  (_("%s: %s: warning: duplicate section `%s' has different size\n"),
    1.38 + 		   bfd_archive_filename (abfd), name);
    1.39 + 	      break;
    1.40 ++	    case SEC_LINK_DUPLICATES_SAME_CONTENTS:
    1.41 ++	      if (sec->size != l->sec->size)
    1.42 ++		(*_bfd_error_handler)
    1.43 ++		  (_("%B: duplicate section `%A' has different size\n"),
    1.44 ++		   bfd_archive_filename (abfd), sec);
    1.45 ++	      else if (sec->size != 0)
    1.46 ++		{
    1.47 ++		  bfd_byte *sec_contents, *l_sec_contents;
    1.48 ++
    1.49 ++		  if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
    1.50 ++		    (*_bfd_error_handler)
    1.51 ++		      (_("%B: warning: could not read contents of section `%A'\n"),
    1.52 ++		       bfd_archive_filename (abfd), sec);
    1.53 ++		  else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
    1.54 ++							&l_sec_contents))
    1.55 ++		    (*_bfd_error_handler)
    1.56 ++		      (_("%B: warning: could not read contents of section `%A'\n"),
    1.57 ++		       bfd_archive_filename(l->sec->owner), l->sec);
    1.58 ++		  else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
    1.59 ++		    (*_bfd_error_handler)
    1.60 ++		      (_("%B: warning: duplicate section `%A' has different contents\n"),
    1.61 ++		       bfd_archive_filename (abfd), sec);
    1.62 ++
    1.63 ++		  if (sec_contents)
    1.64 ++		    free (sec_contents);
    1.65 ++		  if (l_sec_contents)
    1.66 ++		    free (l_sec_contents);
    1.67 ++		}
    1.68 ++	      break;
    1.69 + 	    }
    1.70 + 
    1.71 + 	  /* Set the output_section field so that lang_add_section