diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2021-02-08 16:12:15 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2021-02-08 16:12:15 +0100 |
commit | 0c2d4b17f983ca67d222b3af64fd2f35c4a26af9 (patch) | |
tree | 6e694901bb424ed59200da160ea70cc6dfdb9bfe /ldso | |
parent | aca82e0ebadc48cc63fba4f71664b9b297733db2 (diff) |
riscv64: sync ldso relocations with or1k, fixes 5 testsuite errors
Diffstat (limited to 'ldso')
-rw-r--r-- | ldso/ldso/riscv64/elfinterp.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/ldso/ldso/riscv64/elfinterp.c b/ldso/ldso/riscv64/elfinterp.c index 8ddba1f9f..427e7b8fd 100644 --- a/ldso/ldso/riscv64/elfinterp.c +++ b/ldso/ldso/riscv64/elfinterp.c @@ -204,19 +204,21 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, *reloc_addr += tpnt->loadaddr + rpnt->r_addend; break; case R_RISCV_COPY: - _dl_memcpy((void *) reloc_addr, - (void *) symbol_addr, sym_ref.sym->st_size); + if (symbol_addr) { + _dl_memcpy((char *)reloc_addr, (char *)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; + *reloc_addr = symbol_addr + rpnt->r_addend; 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; + *reloc_addr = tls_tpnt->l_tls_offset + symbol_addr + rpnt->r_addend - TLS_TCB_SIZE; break; #endif default: |