blob: 728aaab2c29ad8638d912c275d1ba5b01427d507 [file] [log] [blame]
Rich Felker5972c4a2016-04-18 05:19:13 +00001#include <endian.h>
2
3#if __mips_isa_rev >= 6
4#define ISA_SUFFIX "r6"
5#else
6#define ISA_SUFFIX ""
7#endif
8
9#if __BYTE_ORDER == __LITTLE_ENDIAN
10#define ENDIAN_SUFFIX "el"
11#else
12#define ENDIAN_SUFFIX ""
13#endif
14
15#ifdef __mips_soft_float
16#define FP_SUFFIX "-sf"
17#else
18#define FP_SUFFIX ""
19#endif
20
21#define LDSO_ARCH "mipsn32" ISA_SUFFIX ENDIAN_SUFFIX FP_SUFFIX
22
23#define TPOFF_K (-0x7000)
24
25#define REL_SYM_OR_REL R_MIPS_REL32
26#define REL_PLT R_MIPS_JUMP_SLOT
27#define REL_COPY R_MIPS_COPY
28#define REL_DTPMOD R_MIPS_TLS_DTPMOD32
29#define REL_DTPOFF R_MIPS_TLS_DTPREL32
30#define REL_TPOFF R_MIPS_TLS_TPREL32
31
32#define NEED_MIPS_GOT_RELOCS 1
33#define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP
34#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))
35
36#define CRTJMP(pc,sp) __asm__ __volatile__( \
37 "move $sp,%1 ; jr %0" : : "r"(pc), "r"(sp) : "memory" )
38
39#define GETFUNCSYM(fp, sym, got) __asm__ ( \
40 ".hidden " #sym "\n" \
41 ".set push \n" \
42 ".set noreorder \n" \
43 " bal 1f \n" \
44 " nop \n" \
45 " .gpword . \n" \
46 " .gpword " #sym " \n" \
47 "1: lw %0, ($ra) \n" \
48 " subu %0, $ra, %0 \n" \
49 " lw $ra, 4($ra) \n" \
50 " addu %0, %0, $ra \n" \
51 ".set pop \n" \
52 : "=r"(*(fp)) : : "memory", "ra" )