patches/binutils/2.15.90.0.3/binutils-20040820-duplicates.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
yann@1
     1
See http://sources.redhat.com/ml/binutils/2004-08/msg00256.html
yann@1
     2
yann@1
     3
Date: Fri, 20 Aug 2004 21:13:43 -0400
yann@1
     4
From: Daniel Jacobowitz <drow at false dot org>
yann@1
     5
To: binutils at sources dot redhat dot com
yann@1
     6
Subject: Re: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
yann@1
     7
Message-ID: <20040821011342.GA30319@nevyn.them.org>
yann@1
     8
Mail-Followup-To: binutils at sources dot redhat dot com
yann@1
     9
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>
yann@1
    10
In-Reply-To: <20040821003737 dot GB16016 at bubble dot modra dot org>
yann@1
    11
yann@1
    12
On Sat, Aug 21, 2004 at 10:07:38AM +0930, Alan Modra wrote:
yann@1
    13
> On Fri, Aug 20, 2004 at 01:32:40PM -0400, Daniel Jacobowitz wrote:
yann@1
    14
> > Thanks.  How's this?
yann@1
    15
> 
yann@1
    16
> As you might have guessed from my rather slack review of your previous
yann@1
    17
> patch, I trust you enough to give the OK without proper review.  But
yann@1
    18
> since you asked...  :)
yann@1
    19
yann@1
    20
Checked in as so.
yann@1
    21
yann@1
    22
-- 
yann@1
    23
Daniel Jacobowitz
yann@1
    24
yann@1
    25
2004-08-20  Daniel Jacobowitz  <dan@debian.org>
yann@1
    26
yann@1
    27
	* elflink.c (_bfd_elf_section_already_linked): Handle
yann@1
    28
	SEC_LINK_DUPLICATES_SAME_CONTENTS.
yann@1
    29
yann@1
    30
Index: elflink.c
yann@1
    31
===================================================================
yann@1
    32
RCS file: /big/fsf/rsync/src-cvs/src/bfd/elflink.c,v
yann@1
    33
retrieving revision 1.97
yann@1
    34
diff -u -p -r1.97 elflink.c
yann@1
    35
--- binutils/bfd/elflink.c	18 Aug 2004 02:45:42 -0000	1.97
yann@1
    36
+++ binutils/bfd/elflink.c	21 Aug 2004 00:59:08 -0000
yann@1
    37
@@ -9366,6 +9366,36 @@ _bfd_elf_section_already_linked (bfd *ab
yann@1
    38
 		  (_("%B: duplicate section `%A' has different size\n"),
yann@1
    39
 		   abfd, sec);
yann@1
    40
 	      break;
yann@1
    41
+
yann@1
    42
+	    case SEC_LINK_DUPLICATES_SAME_CONTENTS:
yann@1
    43
+	      if (sec->size != l->sec->size)
yann@1
    44
+		(*_bfd_error_handler)
yann@1
    45
+		  (_("%B: duplicate section `%A' has different size\n"),
yann@1
    46
+		   abfd, sec);
yann@1
    47
+	      else if (sec->size != 0)
yann@1
    48
+		{
yann@1
    49
+		  bfd_byte *sec_contents, *l_sec_contents;
yann@1
    50
+
yann@1
    51
+		  if (!bfd_malloc_and_get_section (abfd, sec, &sec_contents))
yann@1
    52
+		    (*_bfd_error_handler)
yann@1
    53
+		      (_("%B: warning: could not read contents of section `%A'\n"),
yann@1
    54
+		       abfd, sec);
yann@1
    55
+		  else if (!bfd_malloc_and_get_section (l->sec->owner, l->sec,
yann@1
    56
+							&l_sec_contents))
yann@1
    57
+		    (*_bfd_error_handler)
yann@1
    58
+		      (_("%B: warning: could not read contents of section `%A'\n"),
yann@1
    59
+		       l->sec->owner, l->sec);
yann@1
    60
+		  else if (memcmp (sec_contents, l_sec_contents, sec->size) != 0)
yann@1
    61
+		    (*_bfd_error_handler)
yann@1
    62
+		      (_("%B: warning: duplicate section `%A' has different contents\n"),
yann@1
    63
+		       abfd, sec);
yann@1
    64
+
yann@1
    65
+		  if (sec_contents)
yann@1
    66
+		    free (sec_contents);
yann@1
    67
+		  if (l_sec_contents)
yann@1
    68
+		    free (l_sec_contents);
yann@1
    69
+		}
yann@1
    70
+	      break;
yann@1
    71
 	    }
yann@1
    72
 
yann@1
    73
 	  /* Set the output_section field so that lang_add_section
yann@1
    74