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: debug_info strangeness (arm-mingw32ce)


On Thu, 2009-12-03 at 09:19 +1030, Alan Modra wrote:
> On Wed, Dec 02, 2009 at 08:04:06PM +0100, Danny Backx wrote:
> > Anyway : in _bfd_coff_final_link (bfd/cofflink.c) around line 900 in
> > current binutils head, this code is present :
> > 
> >   for (o = abfd->sections; o != NULL; o = o->next)
> >     {
> >       for (p = o->map_head.link_order; p != NULL; p = p->next)
> >         {
> >           if (p->type == bfd_indirect_link_order
> >               && bfd_family_coff (p->u.indirect.section->owner))
> >             {
> >               sub = p->u.indirect.section->owner;
> >               if (! bfd_coff_link_output_has_begun (sub, & finfo))
> >                 {
> >                   if (! _bfd_coff_link_input_bfd (&finfo, sub))
> >                     goto error_return;
> >                   sub->output_has_begun = TRUE;
> >                 }
> > 
> > Not being a binutils expert, this code is not easy for me to understand.
> > 
> > What appears to happen is that _bfd_coff_link_input_bfd is not called
> > for the .debug_info section of crt3.o, because
> > bfd_coff_link_output_has_begun evaluates to false.
> 
> _bfd_coff_link_input_bfd is supposed to be called just once for each
> input file, and handles all the sections in the file.  So your crt3.o
> .debug_info section should have been processed when the above loop was
> looking at earlier output sections, most likely .text.

Then it looks like the check (see above) should not be
        if (! bfd_coff_link_output_has_begun (sub, & finfo))
but simply
	if (! sub->output_has_begun)

This change makes my simple test magically work :-)

But I wonder about this (in coff-arm.c) :
/* This piece of machinery exists only to guarantee that the bfd that
holds
   the glue section is written last.
        
   This does depend on bfd_make_section attaching a new section to the
   end of the section list for the bfd.  */
  
static bfd_boolean
coff_arm_link_output_has_begun (bfd * sub, struct coff_final_link_info *
info)
{     
  return (sub->output_has_begun
          || sub == coff_arm_hash_table
(info->info)->bfd_of_glue_owner);
}         

I don't understand what it means.

	Danny



-- 
Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info


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