This is the mail archive of the binutils@sourceware.org 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: [PATCH] linker regression fix


On Mon, Oct 24, 2005 at 10:31:32AM +0930, Alan Modra wrote:
> Hmm, I think HJ's patch ought to be rewritten as follows.  I've also
> fixed a segfault which will occur on symbols with unknown reserved
> section indices, by simply dropping such symbols.  Jan, please commit
> your new ld test.
> 
> 	* elflink.c (elf_link_input_bfd): Don't use linker_mark and
> 	SEC_EXCLUDE to test for sections dropped from output.  Instead,
> 	use bfd_section_removed_from_list on normal sections.  Don't
> 	attempt to handle symbols with unknown reserved section indices.

And we need the something similar for the generic linker.

	* linker.c (_bfd_generic_link_output_symbols): Don't use
	linker_mark to test for symbols belonging to dropped sections.
	Do allow absolute symbols.

Index: bfd/linker.c
===================================================================
RCS file: /cvs/src/src/bfd/linker.c,v
retrieving revision 1.50
diff -u -p -r1.50 linker.c
--- bfd/linker.c	4 Aug 2005 01:19:04 -0000	1.50
+++ bfd/linker.c	24 Oct 2005 11:19:49 -0000
@@ -2364,12 +2364,9 @@ _bfd_generic_link_output_symbols (bfd *o
 
       /* If this symbol is in a section which is not being included
 	 in the output file, then we don't want to output the
-	 symbol.  .bss and similar sections won't have the linker_mark
-	 field set.  We also check if its output section has been
-	 removed from the output file.  */
-      if (((sym->section->flags & SEC_HAS_CONTENTS) != 0
-	   && ! sym->section->linker_mark)
-	  || bfd_section_removed_from_list (output_bfd,
+	 symbol.  */
+      if (!bfd_is_abs_section (sym->section)
+	  && bfd_section_removed_from_list (output_bfd,
 					    sym->section->output_section))
 	output = FALSE;
 
-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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