[uClibc-cvs] svn commit: trunk/uClibc/ldso/ldso/arm
andersen at uclibc.org
andersen at uclibc.org
Fri Jun 10 20:06:12 UTC 2005
Author: andersen
Date: 2005-06-10 14:06:11 -0600 (Fri, 10 Jun 2005)
New Revision: 10504
Log:
Based in part on related code in glibc, this might even be correct.
Modified:
trunk/uClibc/ldso/ldso/arm/dl-startup.h
Changeset:
Modified: trunk/uClibc/ldso/ldso/arm/dl-startup.h
===================================================================
--- trunk/uClibc/ldso/ldso/arm/dl-startup.h 2005-06-10 18:25:35 UTC (rev 10503)
+++ trunk/uClibc/ldso/ldso/arm/dl-startup.h 2005-06-10 20:06:11 UTC (rev 10504)
@@ -8,18 +8,51 @@
" .text\n"
" .globl _start\n"
" .type _start,%function\n"
- "_start:\n"
- " mov r7, sp\n"
- " @ldr r0, [sp], #4\n"
- " mov r0, sp\n"
- " bl _dl_start\n"
- " mov r6, r0\n"
- " mov r0, r7\n"
- " mov pc, r6\n"
+ "_start:\n"
+ " @ at start time, all the args are on the stack\n"
+ " mov r0, sp\n"
+ " bl _dl_start\n"
+ " @ returns user entry point in r0\n"
+ " mov r6, r0\n"
+ " @ we are PIC code, so get global offset table\n"
+ " ldr sl, .L_GET_GOT\n"
+ " add sl, pc, sl\n"
+ ".L_GOT_GOT:\n"
+ " @ See if we were run as a command with the executable file\n"
+ " @ name as an extra leading argument.\n"
+ " ldr r4, .L_SKIP_ARGS\n"
+ " ldr r4, [sl, r4]\n"
+ " @ get the original arg count\n"
+ " ldr r1, [sp]\n"
+ " @ subtract _dl_skip_args from it\n"
+ " sub r1, r1, r4\n"
+ " @ adjust the stack pointer to skip them\n"
+ " add sp, sp, r4, lsl #2\n"
+ " @ get the argv address\n"
+ " add r2, sp, #4\n"
+ " @ store the new argc in the new stack location\n"
+ " str r1, [sp]\n"
+ " @ compute envp\n"
+ " add r3, r2, r1, lsl #2\n"
+ " add r3, r3, #4\n"
+ "\n\n"
+ " @ load the finalizer function\n"
+ " ldr r0, .L_FINI_PROC\n"
+ " ldr r0, [sl, r0]\n"
+ " @ jump to the user_s entry point\n"
+ " mov pc, r6\n"
+ ".L_GET_GOT:\n"
+ " .word _GLOBAL_OFFSET_TABLE_ - .L_GOT_GOT - 4\n"
+ ".L_SKIP_ARGS:\n"
+ " .word _dl_skip_args(GOTOFF)\n"
+ ".L_FINI_PROC:\n"
+ " .word _dl_fini(GOT)\n"
+ "\n\n"
" .size _start,.-_start\n"
- " .previous\n"
+ ".previous\n"
);
+
/* Get a pointer to the argv array. On many platforms this can be just
* the address if the first argument, on other platforms we need to
* do something a little more subtle here. */
More information about the uClibc-cvs
mailing list