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]

empty relocation tables


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

nathan
--
Dr Nathan Sidwell   ::   http://www.codesourcery.com   ::   CodeSourcery LLC
         'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org

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]