#define IS_COPY(x) ((x)==R_MIPS_COPY)
#define IS_PLT(x) 1
-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)
+static inline void do_single_reloc(
+ struct dso *self, unsigned char *base_addr,
+ size_t *reloc_addr, int type, size_t addend,
+ Sym *sym, size_t sym_size,
+ struct symdef def, size_t sym_val)
{
switch(type) {
case R_MIPS_JUMP_SLOT:
case R_MIPS_COPY:
memcpy(reloc_addr, (void *)sym_val, sym_size);
break;
+ case R_MIPS_TLS_DTPMOD32:
+ *reloc_addr = def.dso ? def.dso->tls_id : self->tls_id;
+ break;
+ case R_MIPS_TLS_DTPREL32:
+ *reloc_addr += def.sym->st_value;
+ break;
+ case R_MIPS_TLS_TPREL32:
+ *reloc_addr += def.sym
+ ? def.sym->st_value + def.dso->tls_offset - 0x7000
+ : self->tls_offset - 0x7000;
+ break;
}
}
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)
{
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);
}
}