Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
H. J. Lu
hjl@lucon.org
Thu Aug 19 05:50:00 GMT 2004
More information about the Binutils mailing list
Thu Aug 19 05:50:00 GMT 2004
- Previous message (by thread): Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
- Next message (by thread): Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, Aug 18, 2004 at 10:55:19AM -0400, Daniel Jacobowitz wrote: > 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); So if one of those bfd_malloc/bfd_get_section_contents calls fails, it is a success. I am not sure if I like it. > + 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 Will this compile for mainline? Alan has removed bfd_archive_filename with his error_handler change. H.J.
- Previous message (by thread): Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
- Next message (by thread): Handle SEC_LINK_DUPLICATES_SAME_CONTENTS for arm-linux
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list