ld_sysdep.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* Various assmbly language/system dependent hacks that are required
  2. so that we can minimize the amount of platform specific code. */
  3. /* Define this if the system uses RELOCA. */
  4. #define ELF_USES_RELOCA
  5. /* Get a pointer to the argv array. On many platforms this can be
  6. just the address if the first argument, on other platforms we need
  7. to do something a little more subtle here. */
  8. #define GET_ARGV(ARGVP, ARGS) ((ARGVP) = ((unsigned int *) &(ARGS)))
  9. /* Initialization sequence for a GOT. */
  10. #define INIT_GOT(GOT_BASE,MODULE) \
  11. { \
  12. GOT_BASE[2] = (int) _dl_linux_resolve; \
  13. GOT_BASE[1] = (int) (MODULE); \
  14. }
  15. /* Here is a macro to perform a relocation. This is only used when
  16. bootstrapping the dynamic loader. RELP is the relocation that we
  17. are performing, REL is the pointer to the address we are
  18. relocating. SYMBOL is the symbol involved in the relocation, and
  19. LOAD is the load address. */
  20. #define PERFORM_BOOTSTRAP_RELOC(RELP,REL,SYMBOL,LOAD,SYMTAB) \
  21. switch (ELF32_R_TYPE ((RELP)->r_info)) \
  22. { \
  23. case R_68K_8: \
  24. *(char *) (REL) = (SYMBOL) + (RELP)->r_addend; \
  25. break; \
  26. case R_68K_16: \
  27. *(short *) (REL) = (SYMBOL) + (RELP)->r_addend; \
  28. break; \
  29. case R_68K_32: \
  30. *(REL) = (SYMBOL) + (RELP)->r_addend; \
  31. break; \
  32. case R_68K_PC8: \
  33. *(char *) (REL) = ((SYMBOL) + (RELP)->r_addend \
  34. - (unsigned int) (REL)); \
  35. break; \
  36. case R_68K_PC16: \
  37. *(short *) (REL) = ((SYMBOL) + (RELP)->r_addend \
  38. - (unsigned int) (REL)); \
  39. break; \
  40. case R_68K_PC32: \
  41. *(REL) = ((SYMBOL) + (RELP)->r_addend \
  42. - (unsigned int) (REL)); \
  43. break; \
  44. case R_68K_GLOB_DAT: \
  45. case R_68K_JMP_SLOT: \
  46. *(REL) = (SYMBOL); \
  47. break; \
  48. case R_68K_RELATIVE: /* Compatibility kludge */ \
  49. *(REL) = ((unsigned int) (LOAD) + ((RELP)->r_addend ? : *(REL))); \
  50. break; \
  51. default: \
  52. _dl_exit (1); \
  53. }
  54. /* Transfer control to the user's application, once the dynamic loader
  55. is done. */
  56. #define START() \
  57. __asm__ volatile ("unlk %%a6\n\t" \
  58. "jmp %0@" \
  59. : : "a" (_dl_elf_main));
  60. /* Here we define the magic numbers that this dynamic loader should accept */
  61. #define MAGIC1 EM_68K
  62. #undef MAGIC2
  63. /* Used for error messages */
  64. #define ELF_TARGET "m68k"
  65. struct elf_resolve;
  66. extern unsigned int _dl_linux_resolver (int, int, struct elf_resolve *, int);
  67. /* Define this because we do not want to call .udiv in the library.
  68. Not needed for m68k. */
  69. #define do_rem(result, n, base) ((result) = (n) % (base))
  70. /* 4096 bytes alignment */
  71. #define PAGE_ALIGN 0xfffff000
  72. #define ADDR_ALIGN 0xfff
  73. #define OFFS_ALIGN 0x7ffff000