From b167374f13e5a619758dcfbc52aaedb77b855f1b Mon Sep 17 00:00:00 2001 From: John Reiser Date: Thu, 6 Apr 2017 14:12:29 -0700 Subject: [PATCH] R_PPC64_ADDR32 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 e018b0ae..473e726b 100644 --- a/src/linker.cpp +++ b/src/linker.cpp @@ -798,6 +798,10 @@ void ElfLinkerPpc32::relocate1(const Relocation *rel, upx_byte *location, upx_ui void ElfLinkerPpc64le::relocate1(const Relocation *rel, upx_byte *location, upx_uint64_t value, const char *type) { + if (!strcmp(type, "R_PPC64_ADDR32")) { + set_le32(location, get_le32(location) + value); + return; + } if (strncmp(type, "R_PPC64_REL", 11)) return super::relocate1(rel, location, value, type); type += 11; @@ -817,11 +821,11 @@ void ElfLinkerPpc64le::relocate1(const Relocation *rel, upx_byte *location, upx_ internal_error("target out of range (%d) in reloc %s:%x\n", displ, rel->section->name, rel->offset); *location += value; - } else if (strncmp(type, "14", 2) == 0) // for "32" and "32S" + } else if (strncmp(type, "14", 2) == 0) // for "14" and "14S" set_le16(location, get_le16(location) + value); else if (strcmp(type, "16") == 0) set_le16(location, get_le16(location) + value); - else if (strncmp(type, "24", 2) == 0) // for "32" and "32S" + else if (strncmp(type, "24", 2) == 0) // for "24" and "24S" set_le24(location, get_le24(location) + value); else if (strncmp(type, "32", 2) == 0) // for "32" and "32S" set_le32(location, get_le32(location) + value);