projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
suppress EINTR in sem_wait and sem_timedwait
[musl]
/
arch
/
mips
/
reloc.h
diff --git
a/arch/mips/reloc.h
b/arch/mips/reloc.h
index
853c8b8
..
4b81d32
100644
(file)
--- a/
arch/mips/reloc.h
+++ b/
arch/mips/reloc.h
@@
-1,25
+1,40
@@
#include <string.h>
#include <elf.h>
#include <string.h>
#include <elf.h>
+#include <endian.h>
-#define ETC_LDSO_PATH "/etc/ld-musl-mips.path"
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define ENDIAN_SUFFIX "el"
+#else
+#define ENDIAN_SUFFIX ""
+#endif
-#define IS_COPY(x) ((x)==R_MIPS_COPY)
-#define IS_PLT(x) 1
+#ifdef __mips_soft_float
+#define FP_SUFFIX "-sf"
+#else
+#define FP_SUFFIX ""
+#endif
-static inline void do_single_reloc(size_t *reloc_addr, int type, size_t sym_val, size_t sym_size, unsigned char *base_addr, size_t addend)
+#define LDSO_ARCH "mips" ENDIAN_SUFFIX FP_SUFFIX
+
+#define TPOFF_K (-0x7000)
+
+static int remap_rel(int type)
{
switch(type) {
{
switch(type) {
- case R_MIPS_JUMP_SLOT:
- *reloc_addr = sym_val;
- break;
case R_MIPS_REL32:
case R_MIPS_REL32:
-
if (sym_val) *reloc_addr += sym_val
;
- else *reloc_addr += (size_t)base_addr;
-
break
;
+
return REL_SYM_OR_REL
;
+ case R_MIPS_JUMP_SLOT:
+
return REL_PLT
;
case R_MIPS_COPY:
case R_MIPS_COPY:
- memcpy(reloc_addr, (void *)sym_val, sym_size);
- break;
+ return REL_COPY;
+ case R_MIPS_TLS_DTPMOD32:
+ return REL_DTPMOD;
+ case R_MIPS_TLS_DTPREL32:
+ return REL_DTPOFF;
+ case R_MIPS_TLS_TPREL32:
+ return REL_TPOFF;
}
}
+ return 0;
}
void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got)
}
void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got)
@@
-29,13
+44,13
@@
void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got)
for (a+=c+1; *a; a++);
for (a++; *a; a+=2) if (*a<20) t[*a] = a[1];
base = (char *)t[AT_BASE];
for (a+=c+1; *a; a++);
for (a++; *a; a+=2) if (*a<20) t[*a] = a[1];
base = (char *)t[AT_BASE];
- if (!base) base = (char *)(t[AT_PHDR] & -
4096
);
+ if (!base) base = (char *)(t[AT_PHDR] & -
t[AT_PAGESZ]
);
for (a=dynv; *a; a+=2) if (*a-0x70000000UL<20) t[*a&31] = a[1];
n = t[DT_MIPS_LOCAL_GOTNO - 0x70000000];
for (a=got; n; a++, n--) *a += (size_t)base;
}
for (a=dynv; *a; a+=2) if (*a-0x70000000UL<20) t[*a&31] = a[1];
n = t[DT_MIPS_LOCAL_GOTNO - 0x70000000];
for (a=got; n; a++, n--) *a += (size_t)base;
}
-static void do_relocs(
unsigned char *base, size_t *rel, size_t rel_size, size_t stride, Sym *syms, char *strings, struct dso *dso
);
+static void do_relocs(
struct dso *dso, size_t *rel, size_t rel_size, size_t stride
);
static void do_arch_relocs(struct dso *this, struct dso *head)
{
static void do_arch_relocs(struct dso *this, struct dso *head)
{
@@
-65,9
+80,10
@@
static void do_arch_relocs(struct dso *this, struct dso *head)
rel[0] = got;
rel[1] = sym-this->syms << 8 | R_MIPS_JUMP_SLOT;
*(size_t *)(base+got) = 0;
rel[0] = got;
rel[1] = sym-this->syms << 8 | R_MIPS_JUMP_SLOT;
*(size_t *)(base+got) = 0;
- do_relocs(
base, rel, sizeof rel, 2, this->syms, this->strings, head
);
+ do_relocs(
this, rel, sizeof rel, 2
);
}
}
#define NEED_ARCH_RELOCS 1
#define DYNAMIC_IS_RO 1
}
}
#define NEED_ARCH_RELOCS 1
#define DYNAMIC_IS_RO 1
+#define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT))