From f49539f93873f67d0efcacf49576590ab9c8d971 Mon Sep 17 00:00:00 2001 From: Joakim Tjernlund Date: Sun, 20 Mar 2005 23:18:28 +0000 Subject: Prepare for moving ldso FINI handling to libc by passing _dl_fini. This should not break ABI. Minor cleanup as well. --- ldso/ldso/i386/dl-startup.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'ldso/ldso/i386') 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 */ - 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 -- cgit v1.2.3