summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-startup.c
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-06-27 22:20:44 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-06-27 22:20:44 +0000
commit16045684fd1537372c6e1a25c88a99df0bfc9c5a (patch)
treec0dec3e75efd1b88e73b769ef5ca1b0b58d1b640 /ldso/ldso/dl-startup.c
parentb077887e4131946ddceaced9554a76615ec9d37d (diff)
Add __libc_stack_end to ld.so. The libc.a version remains to do.
sjhill, feel free to comment :)
Diffstat (limited to 'ldso/ldso/dl-startup.c')
-rw-r--r--ldso/ldso/dl-startup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ldso/ldso/dl-startup.c b/ldso/ldso/dl-startup.c
index 07fd189ce..6ff3dac11 100644
--- a/ldso/ldso/dl-startup.c
+++ b/ldso/ldso/dl-startup.c
@@ -97,8 +97,8 @@
/* Static declarations */
int (*_dl_elf_main) (int, char **, char **);
-
-
+static void* __rtld_stack_end; /* Points to argc on stack, e.g *((long *)__rtld_stackend) == argc */
+strong_alias(__rtld_stack_end, __libc_stack_end); /* Exported version of __rtld_stack_end */
/* When we enter this piece of code, the program stack looks like this:
argc argument counter (integer)
@@ -290,6 +290,11 @@ static void * __attribute_used__ _dl_start(unsigned long args)
free to start using global variables, since these things have all been
fixed up by now. Still no function calls outside of this library ,
since the dynamic resolver is not yet ready. */
+
+ __rtld_stack_end = (void *)args; /* Needs to be after ld.so self relocation */
+ if (*((long *)__rtld_stack_end) != argc) {
+ SEND_STDERR_DEBUG("__rtld_stack_end doesn't point to argc!");
+ }
_dl_get_ready_to_run(tpnt, load_addr, auxvt, envp, argv);