This is the mail archive of the binutils@sourceware.cygnus.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]

Re: 2.9.5.0.10 ld dumps core when /DISCARD/ is used


> 
>    Date: Fri, 03 Sep 1999 09:29:41 -0700
>    From: Zack Weinberg <zack@bitmover.com>
> 
>    I am using H.J.'s 2.9.5.0.10 binutils package.  Using /DISCARD/ in a
>    ld script causes the linker to dump core when invoked.
> 
> Thanks for the bug report and test case.  Unfortunately, I can not
> recreate it with the current development sources.  Perhaps the bug,
> whatever it is, has been fixed.
> 

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


-- 
H.J. Lu (hjl@gnu.org)
---
Fri Sep  3 11:09:24 1999  H.J. Lu  <hjl@gnu.org>

	* elflink.h (elf_bfd_final_link): Check the discarded sections.

Index: elflink.h
===================================================================
RCS file: /work/cvs/gnu/binutils/bfd/elflink.h,v
retrieving revision 1.9
diff -u -p -r1.9 elflink.h
--- elflink.h	1999/08/31 17:17:49	1.9
+++ elflink.h	1999/09/03 18:08:16
@@ -4047,6 +4065,12 @@ elf_bfd_final_link (abfd, info)
 	      unsigned int *rel_count;
 	      unsigned int *rel_count2;
 
+	      /* A section may be discarded by a linker script. In that
+	         case, output_section is set to bfd_abs_section_ptr. We
+		 need to check it here. */
+	      if (!esdo)
+	        continue;
+
 	      /* We must be careful to add the relocation froms the
 		 input section to the right output count.  */
 	      if (esdi->rel_hdr.sh_entsize == esdo->rel_hdr.sh_entsize)

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