Merge branch 'jreiser' into devel

O_BINFO simplifies stubs on linux Elf;
PowerPC64 (big endian: Apple Macintosh G5) and PowerPC* cleanup;
-fpie simplification; shlib for arm64, amd64.

A big merge due to suspending activity on 'devel' branch
during stabilization for release of UPX-3.94.
There were intermediate merges with private branch 'jreiser',
and attempted rebase onto 'devel' did not go well.
Verfication of cases ({ET_EXEC, -fpie, shlib} x {$ARCH}) is in progress.

	modified:   ../.github/travis_testsuite_1.sh
	modified:   conf.h
	modified:   linker.cpp
	modified:   linker.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_mach_enum.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/scripts/xstrip.py

	modified:   stub/src/amd64-darwin.dylib-entry.S
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arch/powerpc/32/bxx.S
	modified:   stub/src/arch/powerpc/32/lzma_d.S
	modified:   stub/src/arch/powerpc/32/nrv2b_d.S
	modified:   stub/src/arch/powerpc/32/nrv2d_d.S
	modified:   stub/src/arch/powerpc/32/nrv2e_d.S
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	new file:   stub/src/arch/powerpc/64/Makefile
	new file:   stub/src/arch/powerpc/64/Makefile.extra
	new file:   stub/src/arch/powerpc/64/bxx.S
	new file:   stub/src/arch/powerpc/64/lzma_d.S
	new file:   stub/src/arch/powerpc/64/lzma_d_cf.S
	new file:   stub/src/arch/powerpc/64/lzma_d_cs.S
	new file:   stub/src/arch/powerpc/64/macros.S
	new file:   stub/src/arch/powerpc/64/nrv2b_d.S
	new file:   stub/src/arch/powerpc/64/nrv2d_d.S
	new file:   stub/src/arch/powerpc/64/nrv2e_d.S
	new file:   stub/src/arch/powerpc/64/ppc_regs.h
	modified:   stub/src/arch/powerpc/64le/bxx.S
	copied:     stub/src/arch/powerpc/64le/lzma_d.S -> stub/src/arch/powerpc/64le/lzma_d-common.S
	modified:   stub/src/arch/powerpc/64le/lzma_d.S
	modified:   stub/src/arch/powerpc/64le/lzma_d_cs.S
	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
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.shlib-init.S
	modified:   stub/src/i386-bsd.elf-entry.S
	modified:   stub/src/i386-darwin.macho-entry.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   stub/src/powerpc-darwin.dylib-entry.S
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.macho-fold.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c
	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/powerpc64-savegpr0.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c

	and most stub/*.h and stub/tmp/*.dump
This commit is contained in:
John Reiser
2017-06-05 11:32:25 -07:00
143 changed files with 22980 additions and 19952 deletions
+40 -2
View File
@@ -791,6 +791,14 @@ 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;
}
if (strncmp(type, "R_PPC64_REL", 11))
return super::relocate1(rel, location, value, type);
type += 11;
@@ -810,11 +818,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);
@@ -824,6 +832,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))