mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:27:45 +00:00
LibELF: Implement TLS relocation support for x86_64
This commit is contained in:
parent
c51b49a8cb
commit
a0a38e1e84
1 changed files with 3 additions and 6 deletions
|
@ -478,6 +478,9 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
case R_386_TLS_TPOFF32:
|
case R_386_TLS_TPOFF32:
|
||||||
case R_386_TLS_TPOFF: {
|
case R_386_TLS_TPOFF: {
|
||||||
|
#else
|
||||||
|
case R_X86_64_TPOFF64: {
|
||||||
|
#endif
|
||||||
auto symbol = relocation.symbol();
|
auto symbol = relocation.symbol();
|
||||||
// For some reason, LibC has a R_386_TLS_TPOFF that refers to the undefined symbol.. huh
|
// For some reason, LibC has a R_386_TLS_TPOFF that refers to the undefined symbol.. huh
|
||||||
if (relocation.symbol_index() == 0)
|
if (relocation.symbol_index() == 0)
|
||||||
|
@ -490,12 +493,6 @@ DynamicLoader::RelocationResult DynamicLoader::do_relocation(const ELF::DynamicO
|
||||||
*patch_ptr = negative_offset_from_tls_block_end(res.value().value, dynamic_object_of_symbol->tls_offset().value(), res.value().size);
|
*patch_ptr = negative_offset_from_tls_block_end(res.value().value, dynamic_object_of_symbol->tls_offset().value(), res.value().size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
case R_X86_64_TPOFF64:
|
|
||||||
dbgln("FIXME: Patched R_X86_64_TPOFF64 relocation with invalid ptr.");
|
|
||||||
*patch_ptr = 0xaaaaaaaaaaaaaaaa;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#ifndef __LP64__
|
#ifndef __LP64__
|
||||||
case R_386_JMP_SLOT: {
|
case R_386_JMP_SLOT: {
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue