Set small data pointer on PowerPC
Joakim Tjernlund
joakim.tjernlund at transmode.se
Mon Mar 19 17:19:47 UTC 2007
On Sun, 2007-03-18 at 17:48 +0000, Joseph S. Myers wrote:
> On PowerPC, r13 is used for a small data pointer and needs to be set up
> from _SDA_BASE_ (defined by the linker) at startup.
>
> This is needed for the GCC testcase gcc.target/powerpc/980827-1.c to work.
> This patch fixes that testcase (verified for both static and dynamic
> linking).
I have been thinking about this myself on and off, but since nobody has
complained until now I didn't do anything about it.
Curious, do you use SDA for any real work or do you know of
any such use?
Jocke
>
> Index: libc/sysdeps/linux/powerpc/crt1.S
> ===================================================================
> --- libc/sysdeps/linux/powerpc/crt1.S (revision 18137)
> +++ libc/sysdeps/linux/powerpc/crt1.S (working copy)
> @@ -58,6 +58,13 @@
> mflr r31
> # endif
> #endif
> + /* Set up the small data pointer in r13. */
> +#ifdef __PIC__
> + lwz r13,_SDA_BASE_ at got(r31)
> +#else
> + lis r13,_SDA_BASE_ at ha
> + addi r13,r13,_SDA_BASE_ at l
> +#endif
> /* Set up an initial stack frame, and clear the LR. */
> li r0,0
> stwu r1,-16(r1)
>
More information about the uClibc
mailing list