1570af302Sopenharmony_ci#if __BYTE_ORDER == __BIG_ENDIAN
2570af302Sopenharmony_ci#define ENDIAN_SUFFIX "eb"
3570af302Sopenharmony_ci#else
4570af302Sopenharmony_ci#define ENDIAN_SUFFIX ""
5570af302Sopenharmony_ci#endif
6570af302Sopenharmony_ci
7570af302Sopenharmony_ci#if __SH_FPU_ANY__ || __SH4__
8570af302Sopenharmony_ci#define FP_SUFFIX ""
9570af302Sopenharmony_ci#else
10570af302Sopenharmony_ci#define FP_SUFFIX "-nofpu"
11570af302Sopenharmony_ci#endif
12570af302Sopenharmony_ci
13570af302Sopenharmony_ci#if __SH_FDPIC__
14570af302Sopenharmony_ci#define ABI_SUFFIX "-fdpic"
15570af302Sopenharmony_ci#else
16570af302Sopenharmony_ci#define ABI_SUFFIX ""
17570af302Sopenharmony_ci#endif
18570af302Sopenharmony_ci
19570af302Sopenharmony_ci#define LDSO_ARCH "sh" ENDIAN_SUFFIX FP_SUFFIX ABI_SUFFIX
20570af302Sopenharmony_ci
21570af302Sopenharmony_ci#define TPOFF_K 0
22570af302Sopenharmony_ci
23570af302Sopenharmony_ci#define REL_SYMBOLIC    R_SH_DIR32
24570af302Sopenharmony_ci#define REL_OFFSET      R_SH_REL32
25570af302Sopenharmony_ci#define REL_GOT         R_SH_GLOB_DAT
26570af302Sopenharmony_ci#define REL_PLT         R_SH_JMP_SLOT
27570af302Sopenharmony_ci#define REL_RELATIVE    R_SH_RELATIVE
28570af302Sopenharmony_ci#define REL_COPY        R_SH_COPY
29570af302Sopenharmony_ci#define REL_DTPMOD      R_SH_TLS_DTPMOD32
30570af302Sopenharmony_ci#define REL_DTPOFF      R_SH_TLS_DTPOFF32
31570af302Sopenharmony_ci#define REL_TPOFF       R_SH_TLS_TPOFF32
32570af302Sopenharmony_ci
33570af302Sopenharmony_ci#define DL_NOMMU_SUPPORT 1
34570af302Sopenharmony_ci
35570af302Sopenharmony_ci#if __SH_FDPIC__
36570af302Sopenharmony_ci#define REL_FUNCDESC    R_SH_FUNCDESC
37570af302Sopenharmony_ci#define REL_FUNCDESC_VAL R_SH_FUNCDESC_VALUE
38570af302Sopenharmony_ci#undef  REL_RELATIVE
39570af302Sopenharmony_ci#define DL_FDPIC 1
40570af302Sopenharmony_ci#define FDPIC_CONSTDISP_FLAG 0x100
41570af302Sopenharmony_ci#define CRTJMP(pc,sp) do { \
42570af302Sopenharmony_ci	register size_t r8 __asm__("r8") = ((size_t *)(sp))[-2]; \
43570af302Sopenharmony_ci	__asm__ __volatile__( "jmp @%0 ; mov %1,r15" \
44570af302Sopenharmony_ci	: : "r"(pc), "r"(sp), "r"(r8) : "memory" ); } while(0)
45570af302Sopenharmony_ci#define GETFUNCSYM(fp, sym, got) __asm__ ( \
46570af302Sopenharmony_ci	"mov.l 1f,%0 ; add %1,%0 ; bra 2f ; nop ; .align 2 \n" \
47570af302Sopenharmony_ci	"1:	.long " #sym "@GOTOFFFUNCDESC \n2:" \
48570af302Sopenharmony_ci	: "=&r"(*fp) : "r"(got) : "memory" )
49570af302Sopenharmony_ci#else
50570af302Sopenharmony_ci#define CRTJMP(pc,sp) __asm__ __volatile__( \
51570af302Sopenharmony_ci	"jmp @%0 ; mov %1,r15" : : "r"(pc), "r"(sp) : "memory" )
52570af302Sopenharmony_ci#endif
53