PowerPC 64-bit big-endian

modified:   conf.h
	modified:   linker.cpp
	modified:   linker.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/powerpc-linux.elf-entry.h
	new file:   stub/powerpc64-linux.elf-entry.h
	new file:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/scripts/xstrip.py
	modified:   stub/src/arch/powerpc/64le/nrv2b_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2d_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2e_d.S
	new file:   stub/src/powerpc64-darwin.dylib-entry.S
	new file:   stub/src/powerpc64-darwin.macho-entry.S
	new file:   stub/src/powerpc64-darwin.macho-fold.S
	new file:   stub/src/powerpc64-darwin.macho-main.c
	new file:   stub/src/powerpc64-linux.elf-entry.S
	new file:   stub/src/powerpc64-linux.elf-fold.S
	new file:   stub/src/powerpc64-linux.elf-fold.lds
	new file:   stub/src/powerpc64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
This commit is contained in:
John Reiser
2017-04-11 19:15:43 -07:00
parent 40b506d2e0
commit 4e05f087f9
29 changed files with 1944 additions and 478 deletions
+34
View File
@@ -797,6 +797,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_ADDR64")) {
set_le64(location, get_le64(location) + value);
return;
}
if (!strcmp(type, "R_PPC64_ADDR32")) {
set_le32(location, get_le32(location) + value);
return;
@@ -834,6 +838,36 @@ void ElfLinkerPpc64le::relocate1(const Relocation *rel, upx_byte *location, upx_
super::relocate1(rel, location, value, type);
}
void ElfLinkerPpc64::relocate1(const Relocation *rel, upx_byte *location, upx_uint64_t value,
const char *type) {
if (!strcmp(type, "R_PPC64_ADDR32")) {
set_be32(location, get_be32(location) + value);
return;
}
if (!strcmp(type, "R_PPC64_ADDR64")) {
set_be64(location, get_be64(location) + value);
return;
}
if (strncmp(type, "R_PPC64_REL", 11))
return super::relocate1(rel, location, value, type);
type += 11;
if (strncmp(type, "PC", 2) == 0) {
type += 2;
}
// We have "R_PPC64_REL" or "R_PPC64_RELPC" as a prefix.
/* value will hold relative displacement */
value -= rel->section->offset + rel->offset;
if (strncmp(type, "14", 2) == 0) // for "14" and "14S"
set_be16(2+ location, get_be16(2+ location) + value);
else if (strncmp(type, "24", 2) == 0) // for "24" and "24S"
set_be24(1+ location, get_be24(1+ location) + value);
else
super::relocate1(rel, location, value, type);
}
void ElfLinkerX86::relocate1(const Relocation *rel, upx_byte *location, upx_uint64_t value,
const char *type) {
if (strncmp(type, "R_386_", 6))