1 /* vi: set sw=4 ts=4: */
3 * Architecture specific code used by dl-startup.c
4 * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
9 " .type _start,@function\n"
13 " # Save the user entry point address in %edi.\n"
15 " # Point %ebx at the GOT.\n"
18 " addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\n"
19 " # See if we were run as a command with the executable file\n"
20 " # name as an extra leading argument.\n"
21 " movl _dl_skip_args@GOTOFF(%ebx), %eax\n"
22 " # Pop the original argument count.\n"
24 " # Adjust the stack pointer to skip _dl_skip_args words.\n"
25 " leal (%esp,%eax,4), %esp\n"
26 " # Subtract _dl_skip_args from argc.\n"
28 " # Push argc back on the stack.\n"
30 " # Pass our FINI ptr() to the user in %edx, as per ELF ABI.\n"
31 " leal _dl_fini@GOTOFF(%ebx), %edx\n"
32 " # Jump to the user's entry point.\n"
34 " .size _start,.-_start\n"
38 /* Get a pointer to the argv array. On many platforms this can be just
39 * the address of the first argument, on other platforms we need to
40 * do something a little more subtle here. */
41 #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1)
43 /* Handle relocation of the symbols in the dynamic loader. */
44 static __always_inline
45 void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
46 unsigned long symbol_addr, unsigned long load_addr, attribute_unused Elf32_Sym *symtab)
48 switch (ELF_R_TYPE(rpnt->r_info))
51 *reloc_addr += symbol_addr;
54 *reloc_addr += symbol_addr - (unsigned long) reloc_addr;
58 *reloc_addr = symbol_addr;
61 *reloc_addr += load_addr;