diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2021-09-19 16:06:24 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2021-09-19 16:06:24 +0200 |
| commit | c5d328a5dab491738fc59325b0e819fb925bb530 (patch) | |
| tree | df3249c233b53fc0d1df62741f5ebdf13b61c951 /src | |
| parent | 1430c811cdbca2160cdf966aabb0b173ab7682f0 (diff) | |
| download | box64-c5d328a5dab491738fc59325b0e819fb925bb530.tar.gz box64-c5d328a5dab491738fc59325b0e819fb925bb530.zip | |
Fixed a bug with some TLS relocation when symbol is in another elf (helps c++ softs, probably other too)
Diffstat (limited to 'src')
| -rwxr-xr-x | src/elfs/elfloader.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/elfs/elfloader.c b/src/elfs/elfloader.c index 22977cc3..9ab2de18 100755 --- a/src/elfs/elfloader.c +++ b/src/elfs/elfloader.c @@ -574,7 +574,7 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t uint64_t *p = (uint64_t*)(rela[i].r_offset + head->delta); uintptr_t offs = 0; uintptr_t end = 0; - elfheader_t* h_tls = head; + elfheader_t* h_tls = NULL;//head; int version = head->VerSym?((Elf64_Half*)((uintptr_t)head->VerSym+head->delta))[ELF64_R_SYM(rela[i].r_info)]:-1; if(version!=-1) version &=0x7fff; const char* vername = GetSymbolVersion(head, version); @@ -744,7 +744,7 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t offs = getElfIndex(my_context, h_tls); } if(p) { - printf_dump(LOG_NEVER, "Apply %s %s @%p with sym=%s (%p -> %p)\n", "R_X86_64_DTPMOD64", (bind==STB_LOCAL)?"Local":"Global", p, symname, *(void**)p, (void*)offs); + printf_dump(LOG_NEVER, "Apply %s %s @%p with sym=%s (%p -> %p)\n", (bind==STB_LOCAL)?"Local":"Global", "R_X86_64_DTPMOD64", p, symname, *(void**)p, (void*)offs); *p = offs; } else { printf_log(LOG_NONE, "Warning, Symbol %s or Elf not found, but R_X86_64_DTPMOD64 Slot Offset is NULL \n", symname); @@ -760,7 +760,7 @@ int RelocateElfRELA(lib_t *maplib, lib_t *local_maplib, int bindnow, elfheader_t } // return -1; } else { - if(h_tls) + if(!symname || symname[0]=='\0' || bind==STB_LOCAL) offs = sym->st_value; if(p) { int64_t tlsoffset = offs; // it's not an offset in elf memory |