dl-sysdep.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* vi: set sw=8 ts=8: */
  2. /*
  3. * Various assmbly language/system dependent hacks that are required
  4. * so that we can minimize the amount of platform specific code.
  5. */
  6. /* Define this if the system uses RELOCA. */
  7. #undef ELF_USES_RELOCA
  8. #define ARCH_NUM 3
  9. #define DT_MIPS_GOTSYM_IDX (DT_NUM + OS_NUM)
  10. #define DT_MIPS_LOCAL_GOTNO_IDX (DT_NUM + OS_NUM +1)
  11. #define DT_MIPS_SYMTABNO_IDX (DT_NUM + OS_NUM +2)
  12. #define ARCH_DYNAMIC_INFO(dpnt, dynamic, debug_addr) \
  13. do { \
  14. if (dpnt->d_tag == DT_MIPS_GOTSYM) \
  15. dynamic[DT_MIPS_GOTSYM_IDX] = dpnt->d_un.d_val; \
  16. else if(dpnt->d_tag == DT_MIPS_LOCAL_GOTNO) \
  17. dynamic[DT_MIPS_LOCAL_GOTNO_IDX] = dpnt->d_un.d_val; \
  18. else if(dpnt->d_tag == DT_MIPS_SYMTABNO) \
  19. dynamic[DT_MIPS_SYMTABNO_IDX] = dpnt->d_un.d_val; \
  20. else if (dpnt->d_tag == DT_MIPS_RLD_MAP) \
  21. *(Elf32_Addr *)(dpnt->d_un.d_ptr) = (Elf32_Addr) debug_addr; \
  22. } while (0)
  23. /* Initialization sequence for the application/library GOT. */
  24. #define INIT_GOT(GOT_BASE,MODULE) \
  25. do { \
  26. unsigned long i; \
  27. \
  28. /* Check if this is the dynamic linker itself */ \
  29. if (MODULE->libtype == program_interpreter) \
  30. continue; \
  31. \
  32. /* Fill in first two GOT entries according to the ABI */ \
  33. GOT_BASE[0] = (unsigned long) _dl_linux_resolve; \
  34. GOT_BASE[1] = (unsigned long) MODULE; \
  35. \
  36. /* Add load address displacement to all local GOT entries */ \
  37. i = 2; \
  38. while (i < MODULE->dynamic_info[DT_MIPS_LOCAL_GOTNO_IDX]) \
  39. GOT_BASE[i++] += (unsigned long) MODULE->loadaddr; \
  40. \
  41. } while (0)
  42. /* Here we define the magic numbers that this dynamic loader should accept */
  43. #define MAGIC1 EM_MIPS
  44. #define MAGIC2 EM_MIPS_RS3_LE
  45. /* Used for error messages */
  46. #define ELF_TARGET "MIPS"
  47. unsigned long _dl_linux_resolver(unsigned long sym_index,
  48. unsigned long old_gpreg);
  49. struct elf_resolve;
  50. void _dl_perform_mips_global_got_relocations(struct elf_resolve *tpnt);
  51. #define do_rem(result, n, base) ((result) = (n) % (base))
  52. /* 4096 bytes alignment */
  53. #define PAGE_ALIGN 0xfffff000
  54. #define ADDR_ALIGN 0xfff
  55. #define OFFS_ALIGN 0x7ffff000
  56. #define elf_machine_type_class(type) ELF_RTYPE_CLASS_PLT
  57. /* MIPS does not have COPY relocs */
  58. #define DL_NO_COPY_RELOCS