reloc.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #if __mips_isa_rev >= 6
  2. #define ISA_SUFFIX "r6"
  3. #else
  4. #define ISA_SUFFIX ""
  5. #endif
  6. #if __BYTE_ORDER == __LITTLE_ENDIAN
  7. #define ENDIAN_SUFFIX "el"
  8. #else
  9. #define ENDIAN_SUFFIX ""
  10. #endif
  11. #ifdef __mips_soft_float
  12. #define FP_SUFFIX "-sf"
  13. #else
  14. #define FP_SUFFIX ""
  15. #endif
  16. #define LDSO_ARCH "mips64" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
  17. #define TPOFF_K (-0x7000)
  18. #define REL_SYM_OR_REL 4611
  19. #define REL_PLT R_MIPS_JUMP_SLOT
  20. #define REL_COPY R_MIPS_COPY
  21. #define REL_DTPMOD R_MIPS_TLS_DTPMOD64
  22. #define REL_DTPOFF R_MIPS_TLS_DTPREL64
  23. #define REL_TPOFF R_MIPS_TLS_TPREL64
  24. #include <endian.h>
  25. #undef R_TYPE
  26. #undef R_SYM
  27. #undef R_INFO
  28. #define R_TYPE(x) (be64toh(x)&0x7fffffff)
  29. #define R_SYM(x) (be32toh(be64toh(x)>>32))
  30. #define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t))
  31. #define NEED_MIPS_GOT_RELOCS 1
  32. #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
  33. #define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL
  34. #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
  35. #define CRTJMP(pc,sp) __asm__ __volatile__( \
  36. "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
  37. #define GETFUNCSYM(fp, sym, got) __asm__ ( \
  38. ".hidden " #sym "\n" \
  39. ".set push \n" \
  40. ".set noreorder \n" \
  41. ".align 8 \n" \
  42. " bal 1f \n" \
  43. " nop \n" \
  44. " .gpdword . \n" \
  45. " .gpdword " #sym " \n" \
  46. "1: ld %0, ($ra) \n" \
  47. " dsubu %0, $ra, %0 \n" \
  48. " ld $ra, 8($ra) \n" \
  49. " daddu %0, %0, $ra \n" \
  50. ".set pop \n" \
  51. : "=r"(*(fp)) : : "memory", "ra" )