dl-startup.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Any assmbly language/system dependent hacks needed to setup boot1.c so it
  2. * will work as expected and cope with whatever platform specific wierdness is
  3. * needed for this architecture. */
  4. __asm__(
  5. " .text\n"
  6. " .globl _start\n"
  7. " .type _start,@function\n"
  8. "_start:\n"
  9. " mov r15, r4\n"
  10. " mov.l .L_dl_start, r0\n"
  11. " bsrf r0\n"
  12. " add #4, r4\n"
  13. ".jmp_loc:\n"
  14. " jmp @r0\n"
  15. " mov #0, r4 !call _start with arg == 0\n"
  16. ".L_dl_start:\n"
  17. " .long _dl_start-.jmp_loc\n"
  18. " .size _start,.-_start\n"
  19. " .previous\n"
  20. );
  21. /*
  22. * Get a pointer to the argv array. On many platforms this can be just
  23. * the address if the first argument, on other platforms we need to
  24. * do something a little more subtle here.
  25. */
  26. #define GET_ARGV(ARGVP, ARGS) ARGVP = ((unsigned long*) ARGS)
  27. /* We can't call functions earlier in the dl startup process */
  28. #define NO_FUNCS_BEFORE_BOOTSTRAP
  29. /*
  30. * Here is a macro to perform a relocation. This is only used when
  31. * bootstrapping the dynamic loader. RELP is the relocation that we
  32. * are performing, REL is the pointer to the address we are relocating.
  33. * SYMBOL is the symbol involved in the relocation, and LOAD is the
  34. * load address.
  35. */
  36. #define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
  37. switch(ELF32_R_TYPE((RELP)->r_info)){ \
  38. case R_SH_REL32: \
  39. *(REL) = (SYMBOL) + (RELP)->r_addend \
  40. - (unsigned long)(REL); \
  41. break; \
  42. case R_SH_DIR32: \
  43. case R_SH_GLOB_DAT: \
  44. case R_SH_JMP_SLOT: \
  45. *(REL) = (SYMBOL) + (RELP)->r_addend; \
  46. break; \
  47. case R_SH_RELATIVE: \
  48. *(REL) = (LOAD) + (RELP)->r_addend; \
  49. break; \
  50. case R_SH_NONE: \
  51. break; \
  52. default: \
  53. _dl_exit(1); \
  54. }