OSDN Git Service

8c37ebf0d0e1ce1e5578a25e7599000b39606f35
[uclinux-h8/uClibc.git] / ldso / ldso / m68k / dl-startup.h
1 /*
2  * Architecture specific code used by dl-startup.c
3  */
4
5 /* For m68k we do not need any special setup so go right to _dl_boot() */
6 #define DL_BOOT(X) __attribute__ ((unused)) void _dl_boot (X)
7
8 /* Get a pointer to the argv array.  On many platforms this can be just
9  * the address if the first argument, on other platforms we need to
10  * do something a little more subtle here.  */
11 #define GET_ARGV(ARGVP, ARGS) ((ARGVP) = ((unsigned int *) &(ARGS)))
12
13
14 /* Handle relocation of the symbols in the dynamic loader. */
15 static inline
16 void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr,
17         unsigned long symbol_addr, unsigned long load_addr, Elf32_Sym *symtab)
18 {
19     switch (ELF32_R_TYPE(rpnt->r_info))
20     {
21         case R_68K_8:
22             *(char *) reloc_addr = symbol_addr + rpnt->r_addend;
23             break;
24         case R_68K_16:
25             *(short *) reloc_addr = symbol_addr + rpnt->r_addend;
26             break;
27         case R_68K_32:
28             *reloc_addr = symbol_addr + rpnt->r_addend;
29             break;
30         case R_68K_PC8:
31             *(char *) reloc_addr = (symbol_addr + rpnt->r_addend
32                     - (unsigned int) reloc_addr);
33             break;
34         case R_68K_PC16:
35             *(short *) reloc_addr = (symbol_addr + rpnt->r_addend
36                     - (unsigned int) reloc_addr);
37             break;
38         case R_68K_PC32:
39             *reloc_addr = (symbol_addr + rpnt->r_addend
40                     - (unsigned int) reloc_addr);
41             break;
42         case R_68K_GLOB_DAT:
43         case R_68K_JMP_SLOT:
44             *reloc_addr = symbol_addr;
45             break;
46         case R_68K_RELATIVE:
47             *reloc_addr = ((unsigned int) load_addr +
48                     (rpnt->r_addend ? : : *reloc_addr));
49             break;
50         default:
51             _dl_exit (1);
52     }
53 }
54
55
56 /* Transfer control to the user's application, once the dynamic loader is
57  * done.  This routine has to exit the current function, then call the
58  * _dl_elf_main function.  */
59 #define START()                                 \
60   __asm__ volatile ("unlk %%a6\n\t"             \
61                     "jmp %0@"                   \
62                     : : "a" (_dl_elf_main));
63
64
65