[uClibc]Question on crt0.c for powerpc
David Schleef
ds at schleef.org
Fri May 17 19:14:42 UTC 2002
On Thu, May 16, 2002 at 09:40:21PM -0700, Huy Nguyen wrote:
> Hi,
>
> Anybody understand the hack below? The one follows the comment gross hack
> for dynamic linker.
> I'm using yesterday snapshot of uclibc to build for powerpc. Program that I
> link shared against uclibc has been getting random segfault depending on how
> many parameters the program is invoked with. I'm running on a 2.4.0 kernel.
> I'm suspecting that the assumption of where the arguments are stored on the
> stack is not correct. Any suggestion on where the problem might be?
It doesn't work. argc, argv, envp and the auxiliary data need
to be at a specific place on the stack directly above the
stack pointer, and the stack pointer needs to be 16-byte aligned.
Older kernels do not align the data correctly, so you either
get a mismatch between the stack pointer and the data, or an
unaligned stack pointer. Both tend to cause segfaults sooner
or later.
You can try to work around it, like glibc does, but that doesn't
work 100% of the time, as can be seen from the random segfaults
in user space programs on PowerPC machines and early 2.4 kernels.
dave...
More information about the uClibc
mailing list