summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2005-07-08 02:01:24 +0000
committerMike Frysinger <vapier@gentoo.org>2005-07-08 02:01:24 +0000
commit1d2e9585b44e527233dc0c87601a4bf196f12997 (patch)
treecb446e3d6f06f3fc192161f01c33ab0e4745301c
parentefed1986bc3df644fbd7b265786929dc24c42dd6 (diff)
fix GET_ARGV() so it pulls out the argc/argv/envp properly
-rw-r--r--ldso/ldso/x86_64/dl-startup.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/ldso/ldso/x86_64/dl-startup.h b/ldso/ldso/x86_64/dl-startup.h
index 1b83e5d91..468fd4703 100644
--- a/ldso/ldso/x86_64/dl-startup.h
+++ b/ldso/ldso/x86_64/dl-startup.h
@@ -1,7 +1,10 @@
/* vi: set sw=4 ts=4: */
/*
* Architecture specific code used by dl-startup.c
- * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2000-2005 by Erik Andersen <andersen@codepoet.org>
+ * Copyright (C) 2005 by Mike Frysinger <vapier@gentoo.org>
+ *
+ * Parts taken from glibc/sysdeps/x86_64/dl-machine.h
*/
asm(
" .text\n"
@@ -24,6 +27,8 @@ asm(
" subl %eax, %edx\n"
" # Push argc back on the stack.\n"
" pushq %rdx\n"
+ " # argc -> rsi\n"
+ " movq %rdx, %rsi\n"
" # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n"
" leaq _dl_fini(%rip), %rdx\n"
" # And make sure %rsp points to argc stored on the stack.\n"
@@ -37,7 +42,7 @@ asm(
/* 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. */
-#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1)
+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1)
/* Handle relocation of the symbols in the dynamic loader. */
static __always_inline