hppa glibc ld -r

H . J . Lu hjl@lucon.org
Thu, 17 Aug 2000 08:23:08 -0700


On Thu, Aug 17, 2000 at 05:59:48PM +1000, Alan Modra wrote:
> 
> -ffunction-sections isn't a complete solution though.  If two source files
> declare a local function of the same name, "setup", for instance, then
> both files will have a section called ".text.setup".  These two sections
> will be merged during the "ld -r", which has the unfortunate effect of

Can you teach ld not to merge ".text.xxxxx" with -r under HPPA?

> moving a local function to a location a long way off from where it's
> called.  That's bad, firstly because it means we now need a stub to reach
> the function, but more importantly the stubs are not PIC and thus need
> relocation information when creating shared libraries.  In particular, for
> reasons too complicated to explain here, I don't want to create stubs for
> local functions;  It would mean emitting relocs for every *potential*
> stub.
> 
> Anybody know why glibc uses "ld -r", and if there is a good reason why
> we can't just remove the "ld -r"?

I don't think it has to be used. --whole-archive will do the same
trick. But "ld -r" is more convenient. With --whole-archive, you may
have to put -Wl,--whole-archive/-Wl,--no-whole-archive around each file
generarted with "ld -r"


H.J.