This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


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

Re: PATCH: Warning relocs against discarded functions


On Thu, Nov 01, 2001 at 03:23:49PM -0800, Geoff Keating wrote:
> > Date: Thu, 1 Nov 2001 14:28:35 -0800
> > From: "H . J . Lu" <hjl@lucon.org>
> > Cc: Daniel Jacobowitz <dan@debian.org>, gdb@sources.redhat.com,
> >         binutils@sourceware.cygnus.com
> 
> > On Thu, Nov 01, 2001 at 11:43:10PM +1100, Keith Owens wrote:
> > > The problem is worse than stabs.  If a function is marked __exit _and_
> > > some code in another section refers to that function then :-
> > > 
> > > * ld resolves the reference as offset xxx from the start of section
> > >   .text.exit which is expected to get a decent start address.
> > > * Section .text.exit is discarded, giving it a zero start address.
> 
> That's not right!  When a section is discarded, it goes away, it

I beliieve what Keith said was true for the current binutils. That is
ld sets references to symbols in discard sections to indexes in the
abs section. That is where location 0 comes from.

> doesn't go to location 0.  When a section is not in the final object,
> any non-weak relocations to it (that do make it to the final object)
> are an error, and should be reported as such ("undefined symbol" or
> similar).

I am not sure if I can turn a definition into weak undefined. It may be
too late at that stage. I will see what I can do.



H.J.


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