Skip to content

Commit

Permalink
options/rtdl: Implement R_IRELATIVE relocation
Browse files Browse the repository at this point in the history
  • Loading branch information
Qwinci committed Feb 4, 2024
1 parent 84d7a13 commit ee72694
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions options/rtdl/generic/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,15 @@ void Loader::_processRelocations(Relocation &rel) {
rel.relocate(rel.object()->baseAddress + rel.addend_rel());
} break;

// TODO: R_IRELATIVE also exists on other architectures but will likely need a different implementation.
#if defined(__x86_64__)
case R_IRELATIVE: {
uintptr_t addr = rel.object()->baseAddress + rel.addend_rel();
uintptr_t (*fn)() = reinterpret_cast<uintptr_t (*)()>(addr);
rel.relocate(fn());
} break;
#endif

// DTPMOD and DTPREL are dynamic TLS relocations (for __tls_get_addr()).
// TPOFF is a relocation to the initial TLS model.
case R_TLS_DTPMOD: {
Expand Down

0 comments on commit ee72694

Please sign in to comment.