1
0
mirror of https://github.com/upx/upx synced 2025-09-28 19:06:07 +08:00

Try auto-relocate for /usr/lib/dyld

changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
This commit is contained in:
jreiser@BitWagon.com 2016-09-11 15:08:56 -07:00 committed by Markus F.X.J. Oberhumer
parent 1d3a66f890
commit 63dec77ed6
2 changed files with 107 additions and 99 deletions

View File

@ -32,8 +32,8 @@
#define STUB_AMD64_DARWIN_MACHO_UPXMAIN_EXE_SIZE 5464
#define STUB_AMD64_DARWIN_MACHO_UPXMAIN_EXE_ADLER32 0x588116f2
#define STUB_AMD64_DARWIN_MACHO_UPXMAIN_EXE_CRC32 0xd16eba11
#define STUB_AMD64_DARWIN_MACHO_UPXMAIN_EXE_ADLER32 0x0147312d
#define STUB_AMD64_DARWIN_MACHO_UPXMAIN_EXE_CRC32 0x6ca9614a
unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x0000 */ 207,250,237,254, 7, 0, 0, 1, 3, 0, 0,128, 2, 0, 0, 0,
@ -49,8 +49,8 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x00a0 */ 7, 0, 0, 0, 5, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0,
/* 0x00b0 */ 95, 95,116,101,120,116, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x00c0 */ 95, 95, 84, 69, 88, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x00d0 */ 95, 9,255,255, 0, 0, 0, 0, 65, 6, 0, 0, 0, 0, 0, 0,
/* 0x00e0 */ 95, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x00d0 */ 37, 9,255,255, 0, 0, 0, 0,123, 6, 0, 0, 0, 0, 0, 0,
/* 0x00e0 */ 37, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x00f0 */ 0, 4, 0,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0100 */ 95, 95,117,110,119,105,110,100, 95,105,110,102,111, 0, 0, 0,
/* 0x0110 */ 95, 95, 84, 69, 88, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -182,89 +182,89 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x08f0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0900 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0910 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0920 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0930 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0940 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0950 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85,
/* 0x0960 */ 72,137,229, 65, 87, 65, 86, 65, 85, 65, 84, 83, 72,131,236, 72,
/* 0x0970 */ 77,137,205, 76,137,195, 73,137,206, 73,137,212, 72,137,117,208,
/* 0x0980 */ 72,141, 71, 24, 72,137, 69,200, 72,139, 69,208, 72,131,192,232,
/* 0x0990 */ 72,137, 69,192, 76,137,101,184,139, 71, 24, 72,137, 69,176, 72,
/* 0x09a0 */ 139, 69,192, 72,139, 77,200, 72,137, 77,168, 72,137, 69,160, 69,
/* 0x09b0 */ 49,255, 72,141,125,192, 72,141,117,176, 49,201, 72,137,218,232,
/* 0x09c0 */ 27, 1, 0, 0, 76,137, 44, 36, 72,141, 85,160,190, 0, 0, 0,
/* 0x09d0 */ 0,185,255,255,255,255, 76,137,231, 76,139, 69, 16, 73,137,217,
/* 0x09e0 */ 232, 16, 2, 0, 0, 72,137,195, 65,139, 76, 36, 16,133,201, 15,
/* 0x09f0 */ 132,216, 0, 0, 0, 73,141, 68, 36, 32,131, 56, 14,116, 19, 65,
/* 0x0a00 */ 255,199,139, 80, 4, 72, 1,208, 65, 57,207,114,237,233,187, 0,
/* 0x0a10 */ 0, 0,139,120, 8, 72, 1,199, 49,246, 49,210,232, 97, 5, 0,
/* 0x0a20 */ 0, 65,137,199, 69,133,255,120,113, 77,141,108, 36, 16, 49,219,
/* 0x0a30 */ 68,137,255, 76,137,230, 76,137,242, 72,137,217,232, 57, 5, 0,
/* 0x0a40 */ 0, 76, 57,240,117, 84, 65,139, 4, 36, 61,190,186,254,202,116,
/* 0x0a50 */ 7, 61,202,254,186,190,117, 76, 65, 15,182, 68, 36, 7,141, 4,
/* 0x0a60 */ 128,141, 52,133, 8, 0, 0, 0, 76,137,231,232,226, 4, 0, 0,
/* 0x0a70 */ 65,139, 68, 36, 4, 49,201,133,192, 76,137,234,116, 28,129,122,
/* 0x0a80 */ 248, 7, 0, 0, 1,116, 12,255,193, 72,131,194, 20, 57,193,114,
/* 0x0a90 */ 237,235, 7,139, 26, 72,133,219,117,150,191,127, 0, 0, 0,232,
/* 0x0aa0 */ 202, 4, 0, 0, 72,199, 4, 36, 0, 0, 0, 0, 49,210, 69, 49,
/* 0x0ab0 */ 192, 69, 49,201, 76,137,231, 72,137,222, 68,137,249,232, 51, 1,
/* 0x0ac0 */ 0, 0, 72,137,195, 68,137,255,232,177, 4, 0, 0, 72,137,216,
/* 0x0ad0 */ 72,131,196, 72, 91, 65, 92, 65, 93, 65, 94, 65, 95, 93,195, 85,
/* 0x0ae0 */ 72,137,229, 65, 87, 65, 86, 65, 85, 65, 84, 83, 72,131,236, 56,
/* 0x0af0 */ 72,137, 77,176, 72,137, 85,168, 73,137,246, 72,137,125,184, 73,
/* 0x0b00 */ 131, 62, 0, 15,132,211, 0, 0, 0, 76,141,101,200,186, 12, 0,
/* 0x0b10 */ 0, 0, 72,139,125,184, 76,137,230,232,234, 3, 0, 0, 68,139,
/* 0x0b20 */ 109,200, 68,139,125,204, 77,133,237, 15,132,154, 0, 0, 0, 65,
/* 0x0b30 */ 141, 71,255, 68, 57,232, 15,131,175, 0, 0, 0, 77, 59, 46, 15,
/* 0x0b40 */ 135,166, 0, 0, 0, 69, 57,239,115, 90, 68,137,109,196, 72,139,
/* 0x0b50 */ 69,184, 72,139,120, 8, 73,139, 86, 8,139, 93,208, 68, 15,182,
/* 0x0b60 */ 195, 68,137,254, 72,141, 77,196,255, 85,168,133,192,117,124, 68,
/* 0x0b70 */ 57,109,196,117,118, 72,131,125,176, 0,116, 27, 15,182,199,102,
/* 0x0b80 */ 133,192,116, 19,193,235, 16, 15,183,200, 73,139,126, 8, 15,182,
/* 0x0b90 */ 211, 68,137,238,255, 85,176, 72,139, 69,184, 76, 1,120, 8, 76,
/* 0x0ba0 */ 41, 56,235, 16, 73,139,118, 8, 72,139,125,184, 76,137,250,232,
/* 0x0bb0 */ 84, 3, 0, 0, 77, 1,110, 8, 73,139, 6, 76, 41,232, 73,137,
/* 0x0bc0 */ 6, 15,133, 70,255,255,255,235, 19, 65,129,255, 85, 80, 88, 33,
/* 0x0bd0 */ 117, 25, 72,139, 69,184, 72,131, 56, 0,117, 15, 72,131,196, 56,
/* 0x0be0 */ 91, 65, 92, 65, 93, 65, 94, 65, 95, 93,195,191,127, 0, 0, 0,
/* 0x0bf0 */ 232,121, 3, 0, 0, 85, 72,137,229, 65, 87, 65, 86, 65, 85, 65,
/* 0x0c00 */ 84, 83, 72,131,236,104, 76,137,141,120,255,255,255, 76,137,133,
/* 0x0c10 */ 112,255,255,255,137, 77,148, 72,137, 85,192, 72,137,117,136, 72,
/* 0x0c20 */ 137,125,152,139, 95, 16, 69, 49,255,133,219,184, 0, 0, 0, 0,
/* 0x0c30 */ 15,132, 7, 2, 0, 0, 72,139, 77,152, 76,141,105, 32, 72,131,
/* 0x0c40 */ 125,192, 0, 15,149,193, 15,182,201, 72,141, 12, 73, 72,137, 77,
/* 0x0c50 */ 128, 72,191, 4, 0, 0, 0, 42, 0, 0, 0, 69, 49,192, 49,192,
/* 0x0c60 */ 73,139, 85, 0, 72,137,209, 72,193,233, 32,141,114,252,131,254,
/* 0x0c70 */ 2, 15,130, 80, 1, 0, 0,129,250, 40, 0, 0,128, 15,132, 83,
/* 0x0c80 */ 1, 0, 0,131,250, 25, 15,133,160, 1, 0, 0, 73,139, 85, 32,
/* 0x0c90 */ 72,133,210, 15,132,147, 1, 0, 0, 72,137, 85,168, 76,137, 69,
/* 0x0ca0 */ 184, 72,137, 69,160, 73,139, 69, 48, 72,137, 69,200, 77,139,101,
/* 0x0cb0 */ 24, 76,137,101,176, 76,137,101,208, 69,137,230, 65,129,230,255,
/* 0x0cc0 */ 15, 0, 0, 77, 41,244, 73, 1,198,116, 73, 72,139, 77,128, 73,
/* 0x0cd0 */ 141, 52, 14, 72,133,192,185, 18, 0, 0, 0,186, 18, 16, 0, 0,
/* 0x0ce0 */ 15, 68,202, 72,131,125,192, 0, 15, 69,202, 72,131,248, 1, 69,
/* 0x0cf0 */ 25,192, 68, 11, 69,148, 77,139, 77, 40, 76, 3, 77,136,186, 3,
/* 0x0d00 */ 0, 0, 0, 76,137,231,232,123, 2, 0, 0, 73, 57,196, 15,133,
/* 0x0d10 */ 56, 1, 0, 0, 72,131,125,192, 0,116, 52, 73,131,125, 48, 0,
/* 0x0d20 */ 116, 45, 73,131,125, 40, 0,117, 14, 72,139,133,112,255,255,255,
/* 0x0d30 */ 76,137, 32, 76,137,109,184, 72,139,125,192, 72,141,117,200, 72,
/* 0x0d40 */ 139,149,120,255,255,255, 72,139, 77, 16,232,144,253,255,255, 68,
/* 0x0d50 */ 137,243,247,219, 72,129,227,255, 15, 0, 0,116, 12, 75,141, 60,
/* 0x0d60 */ 52, 72,137,222,232,250, 1, 0, 0, 77,133,246,116, 23, 65,139,
/* 0x0d70 */ 85, 60, 76,137,231, 76,137,246,232,245, 1, 0, 0,133,192, 15,
/* 0x0d80 */ 133,199, 0, 0, 0, 72,139, 69,176, 72, 3, 69,168, 76, 1,243,
/* 0x0d90 */ 73, 1,220, 73, 57,196,115, 84, 77,133,228,116,114, 72,137,198,
/* 0x0da0 */ 76, 41,230, 65,139, 85, 60,185, 18, 16, 0, 0, 65,184,255,255,
/* 0x0db0 */ 255,255, 69, 49,201, 76,137,231,232,201, 1, 0, 0, 73, 57,196,
/* 0x0dc0 */ 116, 77,233,133, 0, 0, 0, 73, 57,125, 8,117, 95, 73,139,133,
/* 0x0dd0 */ 144, 0, 0, 0,235, 86, 73,139, 69, 8, 73, 57, 64, 40,119, 76,
/* 0x0de0 */ 73, 59, 64, 48,115, 70, 73, 3, 64, 24,235, 64, 72,131,125,192,
/* 0x0920 */ 0, 0, 0, 0, 0, 85, 72,137,229, 65, 87, 65, 86, 65, 85, 65,
/* 0x0930 */ 84, 83, 72,131,236, 72, 77,137,205, 76,137,195, 73,137,206, 73,
/* 0x0940 */ 137,212, 72,137,117,208, 72,141, 71, 24, 72,137, 69,200, 72,139,
/* 0x0950 */ 69,208, 72,131,192,232, 72,137, 69,192, 76,137,101,184,139, 71,
/* 0x0960 */ 24, 72,137, 69,176, 72,139, 69,192, 72,139, 77,200, 72,137, 77,
/* 0x0970 */ 168, 72,137, 69,160, 69, 49,255, 72,141,125,192, 72,141,117,176,
/* 0x0980 */ 49,201, 72,137,218,232, 27, 1, 0, 0, 76,137, 44, 36, 72,141,
/* 0x0990 */ 85,160,190, 0, 0, 0, 0,185,255,255,255,255, 76,137,231, 76,
/* 0x09a0 */ 139, 69, 16, 73,137,217,232, 16, 2, 0, 0, 72,137,195, 65,139,
/* 0x09b0 */ 76, 36, 16,133,201, 15,132,216, 0, 0, 0, 73,141, 68, 36, 32,
/* 0x09c0 */ 131, 56, 14,116, 19, 65,255,199,139, 80, 4, 72, 1,208, 65, 57,
/* 0x09d0 */ 207,114,237,233,187, 0, 0, 0,139,120, 8, 72, 1,199, 49,246,
/* 0x09e0 */ 49,210,232,155, 5, 0, 0, 65,137,199, 69,133,255,120,113, 77,
/* 0x09f0 */ 141,108, 36, 16, 49,219, 68,137,255, 76,137,230, 76,137,242, 72,
/* 0x0a00 */ 137,217,232,115, 5, 0, 0, 76, 57,240,117, 84, 65,139, 4, 36,
/* 0x0a10 */ 61,190,186,254,202,116, 7, 61,202,254,186,190,117, 76, 65, 15,
/* 0x0a20 */ 182, 68, 36, 7,141, 4,128,141, 52,133, 8, 0, 0, 0, 76,137,
/* 0x0a30 */ 231,232, 28, 5, 0, 0, 65,139, 68, 36, 4, 49,201,133,192, 76,
/* 0x0a40 */ 137,234,116, 28,129,122,248, 7, 0, 0, 1,116, 12,255,193, 72,
/* 0x0a50 */ 131,194, 20, 57,193,114,237,235, 7,139, 26, 72,133,219,117,150,
/* 0x0a60 */ 191,127, 0, 0, 0,232, 4, 5, 0, 0, 72,199, 4, 36, 0, 0,
/* 0x0a70 */ 0, 0, 49,210, 69, 49,192, 69, 49,201, 76,137,231, 72,137,222,
/* 0x0a80 */ 68,137,249,232, 51, 1, 0, 0, 72,137,195, 68,137,255,232,235,
/* 0x0a90 */ 4, 0, 0, 72,137,216, 72,131,196, 72, 91, 65, 92, 65, 93, 65,
/* 0x0aa0 */ 94, 65, 95, 93,195, 85, 72,137,229, 65, 87, 65, 86, 65, 85, 65,
/* 0x0ab0 */ 84, 83, 72,131,236, 56, 72,137, 77,176, 72,137, 85,168, 73,137,
/* 0x0ac0 */ 246, 72,137,125,184, 73,131, 62, 0, 15,132,211, 0, 0, 0, 76,
/* 0x0ad0 */ 141,101,200,186, 12, 0, 0, 0, 72,139,125,184, 76,137,230,232,
/* 0x0ae0 */ 36, 4, 0, 0, 68,139,109,200, 68,139,125,204, 77,133,237, 15,
/* 0x0af0 */ 132,154, 0, 0, 0, 65,141, 71,255, 68, 57,232, 15,131,175, 0,
/* 0x0b00 */ 0, 0, 77, 59, 46, 15,135,166, 0, 0, 0, 69, 57,239,115, 90,
/* 0x0b10 */ 68,137,109,196, 72,139, 69,184, 72,139,120, 8, 73,139, 86, 8,
/* 0x0b20 */ 139, 93,208, 68, 15,182,195, 68,137,254, 72,141, 77,196,255, 85,
/* 0x0b30 */ 168,133,192,117,124, 68, 57,109,196,117,118, 72,131,125,176, 0,
/* 0x0b40 */ 116, 27, 15,182,199,102,133,192,116, 19,193,235, 16, 15,183,200,
/* 0x0b50 */ 73,139,126, 8, 15,182,211, 68,137,238,255, 85,176, 72,139, 69,
/* 0x0b60 */ 184, 76, 1,120, 8, 76, 41, 56,235, 16, 73,139,118, 8, 72,139,
/* 0x0b70 */ 125,184, 76,137,250,232,142, 3, 0, 0, 77, 1,110, 8, 73,139,
/* 0x0b80 */ 6, 76, 41,232, 73,137, 6, 15,133, 70,255,255,255,235, 19, 65,
/* 0x0b90 */ 129,255, 85, 80, 88, 33,117, 25, 72,139, 69,184, 72,131, 56, 0,
/* 0x0ba0 */ 117, 15, 72,131,196, 56, 91, 65, 92, 65, 93, 65, 94, 65, 95, 93,
/* 0x0bb0 */ 195,191,127, 0, 0, 0,232,179, 3, 0, 0, 85, 72,137,229, 65,
/* 0x0bc0 */ 87, 65, 86, 65, 85, 65, 84, 83, 72,131,236,120, 76,137,141,112,
/* 0x0bd0 */ 255,255,255, 76,137,133,104,255,255,255,137, 77,140, 72,137, 85,
/* 0x0be0 */ 184, 72,137,117,128, 72,137,125,144,139, 95, 16, 69, 49,255,133,
/* 0x0bf0 */ 219,184, 0, 0, 0, 0, 15,132, 65, 2, 0, 0, 72,139, 77,144,
/* 0x0c00 */ 76,141,105, 32, 72,131,125,184, 0, 15,149,193, 15,182,201, 72,
/* 0x0c10 */ 141, 12, 73, 72,137,141,120,255,255,255, 72,191, 4, 0, 0, 0,
/* 0x0c20 */ 42, 0, 0, 0, 69, 49,192, 49,192, 49,201, 72,137, 77,192, 73,
/* 0x0c30 */ 139, 85, 0, 72,137,209, 72,193,233, 32,141,114,252,131,254, 2,
/* 0x0c40 */ 15,130,125, 1, 0, 0,129,250, 40, 0, 0,128, 15,132,132, 1,
/* 0x0c50 */ 0, 0,131,250, 25, 15,133,209, 1, 0, 0, 73,139, 85, 32, 72,
/* 0x0c60 */ 133,210, 15,132,196, 1, 0, 0, 72,137, 85,160, 76,137, 69,176,
/* 0x0c70 */ 72,137, 69,152, 73,139, 69, 48, 72,137, 69,200, 77,139,101, 24,
/* 0x0c80 */ 76,137,101,168, 76,137,101,208, 69,137,230, 65,129,230,255, 15,
/* 0x0c90 */ 0, 0, 77, 41,244, 73, 1,198,116,118, 72,139,141,120,255,255,
/* 0x0ca0 */ 255, 73,141, 52, 14, 76,137,231, 72,139, 77,192, 72, 1,207,186,
/* 0x0cb0 */ 2, 0, 0, 0,185, 18, 0, 0, 0, 15, 69,209, 72,133,192, 15,
/* 0x0cc0 */ 148,193, 15,182,201,193,225, 12, 72,131,125,184, 0,187, 0, 16,
/* 0x0cd0 */ 0, 0, 15, 69,203, 9,209, 72,131,248, 1, 69, 25,192, 68, 11,
/* 0x0ce0 */ 69,140, 77,139, 77, 40, 76, 3, 77,128,186, 3, 0, 0, 0,232,
/* 0x0cf0 */ 146, 2, 0, 0, 72,139, 77,192, 73, 1,204, 72, 15, 68,200, 72,
/* 0x0d00 */ 137, 77,192, 72,131,248,255, 73,137,196, 15,132, 60, 1, 0, 0,
/* 0x0d10 */ 72,131,125,184, 0,116, 52, 73,131,125, 48, 0,116, 45, 73,131,
/* 0x0d20 */ 125, 40, 0,117, 14, 72,139,133,104,255,255,255, 76,137, 32, 76,
/* 0x0d30 */ 137,109,176, 72,139,125,184, 72,141,117,200, 72,139,149,112,255,
/* 0x0d40 */ 255,255, 72,139, 77, 16,232, 90,253,255,255, 68,137,243,247,219,
/* 0x0d50 */ 72,129,227,255, 15, 0, 0,116, 12, 75,141, 60, 52, 72,137,222,
/* 0x0d60 */ 232,254, 1, 0, 0, 77,133,246,116, 23, 65,139, 85, 60, 76,137,
/* 0x0d70 */ 231, 76,137,246,232,249, 1, 0, 0,133,192, 15,133,203, 0, 0,
/* 0x0d80 */ 0, 72,139, 69,168, 72, 3, 69,160, 76, 1,243, 73, 1,220, 73,
/* 0x0d90 */ 57,196,115, 88, 77,133,228,116,118, 72,137,198, 76, 41,230, 65,
/* 0x0da0 */ 139, 85, 60,185, 18, 16, 0, 0, 65,184,255,255,255,255, 69, 49,
/* 0x0db0 */ 201, 76,137,231,232,205, 1, 0, 0, 73, 57,196,116, 81,233,137,
/* 0x0dc0 */ 0, 0, 0, 73, 57,125, 8,117, 99, 73,139,133,144, 0, 0, 0,
/* 0x0dd0 */ 72, 3, 69,192,235, 86, 73,139, 69, 8, 73, 57, 64, 40,119, 76,
/* 0x0de0 */ 73, 59, 64, 48,115, 70, 73, 3, 64, 24,235, 64, 72,131,125,184,
/* 0x0df0 */ 0,116, 28, 65,131,198, 3, 65,129,230,255, 15, 0, 0, 73,131,
/* 0x0e00 */ 254, 3,119, 11, 76,137,231, 76,137,246,232,103, 1, 0, 0, 65,
/* 0x0e10 */ 139, 77, 4, 72,139, 69,152,139, 88, 16, 72,191, 4, 0, 0, 0,
/* 0x0e20 */ 42, 0, 0, 0, 72,139, 69,160, 76,139, 69,184, 65,255,199,137,
/* 0x0e30 */ 201, 73, 1,205, 65, 57,223, 15,130, 35,254,255,255, 72,131,196,
/* 0x0e40 */ 104, 91, 65, 92, 65, 93, 65, 94, 65, 95, 93,195,191,127, 0, 0,
/* 0x0e10 */ 139, 77, 4, 72,139, 69,144,139, 88, 16, 72,191, 4, 0, 0, 0,
/* 0x0e20 */ 42, 0, 0, 0, 72,139, 69,152, 76,139, 69,176, 65,255,199,137,
/* 0x0e30 */ 201, 73, 1,205, 65, 57,223, 15,130,242,253,255,255, 72,131,196,
/* 0x0e40 */ 120, 91, 65, 92, 65, 93, 65, 94, 65, 95, 93,195,191,127, 0, 0,
/* 0x0e50 */ 0,232, 24, 1, 0, 0, 85, 72,137,229, 65, 87, 65, 86, 83, 72,
/* 0x0e60 */ 129,236, 24, 8, 0, 0, 73,137,247, 65,137,254, 72,141, 5,227,
/* 0x0e70 */ 255,255,255, 72, 37, 0, 0,255,255,139, 72, 16,133,201,116, 82,
@ -274,7 +274,7 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x0eb0 */ 104, 68, 15,183, 3, 73, 1,216, 76,141, 75, 2,235, 8, 72,139,
/* 0x0ec0 */ 120, 24, 72,139,112, 48,255,194,139, 88, 4, 72, 1,216, 57,202,
/* 0x0ed0 */ 114,200, 73,141, 71,240, 72,137, 4, 36, 72,141,149,224,247,255,
/* 0x0ee0 */ 255,185, 0, 8, 0, 0,232,116,250,255,255, 73, 99,206, 73,137,
/* 0x0ee0 */ 255,185, 0, 8, 0, 0,232, 58,250,255,255, 73, 99,206, 73,137,
/* 0x0ef0 */ 79,248, 73,141,103,240,255,224, 49,192, 72,129,196, 24, 8, 0,
/* 0x0f00 */ 0, 91, 65, 94, 65, 95, 93,195, 72,139, 15, 72, 57,209,114, 52,
/* 0x0f10 */ 72,139, 71, 8, 72,133,210,116, 29, 72,137,209, 72,255,201, 68,
@ -287,10 +287,10 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x0f80 */ 235, 2,176, 5,235, 2,176,197,235, 2,176, 3, 15,182,192, 13,
/* 0x0f90 */ 0, 0, 0, 2, 73,137,202, 15, 5,115, 4, 72,131,200,255,195,
/* 0x0fa0 */ 1, 0, 0, 0, 28, 0, 0, 0, 0, 0, 0, 0, 28, 0, 0, 0,
/* 0x0fb0 */ 0, 0, 0, 0, 28, 0, 0, 0, 2, 0, 0, 0, 95, 9, 0, 0,
/* 0x0fb0 */ 0, 0, 0, 0, 28, 0, 0, 0, 2, 0, 0, 0, 37, 9, 0, 0,
/* 0x0fc0 */ 52, 0, 0, 0, 52, 0, 0, 0,161, 15, 0, 0, 0, 0, 0, 0,
/* 0x0fd0 */ 52, 0, 0, 0, 3, 0, 0, 0, 12, 0, 4, 0, 28, 0, 4, 0,
/* 0x0fe0 */ 0, 0, 0, 3,247, 4, 0, 2,169, 5, 0, 1,243, 5, 0, 0,
/* 0x0fe0 */ 0, 0, 0, 3, 49, 5, 0, 2,227, 5, 0, 1, 45, 6, 0, 0,
/* 0x0ff0 */ 0, 0, 0, 0, 0, 0, 0, 1, 97, 1, 3, 1,209, 88, 5, 1,
/* 0x1000 */ 0, 9, 95, 0, 58, 98, 0,233, 1,119,114,105,116,101, 0,151,
/* 0x1010 */ 2,101,120,105,116, 0,161, 2,109, 0,171, 2,112,114,101, 97,
@ -302,7 +302,7 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x1070 */ 2,111,112,101,110, 0,232, 2,114,101, 97,100, 0,252, 2, 0,
/* 0x1080 */ 3,109,104, 95,101,120,101, 99,117,116,101, 95,104,101, 97,100,
/* 0x1090 */ 101,114, 0,166, 1, 95, 98,122,101,114,111, 0,254, 1, 98,122,
/* 0x10a0 */ 101,114,111, 0,131, 2, 2, 0, 0, 0, 3, 0,223, 18, 0, 0,
/* 0x10a0 */ 101,114,111, 0,131, 2, 2, 0, 0, 0, 3, 0,165, 18, 0, 0,
/* 0x10b0 */ 4, 97,105,110, 0,207, 1,112,114,111,116,101, 99,116, 0,166,
/* 0x10c0 */ 2,117,110,109, 97,112, 0,202, 2,109, 97,112, 0,242, 2, 3,
/* 0x10d0 */ 0,214, 28, 0, 0, 2,115,119, 97,112, 0,228, 1,122,101,114,
@ -317,8 +317,8 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x1160 */ 254, 30, 0, 3, 0,254, 30, 0, 3, 0,130, 31, 0, 3, 0,130,
/* 0x1170 */ 31, 0, 3, 0,134, 31, 0, 3, 0,134, 31, 0, 3, 0,138, 31,
/* 0x1180 */ 0, 3, 0,138, 31, 0, 0, 0, 2, 0, 0, 0, 14, 1, 0, 0,
/* 0x1190 */ 223, 10,255,255, 0, 0, 0, 0, 16, 0, 0, 0, 14, 1, 0, 0,
/* 0x11a0 */ 245, 11,255,255, 0, 0, 0, 0, 25, 0, 0, 0, 14, 1, 0, 0,
/* 0x1190 */ 165, 10,255,255, 0, 0, 0, 0, 16, 0, 0, 0, 14, 1, 0, 0,
/* 0x11a0 */ 187, 11,255,255, 0, 0, 0, 0, 25, 0, 0, 0, 14, 1, 0, 0,
/* 0x11b0 */ 8, 15,255,255, 0, 0, 0, 0, 32, 0, 0, 0, 2, 0, 0, 0,
/* 0x11c0 */ 1, 0, 0, 0, 0, 0, 0, 0, 41, 0, 0, 0, 2, 0, 0, 0,
/* 0x11d0 */ 3, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 2, 0, 0, 0,
@ -343,7 +343,7 @@ unsigned char stub_amd64_darwin_macho_upxmain_exe[5464] = {
/* 0x1300 */ 130, 15,255,255, 0, 0, 0, 0,222, 0, 0, 0, 15, 1, 0, 0,
/* 0x1310 */ 122, 15,255,255, 0, 0, 0, 0,229, 0, 0, 0, 15, 1, 0, 0,
/* 0x1320 */ 138, 15,255,255, 0, 0, 0, 0,235, 0, 0, 0, 15, 1, 0, 0,
/* 0x1330 */ 95, 9,255,255, 0, 0, 0, 0,245, 0, 0, 0, 15, 1, 0, 0,
/* 0x1330 */ 37, 9,255,255, 0, 0, 0, 0,245, 0, 0, 0, 15, 1, 0, 0,
/* 0x1340 */ 106, 15,255,255, 0, 0, 0, 0,252, 0, 0, 0, 15, 1, 0, 0,
/* 0x1350 */ 82, 15,255,255, 0, 0, 0, 0, 2, 1, 0, 0, 15, 1, 0, 0,
/* 0x1360 */ 99, 15,255,255, 0, 0, 0, 0, 8, 1, 0, 0, 15, 1, 0, 0,

View File

@ -482,6 +482,7 @@ typedef union {
#define PROT_WRITE 2
#define PROT_EXEC 4
#define MAP_ANON_FD -1
#define MAP_FAILED ((void *) -1)
extern void *mmap(void *, size_t, unsigned, unsigned, int, off_t);
ssize_t pread(int, void *, size_t, off_t);
@ -506,6 +507,7 @@ do_xmap(
Mach_segment_command const *sc = (Mach_segment_command const *)(1+ mhdr);
Mach_segment_command const *segTEXT = 0;
uint64_t entry = 0;
unsigned long base = 0;
unsigned j;
DPRINTF((STR_do_xmap(),
@ -522,19 +524,24 @@ do_xmap(
addr -= frag;
mlen += frag;
if (0!=mlen) {
if (0!=mlen) { // In particular, omitted for __PAGEZERO
// Decompressor can overrun the destination by 3 bytes. [x86 only]
size_t const mlen3 = mlen + (xi ? 3 : 0);
unsigned const prot = VM_PROT_READ | VM_PROT_WRITE;
unsigned const flags = MAP_FIXED | MAP_PRIVATE |
unsigned const flags = ((addr + base) ? MAP_FIXED : 0) | MAP_PRIVATE |
((xi || 0==sc->filesize) ? MAP_ANON : 0);
int const fdm = ((0==sc->filesize) ? MAP_ANON_FD : fdi);
off_t const offset = sc->fileoff + fat_offset;
DPRINTF((STR_mmap(), addr, mlen3, prot, flags, fdm, offset));
if (addr != mmap(addr, mlen3, prot, flags, fdm, offset)) {
DPRINTF((STR_mmap(), addr + base, mlen3, prot, flags, fdm, offset));
unsigned char *mapa = mmap(addr + base, mlen3, prot, flags, fdm, offset);
if (MAP_FAILED == mapa) {
err_exit(8);
}
if (0 == (addr + base)) { // dyld auto-relocate
base = (unsigned long)mapa; // relocation constant
}
addr = mapa;
}
if (xi && 0!=sc->filesize) {
if (0==sc->fileoff /*&& 0!=mhdrpp*/) {
@ -572,15 +579,16 @@ ERR_LAB
Mach_thread_command const *const thrc = (Mach_thread_command const *)sc;
if (AMD64_THREAD_STATE ==thrc->flavor
&& AMD64_THREAD_STATE_COUNT==thrc->count ) {
entry = thrc->state.rip;
entry = thrc->state.rip + base; // JMP
}
}
else if (LC_MAIN==sc->cmd) {
entry = ((Mach_main_command const *)sc)->entryoff;
if (segTEXT->fileoff <= entry && entry < segTEXT->filesize) {
entry += segTEXT->vmaddr;
entry += segTEXT->vmaddr; // CALL
}
// XXX FIXME TODO: if entry not in segTEXT
// XXX FIXME TODO: if entry not in segTEXT?
// XXX FIXME TODO: LC_MAIN is a CALL; LC_*THREAD is a JMP
}
return entry;
}