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]

Symbols in SHT_NULL sections


I have some third party elf object files which contain section headers with 
type SHT_NULL, and define symbols within those sections.

It's not clear that these symbols have any meaningful interpretation, however 
they cause ld to crash. The attached patch fixes this by discarding these 
symbols.

Tested on i686-linux --enable-targets=all.
Ok?

Paul

2005-02-03  Paul Brook  <paul@codesourcery.com>

 * elflink.c (elf_link_input_bfd): Ignore symbols from null input
 sections.
Index: elflink.c
===================================================================
RCS file: /var/cvsroot/src-cvs/src/bfd/elflink.c,v
retrieving revision 1.126
diff -u -p -r1.126 elflink.c
--- elflink.c	1 Feb 2005 01:11:14 -0000	1.126
+++ elflink.c	3 Feb 2005 19:32:14 -0000
@@ -6757,8 +6757,8 @@ elf_link_input_bfd (struct elf_final_lin
 	 For the benefit of the MIPS ELF linker, we check SEC_EXCLUDE
 	 as well as linker_mark.  */
       if ((isym->st_shndx < SHN_LORESERVE || isym->st_shndx > SHN_HIRESERVE)
-	  && isec != NULL
-	  && ((! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
+	  && (isec == NULL
+	      || (! isec->linker_mark && (isec->flags & SEC_HAS_CONTENTS) != 0)
 	      || (! finfo->info->relocatable
 		  && (isec->flags & SEC_EXCLUDE) != 0)))
 	continue;

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