From 42e520e841ce0558c6f7e7195d203b5395bce851 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sun, 31 Jan 2016 19:59:00 -0800 Subject: [PATCH] ElfLinkerArm64LE --- src/linker.cpp | 16 ++++++++++++++++ src/linker.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/src/linker.cpp b/src/linker.cpp index fd42b5f9..5ee9a9da 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -730,6 +730,22 @@ void ElfLinkerArmLE::relocate1(const Relocation *rel, upx_byte *location, super::relocate1(rel, location, value, type); } +void ElfLinkerArm64LE::relocate1(const Relocation *rel, upx_byte *location, + upx_uint64_t value, const char *type) +{ + if (strcmp(type, "R_AARCH64_CALL26") == 0) + { + value -= rel->section->offset + rel->offset; + set_le24(location, get_le24(location) + value / 4); // FIXME set_le26 + } + else if (strcmp(type, "R_AARCH64_ABS32") == 0) + { + set_le32(location, get_le32(location) + value); + } + else + super::relocate1(rel, location, value, type); +} + void ElfLinkerM68k::alignCode(unsigned len) { diff --git a/src/linker.h b/src/linker.h index 488b23f9..5a4c8794 100644 --- a/src/linker.h +++ b/src/linker.h @@ -190,6 +190,14 @@ protected: upx_uint64_t value, const char *type); }; +class ElfLinkerArm64LE : public ElfLinker +{ + typedef ElfLinker super; +protected: + virtual void relocate1(const Relocation *, upx_byte *location, + upx_uint64_t value, const char *type); +}; + class ElfLinkerM68k : public ElfLinker {