Subject: Re: ld -x
To: Krister Walfridsson <cato@df.lth.se>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-toolchain
Date: 05/19/1998 01:38:33
> using the '-k' flag (i.e. as pic code), I get a error when doing
> ld -x -r
>
> a.o(.text+0x0): reloc refers to symbol `initialized' which is not
> being output
>
> I have no problem with our current ld, but if you look closer on the
> object file output by it, you will see that it has invented a new symbol:
>
> ulysses> nm a.o
> 00000000 T _init
> 00000008 d a.o._initialized
>
> [...]
> My suggestion is to remove the ld -x business in bsd.lib.mk, but I'm sure
> someone will tell me that's a stupid thing to do...
When using `-r' to produce relocatable code, you cannot just discard
all local symbols. The linker needs it again to fix up `base relative'
references in the GOT when producing the final shared library or even
a further `-r' pass. This is why the `-x' switch does not throw such
symbols out.
Renaming the symbol is not strictly necessary but it doesn't hurt either
and it's helpful for debugging, occasionally.
In any case, this is a deficiency in the binutils linker.
-pk