Linker Bug or Design Intent (Absolute symbols in zero sized sections)

Jakub Jelinek jakub@redhat.com
Tue Oct 10 16:41:00 GMT 2006


On Thu, Sep 28, 2006 at 09:52:51AM -0700, H. J. Lu wrote:
> On Thu, Sep 28, 2006 at 05:42:29PM +0100, Paul Brook wrote:
> > On Wednesday 27 September 2006 00:28, Alan Modra wrote:
> > > On Tue, Sep 26, 2006 at 12:52:11PM -0400, Paul Koning wrote:
> > > > >>>>> "H" == H J Lu <hjl@lucon.org> writes:
> > > >
> > > >  H> Convert section relative symbol to absolute shouldn't be a problem
> > > >  H> in most cases. If we know it may be a problem at link time, we can
> > > >  H> keep it section relative.
> > > >
> > > > But what benefit is there in converting symbols from relative to
> > > > absolute?  It seems more logical to leave them alone, always.
> > >
> > > We are talking about the case where the section defining the symbol
> > > is removed from the output.
> > 
> > If we remove the section shouldn't we also remove the symbol?
> 
> I have checked in a patch not to remove an empty section if there is
> a symbol relative to it.

This has an ugly drawback that now almost every executable has
  [15] .preinit_array    PREINIT_ARRAY   0000000010010a94 010a94 000000 00 WA  0   0  1
  [16] .init_array       INIT_ARRAY      0000000010010a94 010a94 000000 00 WA  0   0  1
  [17] .fini_array       FINI_ARRAY      0000000010010a94 010a94 000000 00 WA  0   0  1
Can't we at least come up with PROVIDES/PROVIDES_HIDDEN variants that would
allow these symbols turned into absolute and/or to absolute 0 if the
section is empty and not output such empty sections and use that in the
builtin linker script?

It is nice kernel can now do its dirty hacks, but the userland shouldn't
suffer because of that.

	Jakub



More information about the Binutils mailing list