This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: empty relocation tables
- From: Ian Lance Taylor <ian at airs dot com>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com
- Date: 19 Nov 2002 13:18:17 -0800
- Subject: Re: empty relocation tables
- References: <3DDA6B9C.10202@codesourcery.com>
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)