[Patch, LD]Fix GDB crash caused by discarding the grouped debug sections
Terry Guo
terry.guo@arm.com
Wed Jan 7 09:59:00 GMT 2015
> -----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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ld-keeps-all-debug-section-v4.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20150107/86154684/attachment.txt>
More information about the Binutils
mailing list