This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: empty relocation tables


Nathan Sidwell <nathan@codesourcery.com> writes:

> this patch fixes a problem encountered by a WindRiver customer. A section
> with no relocations caused a segfault. Fixed thusly. Ok?

I don't see how this patch could possibly be correct.

It also doesn't match the ChangeLog entry, so I suspect some mistake.

Ian

> 2002-11-19  Nathan Sidwell  <nathan@codesourcery.com>
> 
> 	* elflink.h (elf_link_output_relocs): Do nothing if input section
> 	size is zero.
> 
> Index: elflink.h
> ===================================================================
> RCS file: /cvs/src/src/bfd/elflink.h,v
> retrieving revision 1.193
> diff -c -3 -p -r1.193 elflink.h
> *** elflink.h	4 Nov 2002 13:20:56 -0000	1.193
> --- elflink.h	19 Nov 2002 15:07:48 -0000
> *************** elf_bfd_final_link (abfd, info)
> *** 5063,5068 ****
> --- 5063,5074 ----
>   		  if ((sec->flags & SEC_RELOC) != 0)
>   		    {
>   		      size_t ext_size;
> +   if (!input_rel_hdr->sh_size)
> +    /* There are no relocations. We can't let this just fall through
> +       though, as INTERNAL_RELOCS could be zero, and we fail to set
> +       OUTPUT_REL_HDR too.  */
> +    return;
> + 
>   
>   		      ext_size = elf_section_data (sec)->rel_hdr.sh_size;
>   		      if (ext_size > max_external_reloc_size)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]