summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-04-03 19:16:55 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-04-03 19:16:55 +0000
commit447c0b15721de43c8e4b3e5a415915b2867e33e3 (patch)
tree9dddd5b5590966ae499c41e50de4adfea0172e93 /ldso
parent8ae1e1d1cc6b337853332fd7ffd968f44745a6d1 (diff)
Prepare PowerPC some more for standalone exection of ldso.
Note that every arch that wants to support standalone execution needs to align its stack pointer in crtX since ldso will adjust the stack pointer when adjusting argc and argv in standalone 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 */