This is the mail archive of the bfd@sourceware.cygnus.com mailing list for the bfd project.


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

Re: A patch for elf.c


   From: hjl@lucon.org (H.J. Lu)
   Date: Tue, 8 Dec 1998 09:57:19 -0800 (PST)

   > On Mon, 7 Dec 1998, H.J. Lu wrote:
   > 
   > > Could you please tell me on which platform you had this problem?
   > 
   > Alpha running Debian Linux.

   Thanks for this information. BTW, have you mentioned this in your first
   bug report? I think this patch fixes the bug. 

   Ian, this bug happens on ELF/Alpha when you strip more than one shared
   libraries at a time. It is not the first bfd_zalloc/bfd_alloc bug in
   bfd. It is quite annoying.

This bug was reported on bug-gnu-utils.  I believe I have already
fixed this problem with the appended patch.

We've disagreed before on whether memory should be cleared when it is
allocated, and I think we will continue to disagree.  This was a bug
introduced with a change to the function a few months ago.  The fix is
to avoid introducing bugs; clearing memory is just treating the
symptom.

Ian

Index: elf.c
===================================================================
RCS file: /cvs/cvsfiles/devo/bfd/elf.c,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -r1.222 -r1.223
--- elf.c	1998/11/18 04:26:38	1.222
+++ elf.c	1998/12/07 00:33:14	1.223
@@ -3444,6 +3444,8 @@
       m->includes_filehdr = (p->p_offset == 0
 			     && p->p_filesz >= iehdr->e_ehsize);
 
+      m->includes_phdrs = 0;
+
       if (! phdr_included || p->p_type != PT_LOAD)
 	{
 	  m->includes_phdrs =