dl-startup.h 1.8 KB

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