This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
- From: Daniel Jacobowitz <drow at false dot org>
- To: binutils at sources dot redhat dot com
- Date: Wed, 18 Aug 2004 10:55:19 -0400
- Subject: Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
The ARM linker uses SEC_LINK_DUPLICATES_SAME_CONTENTS for some note sections
(probably more of them than it really ought to, but...). This isn't handled
properly by one of HJ's COMDAT support patches, which just aborted in this
case.
OK?
--
Daniel Jacobowitz
2004-08-18 Daniel Jacobowitz <dan@debian.org>
* elflink.c (_bfd_elf_section_already_linked): Handle
SEC_LINK_DUPLICATES_SAME_CONTENTS.
Index: bfd/elflink.c
===================================================================
RCS file: /big/fsf/rsync/src-cvs/src/bfd/elflink.c,v
retrieving revision 1.93
diff -u -p -r1.93 elflink.c
--- bfd/elflink.c 9 Aug 2004 06:02:03 -0000 1.93
+++ bfd/elflink.c 11 Aug 2004 22:55:52 -0000
@@ -9397,6 +9397,35 @@ _bfd_elf_section_already_linked (bfd *ab
(_("%s: %s: warning: duplicate section `%s' has different size\n"),
bfd_archive_filename (abfd), name);
break;
+
+ case SEC_LINK_DUPLICATES_SAME_CONTENTS:
+ if (sec->size != l->sec->size)
+ (*_bfd_error_handler)
+ (_("%s: %s: warning: duplicate section `%s' has different size\n"),
+ bfd_archive_filename (abfd), name);
+ else
+ {
+ char *sec_contents, *l_sec_contents;
+ sec_contents = bfd_malloc (sec->size);
+ l_sec_contents = bfd_malloc (sec->size);
+ /* No way to report failure here... */
+ if (sec_contents && l_sec_contents
+ && bfd_get_section_contents (abfd, sec, sec_contents,
+ 0, sec->size)
+ && bfd_get_section_contents (l->sec->owner, l->sec,
+ l_sec_contents,
+ 0, l->sec->size)
+ && memcmp (sec_contents, l_sec_contents,
+ sec->size) != 0)
+ (*_bfd_error_handler)
+ (_("%s: %s: warning: duplicate section `%s' has different contents\n"),
+ bfd_archive_filename (abfd), name);
+ if (sec_contents)
+ free (sec_contents);
+ if (l_sec_contents)
+ free (l_sec_contents);
+ }
+ break;
}
/* Set the output_section field so that lang_add_section