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] New option --print-gc-sections


On Wed, Apr 05, 2006 at 05:38:16PM +0200, Eric Botcazou wrote:
> > > +  if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0)
> > > +    return;
> > > +
> > > +  size = bfd_get_section_size (section);
> > > +  if (pc >= size)
> > > +    return;
> > > +
> > > +  found = bfd_find_nearest_line (abfd, section, syms, pc,
> > > +				 &filename, &functionname, &line);
> > > +}
> >
> > It would be better to check that pc is not less than section vma, then
> > use "off = pc - vma" for size check and bfd_find_nearest_line.  That way
> > --section lets you specify a section relative offset in an executable.
> 
> That's precisely what find_address_in_section does, isn't it?  Here 'pc' is 
> already an offset.

I'm thinking of "addr2line -e some_exe -j .data 0 4 8 12 16".
.data might start at 0x123456789abcdef0 and the user wants to minimize
typing.  ie. make --section work on both executables and relocatable
object files.

> > > @@ -276,12 +314,12 @@ process_file (const char *file_name, con
> > >    bfd_close (abfd);
> > >  }
> > >  
> > > -int main (int, char **);
> >
> > Don't delete this.  I believe it is there to quash warnings generated by
> > some versions of gcc.
> 
> Note that objdump.c doesn't have it.

Hmm, well then deleting the prototype is probably OK.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


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