2.9.5.0.10 ld dumps core when /DISCARD/ is used

Ian Lance Taylor ian@zembu.com
Fri Sep 3 11:26:00 GMT 1999


   Date: Fri, 3 Sep 1999 11:11:39 -0700 (PDT)
   From: hjl@lucon.org (H.J. Lu)

   I can verify the bug with today's cvs. Here is the patch.

Thanks.  I wonder why I didn't see the problem.

Please try the appended patch instead.  That tests the actual
characteristic we are interested in, rather than testing something
else and potentially covering up a different bug.

Incidentally, Mark, that code ought to be checking that the input file
is an ELF file before it calls elf_section_data.

Ian

Index: elflink.h
===================================================================
RCS file: /cvs/binutils/binutils/bfd/elflink.h,v
retrieving revision 1.27
diff -u -p -r1.27 elflink.h
--- elflink.h	1999/08/31 14:07:27	1.27
+++ elflink.h	1999/09/03 18:24:03
@@ -4036,7 +4036,12 @@ elf_bfd_final_link (abfd, info)
     for (sub = info->input_bfds; sub != NULL; sub = sub->link_next)
       for (o = sub->sections; o != NULL; o = o->next)
 	{
-	  asection* output_section = o->output_section;
+	  asection* output_section;
+
+	  if (! o->linker_mark)
+	    continue;
+
+	  output_section = o->output_section;
 
 	  if (output_section && (o->flags & SEC_RELOC) != 0)
 	    {


More information about the Binutils mailing list