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, LD]Fix GDB crash caused by discarding the grouped debug sections


> -----Original Message-----
> From: Alan Modra [mailto:amodra@gmail.com]
> Sent: Sunday, January 04, 2015 5:08 PM
> To: Terry Guo
> Cc: binutils@sourceware.org
> Subject: Re: [Patch, LD]Fix GDB crash caused by discarding the grouped
> debug sections
> 
> On Sun, Jan 04, 2015 at 11:07:32AM +0800, Terry Guo wrote:
> > +asection *
> > +_bfd_elf_gc_mark_debug_special_section_group (asection *grp)
> 
> Why not make this function static?
> 
> > +	  /* Scan section group to either keep all included sections or
> > +	     none of them.  By setting iterator isec to the last member of
> > +	     grouped sections, let the outer for loop skip those scanned
> > +	     sections.  */
> 
> I don't think you can count on all sections of a group being together, so
you
> can't skip over group sections.
> 
> > +	  if ((isec->flags & SEC_GROUP) != 0)
> > +	    isec = _bfd_elf_gc_mark_debug_special_section_group (isec);
> 
> So the assignment above isn't valid, and you'll need to keep the
> elf_next_in_group (isec) == NULL test below.
> 
> > +	  else if ((isec->flags & SEC_DEBUGGING) != 0
> > +		   || (isec->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) ==
> 0)
> > +	    isec->gc_mark = 1;
> 
> --
> Alan Modra
> Australia Development Lab, IBM

Thanks Alan. I updated the patch per your suggestion. Is this one OK?

BR,
Terry

2015-01-07  Terry Guo  <terry.guo@arm.com>

	* elflink.c (_bfd_elf_gc_mark_debug_special_section_group): New
function.
	(_bfd_elf_gc_mark_extra_sections): Also keep debug or special
section group.

Attachment: ld-keeps-all-debug-section-v4.txt
Description: Text document


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