Bad ELF reloc generation fixed
Nick Clifton
nickc@cygnus.com
Thu Jul 27 15:39:00 GMT 2000
Hi Guys,
I have checked in the patch below to fix a problem with some of the
MIPS toolchains whereby they could generate bad reloc information
when performing an incremental link.
In fact what was happening was that these toolchains were generating
both .rel and .rela sections, but only the contents of the .rel
section are actually initialised. Fortuitously under Linux, the
other section's contents were set to zero, but under Solaris this
does not happen. All that the patch does is to make this zero
initialisation explicit.
Cheers
Nick
2000-07-27 Nick Clifton <nickc@cygnus.com>
* elflink.h (elf_link_size_reloc_section): Zero the section's
allocated contents.
Index: bfd/elflink.h
===================================================================
RCS file: /cvs/src//src/bfd/elflink.h,v
retrieving revision 1.67
diff -p -r1.67 elflink.h
*** elflink.h 2000/07/21 03:58:32 1.67
--- elflink.h 2000/07/27 22:34:37
*************** elf_link_size_reloc_section (abfd, rel_h
*** 4013,4020 ****
rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
/* The contents field must last into write_object_contents, so we
! allocate it with bfd_alloc rather than malloc. */
! rel_hdr->contents = (PTR) bfd_alloc (abfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return false;
--- 4013,4022 ----
rel_hdr->sh_size = rel_hdr->sh_entsize * reloc_count;
/* The contents field must last into write_object_contents, so we
! allocate it with bfd_alloc rather than malloc. Also since we
! cannot be sure that the contents will actually be filled in,
! we zero the allocated space. */
! rel_hdr->contents = (PTR) bfd_zalloc (abfd, rel_hdr->sh_size);
if (rel_hdr->contents == NULL && rel_hdr->sh_size != 0)
return false;
More information about the Binutils
mailing list