1570af302Sopenharmony_ci#if __mips_isa_rev >= 6 2570af302Sopenharmony_ci#define ISA_SUFFIX "r6" 3570af302Sopenharmony_ci#else 4570af302Sopenharmony_ci#define ISA_SUFFIX "" 5570af302Sopenharmony_ci#endif 6570af302Sopenharmony_ci 7570af302Sopenharmony_ci#if __BYTE_ORDER == __LITTLE_ENDIAN 8570af302Sopenharmony_ci#define ENDIAN_SUFFIX "el" 9570af302Sopenharmony_ci#else 10570af302Sopenharmony_ci#define ENDIAN_SUFFIX "" 11570af302Sopenharmony_ci#endif 12570af302Sopenharmony_ci 13570af302Sopenharmony_ci#ifdef __mips_soft_float 14570af302Sopenharmony_ci#define FP_SUFFIX "-sf" 15570af302Sopenharmony_ci#else 16570af302Sopenharmony_ci#define FP_SUFFIX "" 17570af302Sopenharmony_ci#endif 18570af302Sopenharmony_ci 19570af302Sopenharmony_ci#define LDSO_ARCH "mips64" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX 20570af302Sopenharmony_ci 21570af302Sopenharmony_ci#define TPOFF_K (-0x7000) 22570af302Sopenharmony_ci 23570af302Sopenharmony_ci#define REL_SYM_OR_REL 4611 24570af302Sopenharmony_ci#define REL_PLT R_MIPS_JUMP_SLOT 25570af302Sopenharmony_ci#define REL_COPY R_MIPS_COPY 26570af302Sopenharmony_ci#define REL_DTPMOD R_MIPS_TLS_DTPMOD64 27570af302Sopenharmony_ci#define REL_DTPOFF R_MIPS_TLS_DTPREL64 28570af302Sopenharmony_ci#define REL_TPOFF R_MIPS_TLS_TPREL64 29570af302Sopenharmony_ci 30570af302Sopenharmony_ci#include <endian.h> 31570af302Sopenharmony_ci 32570af302Sopenharmony_ci#undef R_TYPE 33570af302Sopenharmony_ci#undef R_SYM 34570af302Sopenharmony_ci#undef R_INFO 35570af302Sopenharmony_ci#define R_TYPE(x) (be64toh(x)&0x7fffffff) 36570af302Sopenharmony_ci#define R_SYM(x) (be32toh(be64toh(x)>>32)) 37570af302Sopenharmony_ci#define R_INFO(s,t) (htobe64((uint64_t)htobe32(s)<<32 | (uint64_t)t)) 38570af302Sopenharmony_ci 39570af302Sopenharmony_ci#define NEED_MIPS_GOT_RELOCS 1 40570af302Sopenharmony_ci#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP 41570af302Sopenharmony_ci#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL 42570af302Sopenharmony_ci#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) 43570af302Sopenharmony_ci 44570af302Sopenharmony_ci#define CRTJMP(pc,sp) __asm__ __volatile__( \ 45570af302Sopenharmony_ci "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" ) 46570af302Sopenharmony_ci 47570af302Sopenharmony_ci#define GETFUNCSYM(fp, sym, got) __asm__ ( \ 48570af302Sopenharmony_ci ".hidden " #sym "\n" \ 49570af302Sopenharmony_ci ".set push \n" \ 50570af302Sopenharmony_ci ".set noreorder \n" \ 51570af302Sopenharmony_ci ".align 8 \n" \ 52570af302Sopenharmony_ci " bal 1f \n" \ 53570af302Sopenharmony_ci " nop \n" \ 54570af302Sopenharmony_ci " .gpdword . \n" \ 55570af302Sopenharmony_ci " .gpdword " #sym " \n" \ 56570af302Sopenharmony_ci "1: ld %0, ($ra) \n" \ 57570af302Sopenharmony_ci " dsubu %0, $ra, %0 \n" \ 58570af302Sopenharmony_ci " ld $ra, 8($ra) \n" \ 59570af302Sopenharmony_ci " daddu %0, %0, $ra \n" \ 60570af302Sopenharmony_ci ".set pop \n" \ 61570af302Sopenharmony_ci : "=r"(*(fp)) : : "memory", "ra" ) 62