1 /* vi: set sw=4 ts=4: */
3 * Architecture specific code used by dl-startup.c
4 * Copyright (C) 2005 by Erik Andersen <andersen@codepoet.org>
10 " .type _start,@function\n"
12 " .set _start,_dl_start\n"
13 " .size _start,.-_start\n"
17 /* Get a pointer to the argv array. On many platforms this can be just
18 * the address if the first argument, on other platforms we need to
19 * do something a little more subtle here. */
20 #define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned int *) & ARGS)
22 /* Handle relocation of the symbols in the dynamic loader. */
24 void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
25 unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab)
27 switch (ELF32_R_TYPE(rpnt->r_info))
30 *(char *) reloc_addr = symbol_addr + rpnt->r_addend;
33 *(short *) reloc_addr = symbol_addr + rpnt->r_addend;
36 *reloc_addr = symbol_addr + rpnt->r_addend;
39 *(char *) reloc_addr = (symbol_addr + rpnt->r_addend
40 - (unsigned int) reloc_addr);
43 *(short *) reloc_addr = (symbol_addr + rpnt->r_addend
44 - (unsigned int) reloc_addr);
47 *reloc_addr = (symbol_addr + rpnt->r_addend
48 - (unsigned int) reloc_addr);
52 *reloc_addr = symbol_addr;
55 *reloc_addr = ((unsigned int) load_addr +
56 (rpnt->r_addend ? : *reloc_addr));
63 /* Transfer control to the user's application, once the dynamic loader is
64 * done. This routine has to exit the current function, then call the
65 * _dl_elf_main function. */
70 : : "a" (_dl_elf_main));