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 Nov 19, 2023
1 parent 3e1350a commit 5dfe8f0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions options/rtdl/generic/linker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,12 @@ void Loader::_processRelocations(Relocation &rel) {
rel.relocate(rel.object()->baseAddress + rel.addend_rel());
} break;

case R_IRELATIVE: {
uintptr_t addr = rel.object()->baseAddress + rel.addend_rel();
uintptr_t (*fn)() = reinterpret_cast<uintptr_t (*)()>(addr);
rel.relocate(fn());
} break;

// 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 5dfe8f0

Please sign in to comment.