[uClibc]Bug in uClibc PIC startup code for ARM

Thuys, Michiel michiel.thuys at intersil.com
Thu Jan 25 10:19:54 UTC 2001


Hi all,

I found a small bug in the uClibc PIC startup code for ARM
(sysdeps/linux/arm/crt0pic.S) which caused "argc" and "argv" to be corrupted
when entering "main". After argc, argv and envp are pulled from the stack and
stored in registers r0-r2, functions __libc_init and __init_stdio are called.
These functions overwrite r0-r2 which leads to a corrupted argc/argv for main.
To fix this, r0-r2 should be pulled of the stack after __libc_init and
__init_stdio are called.

I see the same happening in crt0.S so I expect the same behavior for non PIC
code.

I have attached a patchfile for crt0pic.S to correct this "feature" ;)

Regards,

Michiel Thuys

-------------- next part --------------
A non-text attachment was scrubbed...
Name: crt0pic.patch
Type: application/octet-stream
Size: 486 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/uclibc/attachments/20010125/d6f39c29/attachment.obj 


More information about the uClibc mailing list