Don't understand startup code in ARM bFLT environment
tike64
tike64 at yahoo.com
Tue Aug 19 16:31:23 UTC 2008
Hi folks,
I don't understand what's wrong:
When I look at Linux code where it prepares to jump into user application, I see it putting argc into r0 (include/asm-arm/processor.h macro start_thread line 78):
regs->ARM_pc = pc & ~1; /* pc */ \
regs->ARM_sp = sp; /* sp */ \
regs->ARM_r2 = stack[2]; /* r2 (envp) */ \
regs->ARM_r1 = stack[1]; /* r1 (argv) */ \
==> regs->ARM_r0 = stack[0]; /* r0 (argc) */ \
nommu_start_thread(regs); \
Then uClibc seems to use the r0 as a pointer into some cleanup function (libc/sysdeps/linux/arm/crt1.S _start line 200):
/* Push stack limit */
str a3, [sp, #-4]!
/* Push rtld_fini */
=> str a1, [sp, #-4]!
#ifdef __PIC__
ldr sl, .L_GOT
In my system I see the behaviour one might expect from that: When my application does an exit, it crashes by jumping to address 1 (no arguments so argc is 1). If I understand correctly, the uClibc code expects shared linker in between Linux and uClibc application. But there never is one, when the application is bFLT format, right? Is it there even if the application is ELF but static? Am I missing something? Do I need to upgrade my head?
--
Timo
More information about the uClibc
mailing list