From f3a7620ae83135ee84706b7a558138b43ad50711 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Fri, 12 Jan 2018 08:42:34 -0800 Subject: [PATCH] ARM: recognize R_ARM_CALL and R_ARM_JUMP24 as equivalent to R_ARM_PC24 modified: linker.cpp --- src/linker.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/linker.cpp b/src/linker.cpp index ee769a6a..0f262a4f 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -594,7 +594,9 @@ void ElfLinkerAMD64::relocate1(const Relocation *rel, upx_byte *location, upx_ui void ElfLinkerArmBE::relocate1(const Relocation *rel, upx_byte *location, upx_uint64_t value, const char *type) { - if (strcmp(type, "R_ARM_PC24") == 0) { + if (!strcmp(type, "R_ARM_PC24") + || !strcmp(type, "R_ARM_CALL") + || !strcmp(type, "R_ARM_JUMP24")) { value -= rel->section->offset + rel->offset; set_be24(1 + location, get_be24(1 + location) + value / 4); } else if (strcmp(type, "R_ARM_ABS32") == 0) { @@ -618,7 +620,9 @@ void ElfLinkerArmBE::relocate1(const Relocation *rel, upx_byte *location, upx_ui void ElfLinkerArmLE::relocate1(const Relocation *rel, upx_byte *location, upx_uint64_t value, const char *type) { - if (strcmp(type, "R_ARM_PC24") == 0) { + if (!strcmp(type, "R_ARM_PC24") + || !strcmp(type, "R_ARM_CALL") + || !strcmp(type, "R_ARM_JUMP24")) { value -= rel->section->offset + rel->offset; set_le24(location, get_le24(location) + value / 4); } else if (strcmp(type, "R_ARM_ABS32") == 0) {