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"
12 " # Save the user entry point address in %edi.\n"
14 " # Point %ebx at the GOT.\n"
17 " addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx\n"
18 " # See if we were run as a command with the executable file\n"
19 " # name as an extra leading argument.\n"
20 " movl _dl_skip_args@GOTOFF(%ebx), %eax\n"
21 " # Pop the original argument count.\n"
23 " # Adjust the stack pointer to skip _dl_skip_args words.\n"
24 " leal (%esp,%eax,4), %esp\n"
25 " # Subtract _dl_skip_args from argc.\n"
27 " # Push argc back on the stack.\n"
29 " # Pass our FINI ptr() to the user in %edx, as per ELF ABI.\n"
30 " leal _dl_fini@GOTOFF(%ebx), %edx\n"
31 " # Jump to the user's entry point.\n"
33 " .size _start,.-_start\n"
37 /* Get a pointer to the argv array. On many platforms this can be just
38 * the address of the first argument, on other platforms we need to
39 * do something a little more subtle here. */
40 #define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) & ARGS)+1)
42 /* Handle relocation of the symbols in the dynamic loader. */
43 static __always_inline
44 void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
45 unsigned long symbol_addr, unsigned long load_addr, attribute_unused Elf32_Sym *symtab)
47 switch (ELF32_R_TYPE(rpnt->r_info))
50 *reloc_addr += symbol_addr;
53 *reloc_addr += symbol_addr - (unsigned long) reloc_addr;
57 *reloc_addr = symbol_addr;
60 *reloc_addr += load_addr;