summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/ldso.c3
-rw-r--r--ldso/ldso/powerpc/dl-startup.h6
2 files changed, 9 insertions, 0 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index f68f703ec..80dcf2593 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -59,6 +59,9 @@ char *_dl_debug_bindings = 0;
int _dl_debug_file = 2;
#endif
+/* Needed for standalone execution. */
+unsigned long attribute_hidden _dl_skip_args = 0;
+
#include "dl-startup.c"
/* Forward function declarations */
static int _dl_suid_ok(void);
diff --git a/ldso/ldso/powerpc/dl-startup.h b/ldso/ldso/powerpc/dl-startup.h
index d86dd13c7..6fdf74301 100644
--- a/ldso/ldso/powerpc/dl-startup.h
+++ b/ldso/ldso/powerpc/dl-startup.h
@@ -19,6 +19,12 @@ asm(
" bl _GLOBAL_OFFSET_TABLE_-4@local\n" /* Put our GOT pointer in r31, */
" mflr 31\n"
" addi 1,1,16\n" /* Restore SP */
+ " lwz 7,_dl_skip_args@got(31)\n" /* load EA of _dl_skip_args */
+ " lwz 7,0(7)\n" /* Load word from _dl_skip_args */
+ " lwz 8,0(1)\n" /* Load argc from stack */
+ " subf 8,7,8\n" /* Subtract _dl_skip_args from argc. */
+ " slwi 7,7,2\n" /* Multiply by 4 */
+ " stwux 8,1,7\n" /* Adjust the stack pointer to skip _dl_skip_args words and store adjusted argc on stack. */
#if 0
/* Try beeing SVR4 ABI compliant?, even though it is not needed for uClibc on Linux */
/* argc */