Many changes for ELF shared libraries on Linux and Android

Handling more than 2 PT_LOAD (and thus more than 1 executable PT_LOAD)
required extensive changes.  But the bonus is the infrastructure
to support a different (de-)compression algorithm for each PT_LOAD.

https://github.com/upx/upx/issues/341   i386 .so decompression
https://github.com/upx/upx/issues/609   armv7 .so on Android
https://github.com/upx/upx/issues/625   amd64 .so execution
https://github.com/upx/upx/issues/654   armv7 .exe
Not yet: .so on MIPS, PowerPC, PowerPC64
This commit is contained in:
John Reiser
2023-03-04 17:37:25 -08:00
committed by Markus F.X.J. Oberhumer
parent fa56a1d9cd
commit adb0ca8250
121 changed files with 15796 additions and 6036 deletions
+181
View File
@@ -0,0 +1,181 @@
/* arm.v4a-linux.elf-so_entry.h
created from arm.v4a-linux.elf-so_entry.bin, 2270 (0x8de) bytes
This file is part of the UPX executable compressor.
Copyright (C) 1996-2023 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2023 Laszlo Molnar
Copyright (C) 2000-2023 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
#define STUB_ARM_V4A_LINUX_ELF_SO_ENTRY_SIZE 2270
#define STUB_ARM_V4A_LINUX_ELF_SO_ENTRY_ADLER32 0xd02dd5ae
#define STUB_ARM_V4A_LINUX_ELF_SO_ENTRY_CRC32 0x278a424a
unsigned char stub_arm_v4a_linux_elf_so_entry[2270] = {
/* 0x0000 */ 127, 69, 76, 70, 1, 1, 1, 97, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0, 40, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 224, 1, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0, 0, 0, 40, 0,
/* 0x0030 */ 8, 0, 5, 0,120, 71,192, 70, 0, 0,160,225,255, 64, 45,233,
/* 0x0040 */ 8,208, 77,226,254,255,255,235, 0, 80,160,227, 0, 64,224,227,
/* 0x0050 */ 34, 48,160,227, 3, 32,160,227, 0, 16,158,229, 4, 16,141,229,
/* 0x0060 */ 0, 0,160,227, 0, 64, 45,233,192,112,160,227, 0, 0, 0,239,
/* 0x0070 */ 1, 10,112,227, 16, 0, 0, 58,240, 1,240,231, 0, 64,189,232,
/* 0x0080 */ 0, 0,141,229, 4, 48,141,226, 0, 32,160,225, 4, 16,158,229,
/* 0x0090 */ 12, 0,142,226, 31, 0, 0,235, 0, 0,157,229, 4, 16,157,229,
/* 0x00a0 */ 5, 32,160,227,125,112,160,227, 0, 0, 0,239,144, 0, 79,226,
/* 0x00b0 */ 8, 16,141,226, 0,240,157,229, 0, 16,129,224, 62, 64, 45,233,
/* 0x00c0 */ 0, 80,224,227, 2, 65,160,227, 66, 0, 0,234, 26, 0,189,232,
/* 0x00d0 */ 1, 0, 64,224, 3, 32, 66,224, 0, 32,132,229, 0, 64,160,225,
/* 0x00e0 */ 3, 0,160,225, 2, 16,131,224, 0, 32,160,227, 7,192,160,225,
/* 0x00f0 */ 2,112,160,227, 15,120,135,227, 0, 0, 0,239, 12,112,160,225,
/* 0x0100 */ 4, 0,160,225, 48,128,189,232, 4, 64,148,224, 14,240,160, 17,
/* 0x0110 */ 1, 64,208,228, 4, 64,164,224, 4, 76,176,225, 14,240,160,225,
/* 0x0120 */ 1, 16,160,227, 14,192,160,225, 51, 0, 0,235, 1, 16,177,224,
/* 0x0130 */ 51, 0, 0,235, 59, 0, 0, 58, 12,240,160,225, 1, 48,208,228,
/* 0x0140 */ 1, 48,194,228, 51, 0, 0,235, 64, 0, 0, 42, 57, 0, 0,235,
/* 0x0150 */ 3, 48, 81,226, 0, 16,160,227, 76, 0, 0, 58, 1, 80,208,228,
/* 0x0160 */ 3, 84,133,225, 5, 80,240,225, 36, 0, 0, 10, 51, 0, 0,235,
/* 0x0170 */ 1, 16,177,224, 51, 0, 0,235, 1, 16,177,224, 83, 0, 0, 26,
/* 0x0180 */ 57, 0, 0,235, 2, 16,129,226, 13, 12,117,227, 1, 16,129, 50,
/* 0x0190 */ 5, 48,210,231, 1, 16, 81,226, 1, 48,194,228, 85, 0, 0, 42,
/* 0x01a0 */ 66, 0, 0,234, 3, 0, 0,235, 0, 46,115,121,109,116, 97, 98,
/* 0x01b0 */ 0, 46,115,116,114,116, 97, 98, 0, 46,115,104,115,116,114,116,
/* 0x01c0 */ 97, 98, 0, 46,114,101,108, 69, 76, 70, 77, 65, 73, 78, 88, 0,
/* 0x01d0 */ 46,114,101,108, 69, 76, 70, 77, 65, 73, 78, 90, 0, 0, 0, 0,
/* 0x01e0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x01f0 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0200 */ 0, 0, 0, 0, 0, 0, 0, 0, 31, 0, 0, 0, 1, 0, 0, 0,
/* 0x0210 */ 6, 0, 0, 0, 0, 0, 0, 0, 52, 0, 0, 0,112, 1, 0, 0,
/* 0x0220 */ 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
/* 0x0230 */ 27, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0240 */ 144, 3, 0, 0,144, 0, 0, 0, 6, 0, 0, 0, 1, 0, 0, 0,
/* 0x0250 */ 4, 0, 0, 0, 8, 0, 0, 0, 44, 0, 0, 0, 1, 0, 0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,115,116, 97,114,116, 0,117, 99,108, 95,110,114,118, 50,
/* 0x0380 */ 98, 95,100,101, 99,111,109,112,114,101,115,115, 95, 56, 0, 0,
/* 0x0390 */ 16, 0, 0, 0, 1, 2, 0, 0, 64, 0, 0, 0, 1, 1, 0, 0,
/* 0x03a0 */ 96, 0, 0, 0, 1, 1, 0, 0,148, 0, 0, 0, 1, 1, 0, 0,
/* 0x03b0 */ 244, 0, 0, 0, 1, 1, 0, 0,252, 0, 0, 0, 1, 1, 0, 0,
/* 0x03c0 */ 0, 1, 0, 0, 1, 1, 0, 0, 16, 1, 0, 0, 1, 1, 0, 0,
/* 0x03d0 */ 20, 1, 0, 0, 1, 1, 0, 0, 24, 1, 0, 0, 1, 1, 0, 0,
/* 0x03e0 */ 36, 1, 0, 0, 1, 1, 0, 0, 52, 1, 0, 0, 1, 1, 0, 0,
/* 0x03f0 */ 56, 1, 0, 0, 1, 1, 0, 0, 64, 1, 0, 0, 1, 1, 0, 0,
/* 0x0400 */ 72, 1, 0, 0, 1, 1, 0, 0, 76, 1, 0, 0, 1, 1, 0, 0,
/* 0x0410 */ 104, 1, 0, 0, 1, 1, 0, 0,108, 1, 0, 0, 1, 1, 0, 0,
/* 0x0420 */ 0, 0, 0, 0, 1, 1, 0, 0,102,105,108,101, 32,102,111,114,
/* 0x0430 */ 109, 97,116, 32,101,108,102, 51, 50, 45,108,105,116,116,108,101,
/* 0x0440 */ 97,114,109, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,
/* 0x0450 */ 100,120, 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0460 */ 32, 83,105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32,
/* 0x0470 */ 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, 32, 32, 32, 32, 32, 70,
/* 0x0480 */ 105,108,101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,
/* 0x0490 */ 108, 97,103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78,
/* 0x04a0 */ 88, 32, 32, 32, 32, 32, 32, 48, 49, 55, 48, 32, 32, 48, 32, 32,
/* 0x04b0 */ 48, 32, 32, 48, 51, 52, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79,
/* 0x04c0 */ 78, 84, 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77, 65,
/* 0x04d0 */ 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 52, 32, 32, 48, 32, 32,
/* 0x04e0 */ 48, 32, 32, 48, 49, 97, 52, 32, 32, 50, 42, 42, 50, 32, 32, 67,
/* 0x04f0 */ 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, 84,
/* 0x0500 */ 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 32,108,
/* 0x0510 */ 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32,
/* 0x0520 */ 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48,
/* 0x0530 */ 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77,
/* 0x0540 */ 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10,
/* 0x0550 */ 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 70,
/* 0x0560 */ 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 95,115,116, 97,
/* 0x0570 */ 114,116, 10, 48, 48, 48, 48, 48, 48, 56, 52, 32,103, 32, 32, 32,
/* 0x0580 */ 32, 32, 70, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48,101, 99,
/* 0x0590 */ 32,117, 99,108, 95,110,114,118, 50, 98, 95,100,101, 99,111,109,
/* 0x05a0 */ 112,114,101,115,115, 95, 56, 10, 10, 82, 69, 76, 79, 67, 65, 84,
/* 0x05b0 */ 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32,
/* 0x05c0 */ 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, 83,
/* 0x05d0 */ 69, 84, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32,
/* 0x05e0 */ 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48,
/* 0x05f0 */ 48, 48, 48, 49, 48, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52,
/* 0x0600 */ 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90,
/* 0x0610 */ 10, 48, 48, 48, 48, 48, 48, 52, 48, 32, 82, 95, 65, 82, 77, 95,
/* 0x0620 */ 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x0630 */ 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 54, 48, 32, 82, 95,
/* 0x0640 */ 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0650 */ 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 57,
/* 0x0660 */ 52, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32,
/* 0x0670 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
/* 0x0680 */ 48, 48, 48,102, 52, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52,
/* 0x0690 */ 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x06a0 */ 10, 48, 48, 48, 48, 48, 48,102, 99, 32, 82, 95, 65, 82, 77, 95,
/* 0x06b0 */ 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x06c0 */ 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 48, 48, 32, 82, 95,
/* 0x06d0 */ 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x06e0 */ 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 49,
/* 0x06f0 */ 48, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32,
/* 0x0700 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
/* 0x0710 */ 48, 48, 49, 49, 52, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52,
/* 0x0720 */ 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x0730 */ 10, 48, 48, 48, 48, 48, 49, 49, 56, 32, 82, 95, 65, 82, 77, 95,
/* 0x0740 */ 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x0750 */ 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 50, 52, 32, 82, 95,
/* 0x0760 */ 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0770 */ 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 51,
/* 0x0780 */ 52, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32,
/* 0x0790 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
/* 0x07a0 */ 48, 48, 49, 51, 56, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52,
/* 0x07b0 */ 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x07c0 */ 10, 48, 48, 48, 48, 48, 49, 52, 48, 32, 82, 95, 65, 82, 77, 95,
/* 0x07d0 */ 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x07e0 */ 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 52, 56, 32, 82, 95,
/* 0x07f0 */ 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0800 */ 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 49, 52,
/* 0x0810 */ 99, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32, 32,
/* 0x0820 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48,
/* 0x0830 */ 48, 48, 49, 54, 56, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52,
/* 0x0840 */ 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88,
/* 0x0850 */ 10, 48, 48, 48, 48, 48, 49, 54, 99, 32, 82, 95, 65, 82, 77, 95,
/* 0x0860 */ 80, 67, 50, 52, 32, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77,
/* 0x0870 */ 65, 73, 78, 88, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78,
/* 0x0880 */ 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76,
/* 0x0890 */ 70, 77, 65, 73, 78, 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32,
/* 0x08a0 */ 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x08b0 */ 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48,
/* 0x08c0 */ 48, 48, 32, 82, 95, 65, 82, 77, 95, 80, 67, 50, 52, 32, 32, 32,
/* 0x08d0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10
};