Fix elflink crash with both rel and rela sections

Alan Modra amodra@gmail.com
Thu Sep 9 02:19:00 GMT 2010


On Thu, Sep 09, 2010 at 01:20:32AM +0200, Bernd Schmidt wrote:
> 	* elflink.c (bfd_elf_final_link): Correct calculation of
> 	max_external_reloc_size.

OK.

> Index: bfd/elflink.c
> ===================================================================
> --- bfd/elflink.c	(revision 297792)
> +++ bfd/elflink.c	(working copy)
> @@ -10190,6 +10190,9 @@ bfd_elf_final_link (bfd *abfd, struct bf
>  		      size_t ext_size;
>  
>  		      ext_size = elf_section_data (sec)->rel_hdr.sh_size;

While you're at it, you may as well tidy the above line to use esdi
too.

> +		      if (esdi->rel_hdr2 != NULL)
> +			ext_size += esdi->rel_hdr2->sh_size;
> +
>  		      if (ext_size > max_external_reloc_size)
>  			max_external_reloc_size = ext_size;
>  		      if (sec->reloc_count > max_internal_reloc_count)


-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list