summaryrefslogtreecommitdiff
path: root/ldso
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2019-11-08 03:03:43 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2019-11-08 03:03:43 +0100
commitd0bc0d2bc8e5898bed6dfa6f253d164e9fc149f4 (patch)
treee6315b68a6c5100bdcec391cd965ef63d5291f82 /ldso
parentcb9d1f53717dd67892ba943626f3d1b46f3e760b (diff)
riscv64: implement NPTL/TLS
basically from or1k port of uClibc-ng, with fixes for structures in pthreadtypes.h from 64 bit architectures. 18 testsuite failures counted.
Diffstat (limited to 'ldso')
-rw-r--r--ldso/ldso/riscv64/elfinterp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/ldso/ldso/riscv64/elfinterp.c b/ldso/ldso/riscv64/elfinterp.c
index b954779bd..8ddba1f9f 100644
--- a/ldso/ldso/riscv64/elfinterp.c
+++ b/ldso/ldso/riscv64/elfinterp.c
@@ -33,11 +33,6 @@
#include "ldso.h"
-#if defined(USE_TLS) && USE_TLS
-#include "dl-tls.h"
-#include "tlsdeschtab.h"
-#endif
-
extern int _dl_linux_resolve(void);
unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry)
@@ -212,6 +207,18 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
_dl_memcpy((void *) reloc_addr,
(void *) symbol_addr, sym_ref.sym->st_size);
break;
+#if defined USE_TLS && USE_TLS
+ case R_RISCV_TLS_DTPMOD64:
+ *reloc_addr = tls_tpnt->l_tls_modid;
+ break;
+ case R_RISCV_TLS_DTPREL64:
+ *reloc_addr = symbol_addr;
+ break;
+ case R_RISCV_TLS_TPREL64:
+ CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);
+ *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend;
+ break;
+#endif
default:
return -1; /*call _dl_exit(1) */
}