reloc.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #if __BYTE_ORDER == __BIG_ENDIAN
  2. #define ENDIAN_SUFFIX "eb"
  3. #else
  4. #define ENDIAN_SUFFIX ""
  5. #endif
  6. #if __SH_FPU_ANY__ || __SH4__
  7. #define FP_SUFFIX ""
  8. #else
  9. #define FP_SUFFIX "-nofpu"
  10. #endif
  11. #if __SH_FDPIC__
  12. #define ABI_SUFFIX "-fdpic"
  13. #else
  14. #define ABI_SUFFIX ""
  15. #endif
  16. #define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
  17. #define TPOFF_K 0
  18. #define REL_SYMBOLIC R_SH_DIR32
  19. #define REL_OFFSET R_SH_REL32
  20. #define REL_GOT R_SH_GLOB_DAT
  21. #define REL_PLT R_SH_JMP_SLOT
  22. #define REL_RELATIVE R_SH_RELATIVE
  23. #define REL_COPY R_SH_COPY
  24. #define REL_DTPMOD R_SH_TLS_DTPMOD32
  25. #define REL_DTPOFF R_SH_TLS_DTPOFF32
  26. #define REL_TPOFF R_SH_TLS_TPOFF32
  27. #define DL_NOMMU_SUPPORT 1
  28. #if __SH_FDPIC__
  29. #define REL_FUNCDESC R_SH_FUNCDESC
  30. #define REL_FUNCDESC_VAL R_SH_FUNCDESC_VALUE
  31. #undef REL_RELATIVE
  32. #define DL_FDPIC 1
  33. #define FDPIC_CONSTDISP_FLAG 0x100
  34. #define CRTJMP(pc,sp) do { \
  35. register size_t r8 __asm__("r8") = ((size_t *)(sp))[-2]; \
  36. __asm__ __volatile__( "jmp @%0 ; mov %1,r15" \
  37. : : "r"(pc), "r"(sp), "r"(r8) : "memory" ); } while(0)
  38. #define GETFUNCSYM(fp, sym, got) __asm__ ( \
  39. "mov.l 1f,%0 ; add %1,%0 ; bra 2f ; nop ; .align 2 \n" \
  40. "1: .long " #sym "@GOTOFFFUNCDESC \n2:" \
  41. : "=&r"(*fp) : "r"(got) : "memory" )
  42. #else
  43. #define CRTJMP(pc,sp) __asm__ __volatile__( \
  44. "jmp @%0 ; mov %1,r15" : : "r"(pc), "r"(sp) : "memory" )
  45. #endif