Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Dec 2019 21:56:44 +0000 (UTC)
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r355599 - head/libexec/rtld-elf/riscv
Message-ID:  <201912102156.xBALuitf075240@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Tue Dec 10 21:56:44 2019
New Revision: 355599
URL: https://svnweb.freebsd.org/changeset/base/355599

Log:
  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

Modified:
  head/libexec/rtld-elf/riscv/reloc.c

Modified: head/libexec/rtld-elf/riscv/reloc.c
==============================================================================
--- head/libexec/rtld-elf/riscv/reloc.c	Tue Dec 10 21:48:21 2019	(r355598)
+++ head/libexec/rtld-elf/riscv/reloc.c	Tue Dec 10 21:56:44 2019	(r355599)
@@ -354,7 +354,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, int
 			}
 
 			*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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912102156.xBALuitf075240>