summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-05-25 23:54:50 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-05-25 23:54:50 +0000
commitdf77bb0e1a9a7531dd18a4e56e82cec6d85fb3f9 (patch)
tree40696f600912de5771a15bbb8d397859d9dc189d /ldso
parentfe4154e930920d612cf6499f3f3fd419d6e0fe37 (diff)
Prepare for standalone execution of ldso.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/i386/dl-startup.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/ldso/ldso/i386/dl-startup.h b/ldso/ldso/i386/dl-startup.h
index b0612b923..95609bbb3 100644
--- a/ldso/ldso/i386/dl-startup.h
+++ b/ldso/ldso/i386/dl-startup.h
@@ -16,6 +16,17 @@ asm(
" call 1f\n"
"1: popl %ebx\n"
" addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\n"
+ " # See if we were run as a command with the executable file\n"
+ " # name as an extra leading argument.\n"
+ " movl _dl_skip_args@GOTOFF(%ebx), %eax\n"
+ " # Pop the original argument count.\n"
+ " popl %edx\n"
+ " # Adjust the stack pointer to skip _dl_skip_args words.\n"
+ " leal (%esp,%eax,4), %esp\n"
+ " # Subtract _dl_skip_args from argc.\n"
+ " subl %eax, %edx\n"
+ " # Push argc back on the stack.\n"
+ " push %edx\n"
" # Pass our FINI ptr() to the user in %edx, as per ELF ABI.\n"
" leal _dl_fini@GOTOFF(%ebx), %edx\n"
" # Jump to the user's entry point.\n"