summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-20 23:18:28 +0000
committerJoakim Tjernlund <joakim.tjernlund@transmode.se>2005-03-20 23:18:28 +0000
commitf49539f93873f67d0efcacf49576590ab9c8d971 (patch)
treefb3042c7e83da3476e3d4fde5f93cffab1da63f9 /ldso
parentffd5ef60722c8a7295731cb6f7f54126fd07da3e (diff)
Prepare for moving ldso FINI handling to libc by passing _dl_fini. This should not break ABI.
Minor cleanup as well.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/i386/dl-startup.h23
1 files changed, 14 insertions, 9 deletions
diff --git a/ldso/ldso/i386/dl-startup.h b/ldso/ldso/i386/dl-startup.h
index 68a2a6563..b0612b923 100644
--- a/ldso/ldso/i386/dl-startup.h
+++ b/ldso/ldso/i386/dl-startup.h
@@ -3,13 +3,23 @@
* Architecture specific code used by dl-startup.c
* Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
*/
-
asm(
" .text\n"
+ " .align 16\n"
" .globl _start\n"
" .type _start,@function\n"
"_start:\n"
- " .set _start,_dl_start\n"
+ " call _dl_start\n"
+ " # Save the user entry point address in %edi.\n"
+ " movl %eax, %edi\n"
+ " # Point %ebx at the GOT.\n"
+ " call 1f\n"
+ "1: popl %ebx\n"
+ " addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\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"
+ " jmp *%edi\n"
" .size _start,.-_start\n"
" .previous\n"
);
@@ -17,7 +27,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)
+#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1)
/* Handle relocation of the symbols in the dynamic loader. */
static inline
@@ -47,9 +57,4 @@ void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
/* Transfer control to the user's application, once the dynamic loader is
* done. This routine has to exit the current function, then call the
* _dl_elf_main function. */
-#define START() { \
- int status = 0; \
- __asm__ volatile ("leave\n\t" \
- "jmp *%%eax\n\t" \
- : "=a" (status) : "a" (_dl_elf_main)); \
-}
+#define START() return _dl_elf_main