X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=arch%2Fmips%2Freloc.h;h=f5e9c77b0c63f4e9754b8fee95661d71c87e4b67;hb=a631c5df53c22146389228f228506936e258379b;hp=853c8b85f4aa16ec003642afb18e1f734f13916c;hpb=babf820180368f00742ec65b2050a82380d7c542;p=musl diff --git a/arch/mips/reloc.h b/arch/mips/reloc.h index 853c8b85..f5e9c77b 100644 --- a/arch/mips/reloc.h +++ b/arch/mips/reloc.h @@ -6,7 +6,11 @@ #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: @@ -19,6 +23,17 @@ static inline void do_single_reloc(size_t *reloc_addr, int type, size_t sym_val, 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; } } @@ -35,7 +50,7 @@ void __reloc_self(int c, size_t *a, size_t *dynv, size_t *got) 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) { @@ -65,7 +80,7 @@ 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); } }