Skip to content

Commit

Permalink
Implement R_MIPS_26 relocation (#525)
Browse files Browse the repository at this point in the history
* feat(MIPS): added R_MIPS_26 Relocation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
DanielBotnik and pre-commit-ci[bot] authored Nov 19, 2024
1 parent 8290167 commit f7d20ed
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cle/backends/elf/relocation/mips.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ class R_MIPS_REL32(GenericRelativeReloc):
pass


class R_MIPS_26(GenericAbsoluteReloc):
def relocate(self):
if not self.resolved:
return False

original_value = self.owner.memory.unpack_word(self.dest_addr)
original_value += self.value // 4

self.owner.memory.pack_word(self.dest_addr, original_value)
return True


class R_MIPS_JUMP_SLOT(GenericAbsoluteReloc):
pass

Expand Down Expand Up @@ -129,7 +141,7 @@ class R_MIPS_TLS_TPREL64(GenericTLSOffsetReloc):
# 1: R_MIPS_16,
2: R_MIPS_32,
3: R_MIPS_REL32,
# 4: R_MIPS_26,
4: R_MIPS_26,
5: R_MIPS_HI16,
6: R_MIPS_LO16,
# 7: R_MIPS_GPREL16,
Expand Down

0 comments on commit f7d20ed

Please sign in to comment.