aboutsummaryrefslogtreecommitdiff
path: root/libexec
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2019-12-10 21:56:44 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2019-12-10 21:56:44 +0000
commit15d0350503cebef714855ff8b5b0316e5edbef7f (patch)
treebcad180b89f65c9c89c26ce52637fc5334518b02 /libexec
parentf24f20f4357df32f2fada6b680751d5fff6d776b (diff)
downloadsrc-15d0350503cebef714855ff8b5b0316e5edbef7f.tar.gz
src-15d0350503cebef714855ff8b5b0316e5edbef7f.zip
Correct the offset of static TLS variables for Initial-Exec on RISC-V.
TP points to the start of the TLS block after the tcb, but Obj_Entry.tlsoffset includes the tcb, so subtract the size of the tcb to compute the offset relative to TP. This is identical to the same fixes for powerpc in r339072 and r342671. Reviewed by: James Clarke Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22661
Notes
Notes: svn path=/head/; revision=355599
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/riscv/reloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/rtld-elf/riscv/reloc.c b/libexec/rtld-elf/riscv/reloc.c
index 3123298f0437..c421270167f5 100644
--- a/libexec/rtld-elf/riscv/reloc.c
+++ b/libexec/rtld-elf/riscv/reloc.c
@@ -354,7 +354,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int flags,
}
*where = (def->st_value + rela->r_addend +
- defobj->tlsoffset - TLS_TP_OFFSET);
+ defobj->tlsoffset - TLS_TP_OFFSET - TLS_TCB_SIZE);
break;
case R_RISCV_RELATIVE:
*where = (Elf_Addr)(obj->relocbase + rela->r_addend);