This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections)
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: "H. J. Lu" <hjl at lucon dot org>, Paul Brook <paul at codesourcery dot com>, binutils at sourceware dot org, Paul Koning <pkoning at equallogic dot com>, vgoyal at redhat dot com, drow at false dot org, binutils at sources dot redhat dot com
- Date: Thu, 12 Oct 2006 13:13:41 +0930
- Subject: Re: Linker Bug or Design Intent (Absolute symbols in zero sized sections)
- References: <4519350D.2090208@redhat.com> <17689.23227.571136.559871@gargle.gargle.HOWL> <20060926232851.GB1534@bubble.grove.modra.org> <200609281742.31472.paul@codesourcery.com> <20060928165251.GA20383@lucon.org> <20061010163423.GJ4556@sunsite.mff.cuni.cz> <20061010231922.GK4556@sunsite.mff.cuni.cz> <20061011035305.GA19554@bubble.grove.modra.org> <20061011071125.GL4556@sunsite.mff.cuni.cz>
On Wed, Oct 11, 2006 at 09:11:26AM +0200, Jakub Jelinek wrote:
> On Wed, Oct 11, 2006 at 01:23:05PM +0930, Alan Modra wrote:
> > On Wed, Oct 11, 2006 at 01:19:22AM +0200, Jakub Jelinek wrote:
> > > Either we could add here REMOVE_EMPTY flag, or, perhaps better, not consider
> > > at least symbol = absolute value assignments as section relative,
> >
> > Sections containing symbols really do need to stay, for --emit-relocs
> > and dynamic relocs. Or at least, we need to do something to make them
> > work properly.
>
> Dynamic relocs aren't an issue here
Well, yes, but they are a problem in other sections when building shared
libs. I'd like to see a general solution rather than a hack that only
works for some sections.
> Against emitting empty sections speaks both that it is a wasted space
> in section header table/.shstrtab, but more importantly that empty
> sections are an endless source of bugs
Agreed.
If we are to remove them, then
a) Detecting a symbol assignment in a linker script should result in the
section alignment and vma being honoured.
b) All the ELF backends will need changes so that removed output section
syms are never used when emitting relocs. At the same time, we may
as well just use one section sym for all relocs (or two for targets
that might want to relocate the data segment separately from the text
segment).
c) _bfd_fix_excluded_sec_syms should be changed to not create absolute
syms.
Comments?
--
Alan Modra
IBM OzLabs - Linux Technology Centre