[uClibc]PowerPC crt0 problems
David Schleef
ds at schleef.org
Sat May 26 02:01:50 UTC 2001
On Tue, May 15, 2001 at 12:41:24PM +0300, Michael Shmulevich wrote:
> Hello all,
>
> I investigated futher a PowerPC problem and figured out that the crt0
> initializer (curently present in CVS) works only in static compilation
> code, but useless for dynamic linker, and vice versa the crt0 for
> dynamic executable (taken from glibc) doesn't suit the static programs.
Ok, I think I figured out what was going on. In the static case,
the kernel calls _start with the stack pointer pointing to
--> argc
argv[0]
argv[1]
..
null
envp[0]
envp[1]
..
null
This is the "standard" Linux way of calling an application. When
the dynamic linker calls _start, it calls with the stack pointer
set to &argc-0x10, which conveniently points to 0. (There is
a good reason why this memory location should always be 0, since
it's part of the null stack frame that indicates the end of the
stack.) So, I changed crt0.c to look at argc, and if it is 0,
increment the pointer by 16 bytes, to where argc really is. It
seems to work now.
I made some irrelevant changes to the asm code in crt0.c; I
may remove those.
I have busybox running relatively ok both dynamically and statically.
There are still a few issues related to the TIOC ioctls, though.
dave...
More information about the uClibc
mailing list