From 72156fcf1b4c53cbf3352db7c406d3e8bec66111 Mon Sep 17 00:00:00 2001 From: Thierry Fauck Date: Thu, 23 Mar 2017 11:21:50 +0100 Subject: [PATCH] powerpc64le: support for -fpie compiled binaries Signed-off-by: Thierry Fauck modified: powerpc64le-linux.elf-fold.h modified: src/powerpc64le-linux.elf-fold.S modified: src/powerpc64le-linux.elf-main.c modified: tmp/powerpc64le-linux.elf-fold.map --- src/stub/powerpc64le-linux.elf-fold.h | 280 ++++++++++---------- src/stub/src/powerpc64le-linux.elf-fold.S | 1 + src/stub/src/powerpc64le-linux.elf-main.c | 24 +- src/stub/tmp/powerpc64le-linux.elf-fold.map | 78 +++--- 4 files changed, 195 insertions(+), 188 deletions(-) diff --git a/src/stub/powerpc64le-linux.elf-fold.h b/src/stub/powerpc64le-linux.elf-fold.h index e34f67bf..1adb3200 100644 --- a/src/stub/powerpc64le-linux.elf-fold.h +++ b/src/stub/powerpc64le-linux.elf-fold.h @@ -1,5 +1,5 @@ /* powerpc64le-linux.elf-fold.h - created from powerpc64le-linux.elf-fold.bin, 2451 (0x993) bytes + created from powerpc64le-linux.elf-fold.bin, 2491 (0x9bb) bytes This file is part of the UPX executable compressor. @@ -31,21 +31,21 @@ */ -#define STUB_POWERPC64LE_LINUX_ELF_FOLD_SIZE 2451 -#define STUB_POWERPC64LE_LINUX_ELF_FOLD_ADLER32 0x1a536e2f -#define STUB_POWERPC64LE_LINUX_ELF_FOLD_CRC32 0x055d31f7 +#define STUB_POWERPC64LE_LINUX_ELF_FOLD_SIZE 2491 +#define STUB_POWERPC64LE_LINUX_ELF_FOLD_ADLER32 0x1b66866d +#define STUB_POWERPC64LE_LINUX_ELF_FOLD_CRC32 0x4b513a9d -unsigned char stub_powerpc64le_linux_elf_fold[2451] = { +unsigned char stub_powerpc64le_linux_elf_fold[2491] = { /* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 0x0010 */ 2, 0, 21, 0, 1, 0, 0, 0, 72, 9, 16, 0, 0, 0, 0, 0, +/* 0x0010 */ 2, 0, 21, 0, 1, 0, 0, 0,112, 9, 16, 0, 0, 0, 0, 0, /* 0x0020 */ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0030 */ 1, 0, 0, 0, 64, 0, 56, 0, 2, 0, 0, 0, 0, 0, 0, 0, /* 0x0040 */ 1, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0050 */ 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, -/* 0x0060 */ 72, 9, 0, 0, 0, 0, 0, 0, 72, 9, 0, 0, 0, 0, 0, 0, +/* 0x0060 */ 112, 9, 0, 0, 0, 0, 0, 0,112, 9, 0, 0, 0, 0, 0, 0, /* 0x0070 */ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 6, 0, 0, 0, -/* 0x0080 */ 72, 9, 0, 0, 0, 0, 0, 0, 72, 9, 16, 0, 0, 0, 0, 0, -/* 0x0090 */ 72, 9, 16, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, +/* 0x0080 */ 112, 9, 0, 0, 0, 0, 0, 0,112, 9, 16, 0, 0, 0, 0, 0, +/* 0x0090 */ 112, 9, 16, 0, 0, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, /* 0x00a0 */ 88, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* 0x00b0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,125, 0, 0, 72, /* 0x00c0 */ 208, 0, 6, 40, 32, 0,194, 76,191,240,132, 84, 32, 0,194, 77, @@ -57,137 +57,139 @@ unsigned char stub_powerpc64le_linux_elf_fold[2451] = { /* 0x0120 */ 32, 0,128, 78, 0, 0, 73,232, 8, 0, 41, 57, 0, 0,162, 43, /* 0x0130 */ 244,255,254, 64, 32, 0,128, 78, 48, 0, 33, 56,166, 2, 8,125, /* 0x0140 */ 0, 0, 33,233,225,255,255, 75,221,255,255, 75,248,255,159,128, -/* 0x0150 */ 38, 0, 30, 85,120,251,231,127, 80,248,164,127, 0,248,161, 56, -/* 0x0160 */ 248,255,189, 59, 80,255,132, 56,176, 0,125, 56,208,247, 33, 56, -/* 0x0170 */ 24, 0,195,128,197, 5, 0, 72,120, 27,127,124,120,235,163,127, -/* 0x0180 */ 80,240,157,124,201, 0, 0, 72,166, 3,232,127, 56, 8, 65,232, -/* 0x0190 */ 64, 8, 97,232, 72, 8,129,232, 80, 8,161,232, 88, 8,193,232, -/* 0x01a0 */ 96, 8,225,232,104, 8, 1,233,112, 8, 33,233,120, 8, 65,233, -/* 0x01b0 */ 128, 8, 97,233,136, 8,129,233,144, 8,161,233,152, 8,193,233, -/* 0x01c0 */ 160, 8,225,233,168, 8, 1,234,176, 8, 33,234,184, 8, 65,234, -/* 0x01d0 */ 192, 8, 97,234,200, 8,129,234,208, 8,161,234,216, 8,193,234, -/* 0x01e0 */ 224, 8,225,234,232, 8, 1,235,240, 8, 33,235,248, 8, 65,235, -/* 0x01f0 */ 0, 9, 97,235, 8, 9,129,235, 16, 9,161,235, 24, 9,193,235, -/* 0x0200 */ 32, 9,225,235, 48, 8, 33,232,166, 2,136,125, 32, 0,128, 78, -/* 0x0210 */ 90, 0, 0, 56, 2, 0, 0, 68, 8, 0,227, 64,255,255, 96, 56, -/* 0x0220 */ 32, 0,128, 78, 1, 0, 0, 56,236,255,255, 75, 3, 0, 0, 56, -/* 0x0230 */ 228,255,255, 75, 5, 0, 0, 56,220,255,255, 75, 6, 0, 0, 56, -/* 0x0240 */ 212,255,255, 75,125, 0, 0, 56,204,255,255, 75, 91, 0, 0, 56, -/* 0x0250 */ 196,255,255, 75, 45, 0, 0, 56,188,255,255, 75, 0, 0, 35, 44, -/* 0x0260 */ 32, 0,130, 77, 0, 0, 36, 47, 0, 0, 67,233, 64, 32,170,127, -/* 0x0270 */ 16, 0,158, 64, 0, 0,131,248, 8, 0,163,248, 32, 0,128, 78, -/* 0x0280 */ 1, 0,170, 43, 8, 0,158, 64,236,255,154, 64, 16, 0, 99, 56, -/* 0x0290 */ 216,255,255, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* 0x02a0 */ 0, 0, 67,233, 8, 0, 3,233, 1, 0,229, 56, 0, 0, 32, 57, -/* 0x02b0 */ 166, 3,233,124, 64, 40,170,127, 28, 0,252, 64,166, 2, 8,124, -/* 0x02c0 */ 127, 0, 96, 56, 16, 0, 1,248,145,255, 33,248, 89,255,255, 75, -/* 0x02d0 */ 0, 0, 0, 96, 20, 0, 64, 66,174, 72, 72,125,174, 73, 68,125, -/* 0x02e0 */ 1, 0, 41, 57,240,255,255, 75, 8, 0, 67,233, 20, 74, 74,125, -/* 0x02f0 */ 8, 0, 67,249, 0, 0, 67,233, 80, 80, 41,125, 0, 0, 35,249, -/* 0x0300 */ 32, 0,128, 78, 0, 0, 0, 0, 0, 0, 0, 1,128, 0, 0, 0, -/* 0x0310 */ 38, 0,128,125,166, 2, 8,124, 8, 0,129,145,197, 5, 0, 72, -/* 0x0320 */ 81,255, 33,248,120, 27,126,124,120, 35,159,124,120, 43,189,124, -/* 0x0330 */ 120, 51,220,124, 0, 0, 38, 46, 0, 0, 63,233, 0, 0,169, 47, -/* 0x0340 */ 64, 1,158, 65,120,243,195,127,112, 0,129, 56, 12, 0,160, 56, -/* 0x0350 */ 81,255,255, 75,112, 0, 65,129,116, 0, 33,129, 0, 0,170, 47, -/* 0x0360 */ 32, 0,158, 64, 88, 33, 37,109, 85, 80,133, 47, 28, 0,158, 64, -/* 0x0370 */ 0, 0, 62,233, 0, 0,169, 47, 8, 1,254, 65, 12, 0, 0, 72, -/* 0x0380 */ 33, 0, 41,121, 16, 0,226, 64,127, 0, 96, 56,153,254,255, 75, -/* 0x0390 */ 0, 0, 0, 96, 64, 80, 9,127,240,255,217, 65, 0, 0, 31,233, -/* 0x03a0 */ 64, 64,170,127,228,255,221, 65, 8, 0,191,232,164, 0,152, 64, -/* 0x03b0 */ 120, 75, 36,125, 0, 0, 61,233, 8, 0,126,232,128, 0,193, 56, -/* 0x03c0 */ 128, 0, 65,249, 40, 0, 65,248,120, 0,225,136, 16, 0,125,233, -/* 0x03d0 */ 166, 3, 41,125, 8, 0, 93,232, 33, 4,128, 78, 40, 0, 65,232, -/* 0x03e0 */ 0, 0,163, 47,164,255,222, 64,128, 0,129,232,112, 0, 33,129, -/* 0x03f0 */ 0, 72,164,127,148,255,222, 64,121, 0,193,136, 0, 0,166, 47, -/* 0x0400 */ 48, 0,158, 65, 44, 0,146, 65, 8, 0,127,232,122, 0,161,136, -/* 0x0410 */ 32, 0,132,120, 40, 0, 65,248, 0, 0, 60,233, 16, 0,124,233, -/* 0x0420 */ 166, 3, 41,125, 8, 0, 92,232, 33, 4,128, 78, 40, 0, 65,232, -/* 0x0430 */ 116, 0, 1,129, 8, 0, 94,233, 0, 0, 62,233, 20, 66, 74,125, -/* 0x0440 */ 80, 72, 40,125, 8, 0, 94,249, 0, 0, 62,249, 20, 0, 0, 72, -/* 0x0450 */ 120, 43,164,124,120,243,195,127,120, 75, 37,125, 69,254,255, 75, -/* 0x0460 */ 112, 0, 1,129, 8, 0, 95,233, 0, 0, 63,233, 20, 66, 74,125, -/* 0x0470 */ 80, 72, 40,125, 8, 0, 95,249, 0, 0, 63,249,188,254,255, 75, -/* 0x0480 */ 176, 0, 33, 56, 8, 0,129,129, 32,129,144,125,160, 4, 0, 72, -/* 0x0490 */ 0, 0, 0, 0, 0, 0, 0, 3,128, 4, 0, 0,166, 2, 8,124, -/* 0x04a0 */ 38, 0,128,125, 16, 0, 35,161, 3, 0,137, 47, 1, 4, 0, 72, -/* 0x04b0 */ 32, 0,163,234,120, 51,216,124,120, 27,123,124,120, 35,154,124, -/* 0x04c0 */ 120, 43,185,124, 8, 0,129,145,241,254, 33,248,120, 59,247,124, -/* 0x04d0 */ 120, 67, 22,125, 20,170,163,126, 16, 0,192, 56, 8, 0,158, 64, -/* 0x04e0 */ 0, 0,192, 56, 56, 0, 91,161, 34, 8,198, 56,120,171,168,126, -/* 0x04f0 */ 0, 0, 32, 57,255,255,192, 59, 1, 0, 74, 57,166, 3, 73,125, -/* 0x0500 */ 60, 0, 64, 66, 0, 0, 72,129, 1, 0,138, 47, 40, 0,158, 64, -/* 0x0510 */ 16, 0,232,232, 64, 56,190,127, 8, 0,157, 64,120, 59,254,124, -/* 0x0520 */ 40, 0, 72,233, 20, 82, 71,125, 64, 80,169,127, 8, 0,156, 64, -/* 0x0530 */ 120, 83, 73,125, 56, 0, 8, 57,200,255,255, 75, 1, 0, 41, 61, -/* 0x0540 */ 228, 3,222,123,255,255, 41, 57,120,243,195,127, 80, 72,158,124, -/* 0x0550 */ 0, 0,160, 56,228, 3,132,120,180, 7,198,124,255,255,224, 56, -/* 0x0560 */ 0, 0, 0, 57,173,252,255, 75, 0, 0, 0, 96, 81,115, 64, 62, -/* 0x0570 */ 0, 0, 96, 58, 0, 0, 58, 46, 64, 98, 82, 98, 80, 24,222,127, -/* 0x0580 */ 0, 0, 32, 58, 56, 0, 59,161, 0,152,137,127,136, 1,157, 64, -/* 0x0590 */ 0, 0, 53,129, 40, 0,146, 65, 6, 0,137, 47, 32, 0,158, 64, -/* 0x05a0 */ 16, 0,181,232,120,195, 3,127, 3, 0,128, 56, 20,242,165,124, -/* 0x05b0 */ 32, 0,165,120,169,252,255, 75, 76, 1, 0, 72, 1, 0,137, 47, -/* 0x05c0 */ 68, 1,158, 64, 4, 0,181,131, 16, 0, 53,233, 40, 0,149,234, -/* 0x05d0 */ 32, 0,245,235,250, 22,189, 87, 32, 4, 42,121,112, 0,225,251, -/* 0x05e0 */ 120, 0, 33,249, 48,236, 93,126,228, 3, 60,121, 20,162,158,126, -/* 0x05f0 */ 20,250,234,127, 20,242,156,127, 20,162,137,126,126, 7,176, 87, +/* 0x0150 */ 38, 0, 30, 85,120,243,202,127,120,251,231,127, 80,248,164,127, +/* 0x0160 */ 0,248,161, 56,248,255,189, 59, 80,255,132, 56,176, 0,125, 56, +/* 0x0170 */ 208,247, 33, 56, 24, 0,195,128,205, 5, 0, 72,120, 27,127,124, +/* 0x0180 */ 120,235,163,127, 80,240,157,124,201, 0, 0, 72,166, 3,232,127, +/* 0x0190 */ 56, 8, 65,232, 64, 8, 97,232, 72, 8,129,232, 80, 8,161,232, +/* 0x01a0 */ 88, 8,193,232, 96, 8,225,232,104, 8, 1,233,112, 8, 33,233, +/* 0x01b0 */ 120, 8, 65,233,128, 8, 97,233,136, 8,129,233,144, 8,161,233, +/* 0x01c0 */ 152, 8,193,233,160, 8,225,233,168, 8, 1,234,176, 8, 33,234, +/* 0x01d0 */ 184, 8, 65,234,192, 8, 97,234,200, 8,129,234,208, 8,161,234, +/* 0x01e0 */ 216, 8,193,234,224, 8,225,234,232, 8, 1,235,240, 8, 33,235, +/* 0x01f0 */ 248, 8, 65,235, 0, 9, 97,235, 8, 9,129,235, 16, 9,161,235, +/* 0x0200 */ 24, 9,193,235, 32, 9,225,235, 48, 8, 33,232,166, 2,136,125, +/* 0x0210 */ 32, 0,128, 78, 90, 0, 0, 56, 2, 0, 0, 68, 8, 0,227, 64, +/* 0x0220 */ 255,255, 96, 56, 32, 0,128, 78, 1, 0, 0, 56,236,255,255, 75, +/* 0x0230 */ 3, 0, 0, 56,228,255,255, 75, 5, 0, 0, 56,220,255,255, 75, +/* 0x0240 */ 6, 0, 0, 56,212,255,255, 75,125, 0, 0, 56,204,255,255, 75, +/* 0x0250 */ 91, 0, 0, 56,196,255,255, 75, 45, 0, 0, 56,188,255,255, 75, +/* 0x0260 */ 0, 0, 35, 44, 32, 0,130, 77, 0, 0, 36, 47, 0, 0, 67,233, +/* 0x0270 */ 64, 32,170,127, 16, 0,158, 64, 0, 0,131,248, 8, 0,163,248, +/* 0x0280 */ 32, 0,128, 78, 1, 0,170, 43, 8, 0,158, 64,236,255,154, 64, +/* 0x0290 */ 16, 0, 99, 56,216,255,255, 75, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x02a0 */ 0, 0, 0, 0, 0, 0, 67,233, 8, 0, 3,233, 1, 0,229, 56, +/* 0x02b0 */ 0, 0, 32, 57,166, 3,233,124, 64, 40,170,127, 28, 0,252, 64, +/* 0x02c0 */ 166, 2, 8,124,127, 0, 96, 56, 16, 0, 1,248,145,255, 33,248, +/* 0x02d0 */ 89,255,255, 75, 0, 0, 0, 96, 20, 0, 64, 66,174, 72, 72,125, +/* 0x02e0 */ 174, 73, 68,125, 1, 0, 41, 57,240,255,255, 75, 8, 0, 67,233, +/* 0x02f0 */ 20, 74, 74,125, 8, 0, 67,249, 0, 0, 67,233, 80, 80, 41,125, +/* 0x0300 */ 0, 0, 35,249, 32, 0,128, 78, 0, 0, 0, 0, 0, 0, 0, 1, +/* 0x0310 */ 128, 0, 0, 0, 38, 0,128,125,166, 2, 8,124, 8, 0,129,145, +/* 0x0320 */ 229, 5, 0, 72, 81,255, 33,248,120, 27,126,124,120, 35,159,124, +/* 0x0330 */ 120, 43,189,124,120, 51,220,124, 0, 0, 38, 46, 0, 0, 63,233, +/* 0x0340 */ 0, 0,169, 47, 64, 1,158, 65,120,243,195,127,112, 0,129, 56, +/* 0x0350 */ 12, 0,160, 56, 81,255,255, 75,112, 0, 65,129,116, 0, 33,129, +/* 0x0360 */ 0, 0,170, 47, 32, 0,158, 64, 88, 33, 37,109, 85, 80,133, 47, +/* 0x0370 */ 28, 0,158, 64, 0, 0, 62,233, 0, 0,169, 47, 8, 1,254, 65, +/* 0x0380 */ 12, 0, 0, 72, 33, 0, 41,121, 16, 0,226, 64,127, 0, 96, 56, +/* 0x0390 */ 153,254,255, 75, 0, 0, 0, 96, 64, 80, 9,127,240,255,217, 65, +/* 0x03a0 */ 0, 0, 31,233, 64, 64,170,127,228,255,221, 65, 8, 0,191,232, +/* 0x03b0 */ 164, 0,152, 64,120, 75, 36,125, 0, 0, 61,233, 8, 0,126,232, +/* 0x03c0 */ 128, 0,193, 56,128, 0, 65,249, 40, 0, 65,248,120, 0,225,136, +/* 0x03d0 */ 16, 0,125,233,166, 3, 41,125, 8, 0, 93,232, 33, 4,128, 78, +/* 0x03e0 */ 40, 0, 65,232, 0, 0,163, 47,164,255,222, 64,128, 0,129,232, +/* 0x03f0 */ 112, 0, 33,129, 0, 72,164,127,148,255,222, 64,121, 0,193,136, +/* 0x0400 */ 0, 0,166, 47, 48, 0,158, 65, 44, 0,146, 65, 8, 0,127,232, +/* 0x0410 */ 122, 0,161,136, 32, 0,132,120, 40, 0, 65,248, 0, 0, 60,233, +/* 0x0420 */ 16, 0,124,233,166, 3, 41,125, 8, 0, 92,232, 33, 4,128, 78, +/* 0x0430 */ 40, 0, 65,232,116, 0, 1,129, 8, 0, 94,233, 0, 0, 62,233, +/* 0x0440 */ 20, 66, 74,125, 80, 72, 40,125, 8, 0, 94,249, 0, 0, 62,249, +/* 0x0450 */ 20, 0, 0, 72,120, 43,164,124,120,243,195,127,120, 75, 37,125, +/* 0x0460 */ 69,254,255, 75,112, 0, 1,129, 8, 0, 95,233, 0, 0, 63,233, +/* 0x0470 */ 20, 66, 74,125, 80, 72, 40,125, 8, 0, 95,249, 0, 0, 63,249, +/* 0x0480 */ 188,254,255, 75,176, 0, 33, 56, 8, 0,129,129, 32,129,144,125, +/* 0x0490 */ 196, 4, 0, 72, 0, 0, 0, 0, 0, 0, 0, 3,128, 4, 0, 0, +/* 0x04a0 */ 166, 2, 8,124, 38, 0,128,125, 37, 4, 0, 72,120, 75, 58,125, +/* 0x04b0 */ 16, 0, 35,161, 32, 0,163,235,120, 51,215,124,120, 27,123,124, +/* 0x04c0 */ 120, 35,153,124, 3, 0,137, 47, 8, 0,129,145,241,254, 33,248, +/* 0x04d0 */ 120, 43,184,124,120, 59,246,124,120, 67, 21,125, 20,234,163,127, +/* 0x04e0 */ 16, 0,192, 56, 8, 0,158, 64, 0, 0,192, 56, 56, 0, 59,161, +/* 0x04f0 */ 34, 8,198, 56,120,235,168,127, 0, 0, 64, 57,255,255,192, 59, +/* 0x0500 */ 1, 0, 41, 57,166, 3, 41,125, 60, 0, 64, 66, 0, 0, 40,129, +/* 0x0510 */ 1, 0,137, 47, 40, 0,158, 64, 16, 0,232,232, 64, 56,190,127, +/* 0x0520 */ 8, 0,157, 64,120, 59,254,124, 40, 0, 40,233, 20, 74, 39,125, +/* 0x0530 */ 64, 72,170,127, 8, 0,156, 64,120, 75, 42,125, 56, 0, 8, 57, +/* 0x0540 */ 200,255,255, 75, 1, 0, 74, 61,228, 3,222,123,255,255, 74, 57, +/* 0x0550 */ 120,243,195,127, 80, 80,158,124, 0, 0,160, 56,228, 3,132,120, +/* 0x0560 */ 180, 7,198,124,255,255,224, 56, 0, 0, 0, 57,169,252,255, 75, +/* 0x0570 */ 0, 0, 0, 96, 81,115, 64, 62, 0, 0,128, 58, 0, 0, 57, 46, +/* 0x0580 */ 64, 98, 82, 98, 80, 24,222,127, 0, 0, 32, 58, 56, 0, 59,161, +/* 0x0590 */ 0,160,137,127,128, 1,157, 64, 0, 0, 61,129, 36, 0,146, 65, +/* 0x05a0 */ 6, 0,137, 47, 28, 0,158, 64, 16, 0,189,232,120,187,227,126, +/* 0x05b0 */ 3, 0,128, 56, 20, 42,190,124,169,252,255, 75, 72, 1, 0, 72, +/* 0x05c0 */ 1, 0,137, 47, 64, 1,158, 64, 4, 0,253,129, 16, 0,157,235, +/* 0x05d0 */ 32, 0,253,235, 40, 0,125,234,250, 22,239, 85, 20,226,158,127, +/* 0x05e0 */ 112, 0,225,251, 48,124, 79,126, 32, 4,137,123,120, 0,129,251, +/* 0x05f0 */ 20,154,124,126, 20,250,233,127,228, 3,156,123,126, 7,240, 85, /* 0x0600 */ 12, 0,146, 64, 0, 0,160, 56, 8, 0, 0, 72, 2, 0,160, 56, -/* 0x0610 */ 120,131,165,124,180, 7,165,124, 16, 0,146, 64,120,203, 39,127, +/* 0x0610 */ 120,131,165,124,180, 7,165,124, 16, 0,146, 64,120,195, 7,127, /* 0x0620 */ 18, 0,192, 56, 12, 0, 0, 72, 50, 0,192, 56,255,255,224, 56, -/* 0x0630 */ 8, 0, 21,233,120,227,131,127,120,251,228,127, 80, 64, 10,125, -/* 0x0640 */ 209,251,255, 75, 0, 0, 0, 96, 0, 24,188,127, 16, 0,254, 65, -/* 0x0650 */ 127, 0, 96, 56,209,251,255, 75, 0, 0, 0, 96, 24, 0,146, 65, -/* 0x0660 */ 120,211, 67,127,112, 0,129, 56,120,187,229,126,120,179,198,126, -/* 0x0670 */ 161,252,255, 75,208, 0,255,125,227,255,169,123, 32, 4,239,121, -/* 0x0680 */ 12, 0,130, 64, 44, 0,146, 64, 68, 0, 0, 72, 0, 0,175, 47, -/* 0x0690 */ 244,255,158, 65,166, 3,233,125, 20,250, 92,125, 0, 0, 32, 57, +/* 0x0630 */ 8, 0, 29,233,120,227,131,127,120,251,228,127, 80, 64, 9,125, +/* 0x0640 */ 213,251,255, 75, 0, 0, 0, 96, 0, 24,188,127, 16, 0,254, 65, +/* 0x0650 */ 127, 0, 96, 56,213,251,255, 75, 0, 0, 0, 96, 24, 0,146, 65, +/* 0x0660 */ 120,203, 35,127,112, 0,129, 56,120,179,197,126,120,171,166,126, +/* 0x0670 */ 165,252,255, 75,208, 0,223,125,227,255,233,121, 32, 4,206,121, +/* 0x0680 */ 12, 0,130, 64, 44, 0,146, 64, 68, 0, 0, 72, 0, 0,174, 47, +/* 0x0690 */ 244,255,158, 65,166, 3,201,125, 20,250, 92,125, 0, 0, 32, 57, /* 0x06a0 */ 174, 73, 42,126, 1, 0, 41, 57,248,255, 0, 66,216,255,255, 75, -/* 0x06b0 */ 120,227,131,127,120,251,228,127,180, 7, 5,126,137,251,255, 75, -/* 0x06c0 */ 0, 0, 0, 96, 0, 0,163, 47,136,255,222, 64, 20,250,239,127, -/* 0x06d0 */ 20,250,252,127, 64,160,191,127, 44, 0,156, 64,120,251,227,127, -/* 0x06e0 */ 80,160,159,124,180, 7, 5,126, 50, 0,192, 56,255,255,224, 56, -/* 0x06f0 */ 0, 0, 0, 57, 29,251,255, 75, 0, 0, 0, 96, 0, 24,191,127, -/* 0x0700 */ 80,255,222, 64, 1, 0,115, 58, 56, 0,181, 58,180, 7,115,126, -/* 0x0710 */ 116,254,255, 75, 16, 1, 33, 56, 24, 0,123,232, 20, 26,126,124, -/* 0x0720 */ 8, 0,129,129, 32,129,144,125,208, 1, 0, 72, 0, 0, 0, 0, -/* 0x0730 */ 0, 0, 0, 3,128, 17, 0, 0,166, 2, 8,124,232,255,132, 56, -/* 0x0740 */ 24, 0, 67,129, 0, 0,192, 56,149, 1, 0, 72, 33,255, 33,248, -/* 0x0750 */ 120, 43,191,124,120, 75, 62,125, 64, 0,165, 59, 24, 0, 35, 57, -/* 0x0760 */ 144, 0,129,248,136, 0,161,248,120, 59,229,124,112, 0,129,248, -/* 0x0770 */ 120, 0, 33,249,128, 0, 65,249,160, 0,225,248,168, 0, 1,249, -/* 0x0780 */ 152, 0, 33,249,144, 0, 97, 56,128, 0,129, 56,133,251,255, 75, -/* 0x0790 */ 80, 0, 63,233,120,243,195,127, 3, 0,128, 56, 64, 0,169, 56, -/* 0x07a0 */ 32, 0,165,120,185,250,255, 75, 56, 0,191,160,120,243,195,127, -/* 0x07b0 */ 5, 0,128, 56,169,250,255, 75, 24, 0,191,128,120,243,195,127, -/* 0x07c0 */ 9, 0,128, 56,153,250,255, 75,160, 0,225,232,168, 0, 1,233, -/* 0x07d0 */ 120,243,198,127,112, 0,129, 56, 0, 0,160, 56,120,251,227,127, -/* 0x07e0 */ 189,252,255, 75, 9, 0,128, 56,120, 27,124,124,120,243,195,127, -/* 0x07f0 */ 32, 0,133,123, 0, 0,192, 59,101,250,255, 75, 56, 0, 63,161, -/* 0x0800 */ 0,240,137,127,144, 0,157, 64, 0, 0, 61,129, 3, 0,137, 47, -/* 0x0810 */ 116, 0,158, 64, 16, 0,125,232, 0, 0,128, 56, 0, 0,160, 56, -/* 0x0820 */ 21,250,255, 75, 0, 0, 0, 96, 0, 0,131, 47,120, 27,123,124, -/* 0x0830 */ 16, 0,252, 64,127, 0, 96, 56,237,249,255, 75, 0, 0, 0, 96, -/* 0x0840 */ 120,251,228,127, 0, 4,160, 56,229,249,255, 75, 0, 0, 0, 96, -/* 0x0850 */ 0, 4,163, 47,224,255,222, 64,120,251,227,127, 0, 0,128, 56, -/* 0x0860 */ 120,219,101,127, 0, 0,192, 56, 0, 0,224, 56, 0, 0, 0, 57, -/* 0x0870 */ 45,252,255, 75,120, 27,124,124,120,219, 99,127,193,249,255, 75, -/* 0x0880 */ 0, 0, 0, 96, 1, 0,222, 59, 56, 0,189, 59,180, 7,222,127, -/* 0x0890 */ 108,255,255, 75,224, 0, 33, 56,120,227,131,127,140, 0, 0, 72, -/* 0x08a0 */ 0, 0, 0, 0, 0, 0, 0, 1,128, 5, 0, 0,120,255,225,249, -/* 0x08b0 */ 128,255, 1,250,136,255, 33,250,144,255, 65,250,152,255, 97,250, -/* 0x08c0 */ 160,255,129,250,168,255,161,250,176,255,193,250,184,255,225,250, -/* 0x08d0 */ 192,255, 1,251,200,255, 33,251,208,255, 65,251,216,255, 97,251, -/* 0x08e0 */ 224,255,129,251,232,255,161,251,240,255,193,251,248,255,225,251, -/* 0x08f0 */ 16, 0, 1,248, 32, 0,128, 78,120,255,225,233,128,255, 1,234, -/* 0x0900 */ 136,255, 33,234,144,255, 65,234,152,255, 97,234,160,255,129,234, -/* 0x0910 */ 168,255,161,234,176,255,193,234,184,255,225,234,192,255, 1,235, -/* 0x0920 */ 200,255, 33,235,208,255, 65,235,216,255, 97,235,224,255,129,235, -/* 0x0930 */ 16, 0, 1,232,232,255,161,235,166, 3, 8,124,240,255,193,235, -/* 0x0940 */ 248,255,225,235, 32, 0,128, 78, 92, 2, 16, 0, 0, 0, 0, 0, -/* 0x0950 */ 72,137, 16, 0, 0, 0, 0, 0,160, 2, 16, 0, 0, 0, 0, 0, -/* 0x0960 */ 72,137, 16, 0, 0, 0, 0, 0, 16, 3, 16, 0, 0, 0, 0, 0, -/* 0x0970 */ 72,137, 16, 0, 0, 0, 0, 0,156, 4, 16, 0, 0, 0, 0, 0, -/* 0x0980 */ 72,137, 16, 0, 0, 0, 0, 0, 56, 7, 16, 0, 0, 0, 0, 0, -/* 0x0990 */ 72,137, 16 +/* 0x06b0 */ 120,227,131,127,120,251,228,127,180, 7, 5,126,141,251,255, 75, +/* 0x06c0 */ 0, 0, 0, 96, 0, 0,163, 47,136,255,222, 64, 20,250,238,127, +/* 0x06d0 */ 20,250,252,127, 64,152,191,127, 44, 0,156, 64,120,251,227,127, +/* 0x06e0 */ 80,152,159,124,180, 7, 5,126, 50, 0,192, 56,255,255,224, 56, +/* 0x06f0 */ 0, 0, 0, 57, 33,251,255, 75, 0, 0, 0, 96, 0, 24,191,127, +/* 0x0700 */ 80,255,222, 64, 1, 0,148, 58, 56, 0,189, 59,180, 7,148,126, +/* 0x0710 */ 124,254,255, 75, 0, 0,186, 47, 8, 0,158, 65, 0, 0,218,251, +/* 0x0720 */ 16, 1, 33, 56, 24, 0,123,232, 20, 26,126,124, 8, 0,129,129, +/* 0x0730 */ 32,129,144,125,232, 1, 0, 72, 0, 0, 0, 0, 0, 0, 0, 3, +/* 0x0740 */ 128, 18, 0, 0,166, 2, 8,124,232,255,132, 56, 0, 0,192, 56, +/* 0x0750 */ 177, 1, 0, 72, 33,255, 33,248,120, 43,191,124,120, 75, 62,125, +/* 0x0760 */ 64, 0,165, 59, 24, 0, 35, 57,144, 0,129,248,136, 0,161,248, +/* 0x0770 */ 120, 59,229,124,112, 0,129,248,120, 0, 33,249,152, 0, 33,249, +/* 0x0780 */ 224, 0,129, 59,128, 0,129, 56,105, 0, 92,249, 24, 0, 67,129, +/* 0x0790 */ 144, 0, 97, 56,128, 0, 65,249,160, 0,225,248,168, 0, 1,249, +/* 0x07a0 */ 117,251,255, 75, 80, 0,191,232,120,243,195,127, 3, 0,128, 56, +/* 0x07b0 */ 64, 0,165, 56,173,250,255, 75, 56, 0,191,160,120,243,195,127, +/* 0x07c0 */ 5, 0,128, 56,157,250,255, 75, 24, 0,191,128,120,243,195,127, +/* 0x07d0 */ 9, 0,128, 56,141,250,255, 75,160, 0,225,232,168, 0, 1,233, +/* 0x07e0 */ 120,243,198,127,112, 0,129, 56, 0, 0,160, 56,120,251,227,127, +/* 0x07f0 */ 120,227,137,127,173,252,255, 75, 9, 0,128, 56,120, 27,124,124, +/* 0x0800 */ 120,243,195,127,120,227,133,127, 0, 0,192, 59, 85,250,255, 75, +/* 0x0810 */ 56, 0, 63,161, 0,240,137,127,156, 0,157, 64, 0, 0, 61,129, +/* 0x0820 */ 3, 0,137, 47,128, 0,158, 64, 16, 0,125,232, 72, 1, 33,233, +/* 0x0830 */ 0, 0,128, 56, 0, 0,160, 56, 20, 74, 99,124,253,249,255, 75, +/* 0x0840 */ 0, 0, 0, 96, 0, 0,131, 47,120, 27,123,124, 16, 0,252, 64, +/* 0x0850 */ 127, 0, 96, 56,213,249,255, 75, 0, 0, 0, 96,120,251,228,127, +/* 0x0860 */ 0, 4,160, 56,205,249,255, 75, 0, 0, 0, 96, 0, 4,163, 47, +/* 0x0870 */ 224,255,222, 64,120,251,227,127, 0, 0,128, 56,120,219,101,127, +/* 0x0880 */ 0, 0,192, 56, 0, 0,224, 56, 0, 0, 0, 57, 0, 0, 32, 57, +/* 0x0890 */ 17,252,255, 75,120, 27,124,124,120,219, 99,127,165,249,255, 75, +/* 0x08a0 */ 0, 0, 0, 96, 1, 0,222, 59, 56, 0,189, 59,180, 7,222,127, +/* 0x08b0 */ 96,255,255, 75,224, 0, 33, 56,120,227,131,127,148, 0, 0, 72, +/* 0x08c0 */ 0, 0, 0, 0, 0, 0, 0, 1,128, 5, 0, 0,112,255,193,249, +/* 0x08d0 */ 120,255,225,249,128,255, 1,250,136,255, 33,250,144,255, 65,250, +/* 0x08e0 */ 152,255, 97,250,160,255,129,250,168,255,161,250,176,255,193,250, +/* 0x08f0 */ 184,255,225,250,192,255, 1,251,200,255, 33,251,208,255, 65,251, +/* 0x0900 */ 216,255, 97,251,224,255,129,251,232,255,161,251,240,255,193,251, +/* 0x0910 */ 248,255,225,251, 16, 0, 1,248, 32, 0,128, 78,112,255,193,233, +/* 0x0920 */ 120,255,225,233,128,255, 1,234,136,255, 33,234,144,255, 65,234, +/* 0x0930 */ 152,255, 97,234,160,255,129,234,168,255,161,234,176,255,193,234, +/* 0x0940 */ 184,255,225,234,192,255, 1,235,200,255, 33,235,208,255, 65,235, +/* 0x0950 */ 216,255, 97,235,224,255,129,235, 16, 0, 1,232,232,255,161,235, +/* 0x0960 */ 166, 3, 8,124,240,255,193,235,248,255,225,235, 32, 0,128, 78, +/* 0x0970 */ 96, 2, 16, 0, 0, 0, 0, 0,112,137, 16, 0, 0, 0, 0, 0, +/* 0x0980 */ 164, 2, 16, 0, 0, 0, 0, 0,112,137, 16, 0, 0, 0, 0, 0, +/* 0x0990 */ 20, 3, 16, 0, 0, 0, 0, 0,112,137, 16, 0, 0, 0, 0, 0, +/* 0x09a0 */ 160, 4, 16, 0, 0, 0, 0, 0,112,137, 16, 0, 0, 0, 0, 0, +/* 0x09b0 */ 68, 7, 16, 0, 0, 0, 0, 0,112,137, 16 }; diff --git a/src/stub/src/powerpc64le-linux.elf-fold.S b/src/stub/src/powerpc64le-linux.elf-fold.S index 6d15e302..7a4fe790 100644 --- a/src/stub/src/powerpc64le-linux.elf-fold.S +++ b/src/stub/src/powerpc64le-linux.elf-fold.S @@ -75,6 +75,7 @@ L90: call zfind // a6= &Elf64_auxv lwz a1,-8(r31) // #bytes which preceed -8(r31) rlwinm r30,a5,0,0,31-12 // r30= &this_page + mr a7,r30 // reloc addr mr a4,r31 // &decompress: f_expand subf r29,a1,r31 // 8+ (char *)&our_Elf64_Ehdr la a2,-OVERHEAD(sp) // &Elf64_Ehdr temporary space diff --git a/src/stub/src/powerpc64le-linux.elf-main.c b/src/stub/src/powerpc64le-linux.elf-main.c index d7e50a6a..78f36e12 100644 --- a/src/stub/src/powerpc64le-linux.elf-main.c +++ b/src/stub/src/powerpc64le-linux.elf-main.c @@ -168,7 +168,7 @@ upx_bzero(char *p, size_t len) static void -auxv_up(Elf64_auxv_t *av, unsigned type, unsigned const value) +auxv_up(Elf64_auxv_t *av, unsigned type, uint64_t const value) { if (av) for (;; ++av) { @@ -230,7 +230,8 @@ do_xmap( int const fdi, Elf64_auxv_t *const av, f_expand *const f_decompress, - f_unfilter *const f_unf + f_unfilter *const f_unf, + Elf64_Addr *p_reloc ) { Elf64_Phdr const *phdr = (Elf64_Phdr const *) (void const *) (ehdr->e_phoff + @@ -247,13 +248,11 @@ do_xmap( unsigned const prot = PF_TO_PROT(phdr->p_flags); Extent xo; size_t mlen = xo.size = phdr->p_filesz; - char *addr = xo.buf = (char *)phdr->p_vaddr; + char *addr = xo.buf = reloc + (char *)phdr->p_vaddr; char *haddr = phdr->p_memsz + addr; size_t frag = (long)addr &~ PAGE_MASK; mlen += frag; addr -= frag; - addr += reloc; - haddr += reloc; if (addr != mmap(addr, mlen, prot | (xi ? PROT_WRITE : 0), MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), @@ -268,7 +267,7 @@ do_xmap( // bzero(addr, frag); // fragment at lo end //} frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary - if ( PROT_WRITE & prot ) { + if (PROT_WRITE & prot) { bzero(mlen+addr, frag); // fragment at hi end } if (xi) { @@ -285,6 +284,10 @@ ERR_LAB } } } + if (0!=p_reloc) { + *p_reloc = reloc; + } + return ehdr->e_entry + reloc; } @@ -300,7 +303,8 @@ void *upx_main( size_t const sz_ehdr, f_expand *const f_decompress, f_unfilter *const f_unf, - Elf64_auxv_t *const av + Elf64_auxv_t *const av, + Elf64_Addr reloc // IN OUT; value result for ET_DYN ) { Elf64_Phdr const *phdr = (Elf64_Phdr const *)(1+ ehdr); @@ -325,13 +329,13 @@ void *upx_main( //auxv_up(av, AT_PHENT , ehdr->e_phentsize); /* this can never change */ //auxv_up(av, AT_PAGESZ, PAGE_SIZE); /* ld-linux.so.2 does not need this */ - entry = do_xmap(ehdr, &xi0, 0, av, f_decompress, f_unf); + entry = do_xmap(ehdr, &xi0, 0, av, f_decompress, f_unf, &reloc); // "rewind" auxv_up(av, AT_ENTRY , entry); { // Map PT_INTERP program interpreter int j; for (j=0; j < ehdr->e_phnum; ++phdr, ++j) if (PT_INTERP==phdr->p_type) { - char const *const iname = (char const *)phdr->p_vaddr; + char const *const iname = reloc + (char const *)phdr->p_vaddr; int const fdi = open(iname, O_RDONLY, 0); if (0 > fdi) { err_exit(18); @@ -340,7 +344,7 @@ void *upx_main( ERR_LAB err_exit(19); } - entry = do_xmap(ehdr, 0, fdi, 0, 0, 0); + entry = do_xmap(ehdr, 0, fdi, 0, 0, 0, 0); close(fdi); } } diff --git a/src/stub/tmp/powerpc64le-linux.elf-fold.map b/src/stub/tmp/powerpc64le-linux.elf-fold.map index 71ebb1f9..a82b937f 100644 --- a/src/stub/tmp/powerpc64le-linux.elf-fold.map +++ b/src/stub/tmp/powerpc64le-linux.elf-fold.map @@ -9,58 +9,58 @@ Linker script and memory map TARGET(elf64-powerpcle) 0x00000000001000bc . = ((0x100000 + SIZEOF_HEADERS) + 0xc) -.text 0x00000000001000bc 0x7f0 +.text 0x00000000001000bc 0x810 *(.text) - .text 0x00000000001000bc 0x1a0 tmp/powerpc64le-linux.elf-fold.o - 0x0000000000100210 mmap - 0x0000000000100224 exit - 0x000000000010022c read - 0x0000000000100234 open - 0x000000000010023c close - 0x0000000000100244 mprotect - 0x000000000010024c munmap - 0x0000000000100254 brk - .text 0x000000000010025c 0x650 tmp/powerpc64le-linux.elf-main.o + .text 0x00000000001000bc 0x1a4 tmp/powerpc64le-linux.elf-fold.o + 0x0000000000100214 mmap + 0x0000000000100228 exit + 0x0000000000100230 read + 0x0000000000100238 open + 0x0000000000100240 close + 0x0000000000100248 mprotect + 0x0000000000100250 munmap + 0x0000000000100258 brk + .text 0x0000000000100260 0x66c tmp/powerpc64le-linux.elf-main.o *(.data) - .data 0x00000000001008ac 0x0 tmp/powerpc64le-linux.elf-fold.o - .data 0x00000000001008ac 0x0 tmp/powerpc64le-linux.elf-main.o + .data 0x00000000001008cc 0x0 tmp/powerpc64le-linux.elf-fold.o + .data 0x00000000001008cc 0x0 tmp/powerpc64le-linux.elf-main.o -.sfpr 0x00000000001008ac 0x9c - .sfpr 0x00000000001008ac 0x9c linker stubs - 0x00000000001008ac _savegpr0_15 - 0x00000000001008dc _savegpr0_27 - 0x00000000001008e0 _savegpr0_28 - 0x00000000001008f8 _restgpr0_15 - 0x0000000000100928 _restgpr0_27 - 0x000000000010092c _restgpr0_28 +.sfpr 0x00000000001008cc 0xa4 + .sfpr 0x00000000001008cc 0xa4 linker stubs + 0x00000000001008cc _savegpr0_14 + 0x0000000000100900 _savegpr0_27 + 0x0000000000100904 _savegpr0_28 + 0x000000000010091c _restgpr0_14 + 0x0000000000100950 _restgpr0_27 + 0x0000000000100954 _restgpr0_28 -.glink 0x0000000000100948 0x0 - .glink 0x0000000000100948 0x0 linker stubs +.glink 0x0000000000100970 0x0 + .glink 0x0000000000100970 0x0 linker stubs -.eh_frame 0x0000000000100948 0x0 - .eh_frame 0x0000000000100948 0x0 linker stubs +.eh_frame 0x0000000000100970 0x0 + .eh_frame 0x0000000000100970 0x0 linker stubs -.rela.dyn 0x0000000000100948 0x0 - .rela.iplt 0x0000000000100948 0x0 linker stubs +.rela.dyn 0x0000000000100970 0x0 + .rela.iplt 0x0000000000100970 0x0 linker stubs .data LOAD tmp/powerpc64le-linux.elf-fold.o LOAD tmp/powerpc64le-linux.elf-main.o OUTPUT(tmp/powerpc64le-linux.elf-fold.bin elf64-powerpcle) -.branch_lt 0x0000000000100948 0x0 - .branch_lt 0x0000000000100948 0x0 linker stubs +.branch_lt 0x0000000000100970 0x0 + .branch_lt 0x0000000000100970 0x0 linker stubs -.toc 0x0000000000100948 0x0 - .toc 0x0000000000100948 0x0 tmp/powerpc64le-linux.elf-main.o +.toc 0x0000000000100970 0x0 + .toc 0x0000000000100970 0x0 tmp/powerpc64le-linux.elf-main.o -.opd 0x0000000000100948 0x58 - .opd 0x0000000000100948 0x58 tmp/powerpc64le-linux.elf-main.o - 0x0000000000100988 upx_main +.opd 0x0000000000100970 0x58 + .opd 0x0000000000100970 0x58 tmp/powerpc64le-linux.elf-main.o + 0x00000000001009b0 upx_main -.iplt 0x00000000001009a0 0x0 - .iplt 0x00000000001009a0 0x0 linker stubs +.iplt 0x00000000001009c8 0x0 + .iplt 0x00000000001009c8 0x0 linker stubs -.bss 0x00000000001009a0 0x0 - .bss 0x00000000001009a0 0x0 tmp/powerpc64le-linux.elf-fold.o - .bss 0x00000000001009a0 0x0 tmp/powerpc64le-linux.elf-main.o +.bss 0x00000000001009c8 0x0 + .bss 0x00000000001009c8 0x0 tmp/powerpc64le-linux.elf-fold.o + .bss 0x00000000001009c8 0x0 tmp/powerpc64le-linux.elf-main.o