• R/O
  • HTTP
  • SSH
  • HTTPS

提交

标签
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

修订版db4b12ae6213a28136d7622b74405c6c71c055b0 (tree)
时间2020-04-02 04:43:45
作者Yann Sionneau <yann@sion...>
CommiterWaldemar Brodkorb

Log Message

or1k: fix some TLS issues

Before this commit tst-tls-at-ctor test would segfault.
After it passes.

testsuite run before: https://pastebin.com/504JgQXa
testsuite run after: https://pastebin.com/d2aNciVt

Stafford Horne already fixed it in glibc:
* https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L298
* https://github.com/openrisc/or1k-glibc/blob/bcd87396ebe78228645c0731b06c934dfd88855a/sysdeps/or1k/dl-machine.h#L99

更改概述

差异

--- a/ldso/ldso/or1k/dl-sysdep.h
+++ b/ldso/ldso/or1k/dl-sysdep.h
@@ -36,8 +36,10 @@ do { \
3636 #define ELF_TARGET "or1k"
3737
3838 #define elf_machine_type_class(type) \
39- (((type) == R_OR1K_JMP_SLOT) * ELF_RTYPE_CLASS_PLT \
40- | ((type) == R_OR1K_COPY) * ELF_RTYPE_CLASS_COPY)
39+ (((type) == R_OR1K_JMP_SLOT || (type) == R_OR1K_TLS_DTPMOD || \
40+ (type) == R_OR1K_TLS_DTPOFF || \
41+ (type) == R_OR1K_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT \
42+ | ((type) == R_OR1K_COPY) * ELF_RTYPE_CLASS_COPY)
4143
4244 static inline Elf32_Addr *
4345 or1k_get_got (void)
--- a/ldso/ldso/or1k/elfinterp.c
+++ b/ldso/ldso/or1k/elfinterp.c
@@ -249,11 +249,11 @@ _dl_do_reloc(struct elf_resolve *tpnt, struct r_scope_elem *scope,
249249 *reloc_addr = tls_tpnt->l_tls_modid;
250250 break;
251251 case R_OR1K_TLS_DTPOFF:
252- *reloc_addr = symbol_addr;
252+ *reloc_addr = symbol_addr + rpnt->r_addend;
253253 break;
254254 case R_OR1K_TLS_TPOFF:
255255 CHECK_STATIC_TLS ((struct link_map *) tls_tpnt);
256- *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend;
256+ *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend - TLS_TCB_SIZE;
257257 break;
258258 #endif
259259