[parisc-linux] Re: c++ problem

Alan Modra alan@linuxcare.com.au
Wed, 21 Mar 2001 12:33:46 +1100 (EST)


On Wed, 21 Mar 2001, Alan Modra wrote:

> On Wed, 21 Mar 2001, Alan Modra wrote:
> 
> > I propose we set up dp in the dynamic linker to avoid this problem, as
> > it's quite legal to have a mix of static and dynamic libraries, each
> > needing to run constructors.
> 
> I think this is all we need.  Compiling it all to test it out...
> 
> --- glibc/sysdeps/hppa/dl-machine.h~	Mon Feb 19 14:05:42 2001
> +++ glibc/sysdeps/hppa/dl-machine.h	Wed Mar 21 10:45:50 2001
> @@ -338,6 +338,10 @@
>  	/* Save the entry point in %r3. */
>  	copy	%ret0,%r3
>  
> +	/* Set up dp for any static lib constructors that may be called. */
> +	addil	LT'$global$,%r19
> +	ldw	RT'$global$(%r1),%dp
> +
>  	/* Remember the lowest stack address. */
>  	addil	LT'__libc_stack_end,%r19
>  	ldw	RT'__libc_stack_end(%r1),%r20

Unfortunately, this fails because we pick up the value of $global$ in
ld.so.  Has anybody got a good idea on how to solve this?  One possibility
that occurs to me is that the dynamic linker could pull out DT_PLTGOT for
the application, but I'm not sure how to do that.

Alan
-- 
Linuxcare