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

Alan Modra amodra@bigpond.net.au
Thu Oct 12 14:37:00 GMT 2006


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



More information about the Binutils mailing list