diff --git a/src/stub/Makefile b/src/stub/Makefile index cde65685..d636e4e6 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -77,6 +77,8 @@ STUBS += armeb.v4a-linux.elf-entry.h STUBS += armeb.v4a-linux.elf-fold.h STUBS += armeb.v5a-linux.kernel.vmlinux-head.h STUBS += armeb.v5a-linux.kernel.vmlinux.h +STUBS += arm64-linux.elf-entry.h +STUBS += arm64-linux.elf-fold.h STUBS += arm64-darwin.macho-entry.h STUBS += arm64-darwin.macho-fold.h STUBS += i086-dos16.com.h @@ -532,6 +534,47 @@ tmp/armel-linux.elf-main.o : $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-ma $(call tc,f-objstrip,$@) +# /*********************************************************************** +# // arm64-linux.elf (arm64) +# ************************************************************************/ + +arm64-linux.elf%.h : tc_list = arm64-linux.elf default +arm64-linux.elf%.h : tc_bfdname = elf64-littleaarch64 + +tc.arm64-linux.elf.gcc = /usr/bin/aarch64-linux-gnu-gcc -nostdinc -MMD -MT $@ +tc.arm64-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables +tc.arm64-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror + +tc.arm64-linux.elf-fold.ld = /usr/bin/aarch64-linux-gnu-ld + +tc.arm64-linux.elf-entry.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 +tc.arm64-linux.elf-fold.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 +tc.arm64-linux.elf-main.objcopy = /usr/bin/aarch64-linux-gnu-objcopy -F elf64-littleaarch64 + +tc.arm64-linux.elf-entry.objdump = /usr/bin/aarch64-linux-gnu-objdump +tc.arm64-linux.elf-fold.objdump = /usr/bin/aarch64-linux-gnu-objdump +tc.arm64-linux.elf-main.objdump = /usr/bin/aarch64-linux-gnu-objdump + +arm64-linux.elf-entry.h : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o tmp/$T.bin + $(call tc,f-embed_objinfo,tmp/$T.bin) + $(call tc,bin2h) tmp/$T.bin $@ + +arm64-linux.elf-fold.h : tmp/$$T.o tmp/arm64-linux.elf-main.o $(srcdir)/src/arm64-linux.elf-fold.lds + $(call tc,ld) --strip-all -T $(srcdir)/src/arm64-linux.elf-fold.lds -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin + $(call tc,f-objstrip,tmp/$T.bin) + $(call tc,sstrip) tmp/$T.bin + $(call tc,bin2h) tmp/$T.bin $@ + +tmp/arm64-linux.elf-fold.o : $(srcdir)/src/$$T.S + $(call tc,gcc) -c $< -o $@ + $(call tc,f-objstrip,$@) + +tmp/arm64-linux.elf-main.o : $(srcdir)/src/$$T.c $(srcdir)/src/arm64-linux.elf-main.c + $(call tc,gcc) -c -Os $< -o $@ + $(call tc,f-objstrip,$@) + + # /*********************************************************************** # // arm.v5a-linux.shlib (arm.v5a) # ************************************************************************/ diff --git a/src/stub/arm64-darwin.macho-entry.h b/src/stub/arm64-darwin.macho-entry.h index a89f0072..9f35d0a0 100644 --- a/src/stub/arm64-darwin.macho-entry.h +++ b/src/stub/arm64-darwin.macho-entry.h @@ -32,8 +32,8 @@ #define STUB_ARM64_DARWIN_MACHO_ENTRY_SIZE 4261 -#define STUB_ARM64_DARWIN_MACHO_ENTRY_ADLER32 0x23e0ad20 -#define STUB_ARM64_DARWIN_MACHO_ENTRY_CRC32 0xf305c3e9 +#define STUB_ARM64_DARWIN_MACHO_ENTRY_ADLER32 0x08eeac06 +#define STUB_ARM64_DARWIN_MACHO_ENTRY_CRC32 0xce42313b unsigned char stub_arm64_darwin_macho_entry[4261] = { /* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -48,8 +48,8 @@ unsigned char stub_arm64_darwin_macho_entry[4261] = { /* 0x0090 */ 5, 0,128, 18, 4, 0,176, 82, 29, 0, 0, 20,227, 19,193,168, /* 0x00a0 */ 0, 0, 7,203, 66, 0, 3,203,130, 0, 0,185,228, 3, 0,170, /* 0x00b0 */ 224, 3, 3,170,225, 3, 2,170,224, 7,191,169, 35, 0,128, 82, -/* 0x00c0 */ 8, 0,176, 82, 0, 16, 32,212,224, 7,193,168, 3, 0,128, 82, -/* 0x00d0 */ 8, 0,176, 82, 0, 16, 32,212,224, 3, 4,170,254,135, 64,248, +/* 0x00c0 */ 8, 0,176, 82, 1, 0, 0,212,224, 7,193,168, 3, 0,128, 82, +/* 0x00d0 */ 8, 0,176, 82, 1, 0, 0,212,224, 3, 4,170,254,135, 64,248, /* 0x00e0 */ 192, 3, 95,214,132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, /* 0x00f0 */ 4, 20, 64, 56,132, 0, 4, 58,132, 32, 9, 83,132, 0, 4, 43, /* 0x0100 */ 192, 3, 95,214, 3, 20, 64, 56, 67, 20, 0, 56,246,255,255,151, @@ -68,8 +68,8 @@ unsigned char stub_arm64_darwin_macho_entry[4261] = { /* 0x01d0 */ 4, 0,176, 82, 29, 0, 0, 20,227, 19,193,168, 0, 0, 7,203, /* 0x01e0 */ 66, 0, 3,203,130, 0, 0,185,228, 3, 0,170,224, 3, 3,170, /* 0x01f0 */ 225, 3, 2,170,224, 7,191,169, 35, 0,128, 82, 8, 0,176, 82, -/* 0x0200 */ 0, 16, 32,212,224, 7,193,168, 3, 0,128, 82, 8, 0,176, 82, -/* 0x0210 */ 0, 16, 32,212,224, 3, 4,170,254,135, 64,248,192, 3, 95,214, +/* 0x0200 */ 1, 0, 0,212,224, 7,193,168, 3, 0,128, 82, 8, 0,176, 82, +/* 0x0210 */ 1, 0, 0,212,224, 3, 4,170,254,135, 64,248,192, 3, 95,214, /* 0x0220 */ 132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, 4, 20, 64, 56, /* 0x0230 */ 132, 0, 4, 58,132, 32, 9, 83,132, 0, 4, 43,192, 3, 95,214, /* 0x0240 */ 3, 20, 64, 56, 67, 20, 0, 56,246,255,255,151,162,255,255, 84, @@ -87,8 +87,8 @@ unsigned char stub_arm64_darwin_macho_entry[4261] = { /* 0x0300 */ 4, 0,176, 82, 37, 0, 0, 20,228, 11, 64,249,225,143,193,168, /* 0x0310 */ 0, 0, 1,203, 66, 0, 3,203,130, 0, 0,185,228, 3, 0,170, /* 0x0320 */ 224, 3, 3,170,225, 3, 2,170,224, 7,191,169, 35, 0,128, 82, -/* 0x0330 */ 8, 0,176, 82, 0, 16, 32,212,224, 7,193,168, 3, 0,128, 82, -/* 0x0340 */ 8, 0,176, 82, 0, 16, 32,212,224, 3, 4,170,254,135, 64,248, +/* 0x0330 */ 8, 0,176, 82, 1, 0, 0,212,224, 7,193,168, 3, 0,128, 82, +/* 0x0340 */ 8, 0,176, 82, 1, 0, 0,212,224, 3, 4,170,254,135, 64,248, /* 0x0350 */ 192, 3, 95,214,132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, /* 0x0360 */ 4, 20, 64, 56,132, 0, 4, 26,132, 32, 9, 83,132, 0, 4, 43, /* 0x0370 */ 192, 3, 95,214, 33, 0,128, 82,240, 3, 30,170,246,255,255,151, diff --git a/src/stub/arm64-darwin.macho-fold.h b/src/stub/arm64-darwin.macho-fold.h index 76ebd6ac..e9b005a8 100644 --- a/src/stub/arm64-darwin.macho-fold.h +++ b/src/stub/arm64-darwin.macho-fold.h @@ -32,8 +32,8 @@ #define STUB_ARM64_DARWIN_MACHO_FOLD_SIZE 1960 -#define STUB_ARM64_DARWIN_MACHO_FOLD_ADLER32 0xe297dee4 -#define STUB_ARM64_DARWIN_MACHO_FOLD_CRC32 0xa720f497 +#define STUB_ARM64_DARWIN_MACHO_FOLD_ADLER32 0xbbffdd0e +#define STUB_ARM64_DARWIN_MACHO_FOLD_CRC32 0xd4fc9264 unsigned char stub_arm64_darwin_macho_fold[1960] = { /* 0x0000 */ 97, 1, 64,249,231, 3, 4,145, 96, 65, 33,203, 3, 24, 64,185, @@ -48,16 +48,16 @@ unsigned char stub_arm64_darwin_macho_fold[1960] = { /* 0x0090 */ 67,124, 26, 83,127,148, 0,113,193, 0, 0, 84, 67, 20, 6, 18, /* 0x00a0 */ 66, 0, 1, 75, 66,100, 0, 18, 66, 0, 3, 42, 2, 88, 33,184, /* 0x00b0 */ 63, 0, 0,113,161,254,255, 84,192, 3, 95,214,192, 3, 95,214, -/* 0x00c0 */ 40, 0,128, 82, 0, 16, 32,212,192, 3, 95,214,104, 0,128, 82, -/* 0x00d0 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,136, 0,128, 82, -/* 0x00e0 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,168, 0,128, 82, -/* 0x00f0 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,200, 0,128, 82, -/* 0x0100 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,168, 5,128, 82, -/* 0x0110 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214, 40, 9,128, 82, -/* 0x0120 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214, 72, 9,128, 82, -/* 0x0130 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,168, 24,128, 82, -/* 0x0140 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214, 40, 19,128, 82, -/* 0x0150 */ 0, 16, 32,212,192, 3, 95,214,192, 3, 95,214,233, 31,128, 82, +/* 0x00c0 */ 40, 0,128, 82, 1, 0, 0,212,192, 3, 95,214,104, 0,128, 82, +/* 0x00d0 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,136, 0,128, 82, +/* 0x00e0 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,168, 0,128, 82, +/* 0x00f0 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,200, 0,128, 82, +/* 0x0100 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,168, 5,128, 82, +/* 0x0110 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214, 40, 9,128, 82, +/* 0x0120 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214, 72, 9,128, 82, +/* 0x0130 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,168, 24,128, 82, +/* 0x0140 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214, 40, 19,128, 82, +/* 0x0150 */ 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214,233, 31,128, 82, /* 0x0160 */ 41, 29, 16, 50, 6, 0, 0, 20, 2, 0, 64,185, 35, 1, 2, 10, /* 0x0170 */ 34, 97,194, 10, 66, 32,195, 42, 2, 68, 0,184, 33, 16, 0,113, /* 0x0180 */ 74,255,255, 84,192, 3, 95,214,253,123,191,169, 3, 0,128,210, diff --git a/src/stub/arm64-linux.elf-entry.h b/src/stub/arm64-linux.elf-entry.h new file mode 100644 index 00000000..0515b27f --- /dev/null +++ b/src/stub/arm64-linux.elf-entry.h @@ -0,0 +1,372 @@ +/* arm64-linux.elf-entry.h + created from arm64-linux.elf-entry.bin, 5317 (0x14c5) bytes + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2017 Laszlo Molnar + Copyright (C) 2000-2017 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 + + + John F. Reiser + + */ + + +#define STUB_ARM64_LINUX_ELF_ENTRY_SIZE 5317 +#define STUB_ARM64_LINUX_ELF_ENTRY_ADLER32 0x85fe782d +#define STUB_ARM64_LINUX_ELF_ENTRY_CRC32 0x6307b5a0 + +unsigned char stub_arm64_linux_elf_entry[5317] = { +/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0010 */ 1, 0,183, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 8, 13, 0, 0, 0, 0, 0, 0, +/* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 17, 0, 14, 0, +/* 0x0040 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0050 */ 0, 0, 0, 0, 76,255,255, 16,129, 41, 64, 41,139, 53, 65, 41, +/* 0x0060 */ 130, 9, 64,249,107, 1, 12,139, 74, 1, 12,139, 99, 1, 64,185, +/* 0x0070 */ 137, 1, 1,203, 33, 0, 3, 11,224, 3, 2,170, 33, 4, 64,145, +/* 0x0080 */ 3, 0,128, 82, 3, 0,130, 82,224,135,189,169,226, 15, 1,169, +/* 0x0090 */ 237, 19, 0,249,226, 0,128, 82,163, 1, 28, 50, 5, 0,128,210, +/* 0x00a0 */ 4, 0,128, 18,200, 27,128, 82, 1, 0, 0,212,192, 3, 95,214, +/* 0x00b0 */ 31, 4, 64,177, 2, 0, 0, 84, 33, 9,193,168, 63, 1, 10,235, +/* 0x00c0 */ 1, 8,129,168,163,255,255, 84, 4, 0, 9,203,225, 35, 64,185, +/* 0x00d0 */ 37, 3, 0, 16, 1, 68, 0,184,254, 3, 0,170,165, 0, 4,139, +/* 0x00e0 */ 224, 3, 5,170, 33, 1, 4,139, 2, 0,128,210,232, 31,128, 82, +/* 0x00f0 */ 1, 0, 0,212,192, 3, 95,214,137, 1, 64,185, 41, 33, 3, 81, +/* 0x0100 */ 138, 1, 9,203, 74, 1, 4,139, 96, 9, 64,185,224,123,191,169, +/* 0x0110 */ 99, 1, 64,185, 96, 49, 0,145, 97, 5, 64,185,226, 3, 30,170, +/* 0x0120 */ 227, 35, 0,185,227,131, 0,145,160, 0, 63,214,225,123,193,168, +/* 0x0130 */ 192, 3, 95,214,226,143,190,169,254, 11, 0,249, 7, 64, 33,139, +/* 0x0140 */ 5, 0,128, 18, 4, 0,176, 82, 24, 0, 0, 20,227, 19,193,168, +/* 0x0150 */ 0, 0, 7,203, 66, 0, 3,203,130, 0, 0,185,228, 3, 0,170, +/* 0x0160 */ 224, 3, 3,170, 97, 0, 2,139, 2, 0,128,210,232, 31,128,210, +/* 0x0170 */ 1, 0, 0,212,224, 3, 4,170,254,135, 64,248,192, 3, 95,214, +/* 0x0180 */ 132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, 4, 20, 64, 56, +/* 0x0190 */ 132, 0, 4, 58,132, 32, 9, 83,132, 0, 4, 43,192, 3, 95,214, +/* 0x01a0 */ 3, 20, 64, 56, 67, 20, 0, 56,246,255,255,151,162,255,255, 84, +/* 0x01b0 */ 33, 0,128, 82, 4, 0, 0, 20, 33, 4, 0, 81,241,255,255,151, +/* 0x01c0 */ 33, 0, 1, 26,239,255,255,151, 33, 0, 1, 26,237,255,255,151, +/* 0x01d0 */ 67,255,255, 84, 35, 12, 0,113, 1, 0,128, 82, 35, 1, 0, 84, +/* 0x01e0 */ 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42, 5,251,255, 52, +/* 0x01f0 */ 191, 0, 0,114,165,124, 1, 19,161, 1, 0, 84, 3, 0, 0, 20, +/* 0x0200 */ 224,255,255,151, 66, 1, 0, 84, 33, 0,128, 82,221,255,255,151, +/* 0x0210 */ 226, 0, 0, 84,219,255,255,151, 33, 0, 1, 26,217,255,255,151, +/* 0x0220 */ 163,255,255, 84, 33, 16, 0, 17, 4, 0, 0, 20,213,255,255,151, +/* 0x0230 */ 33, 0, 1, 26, 33, 8, 0, 17,191, 0, 20, 49, 33, 52,129, 26, +/* 0x0240 */ 67,192, 33,139, 99,240, 95, 56, 67,200,101, 56, 67, 20, 0, 56, +/* 0x0250 */ 33, 4, 0,113,161,255,255, 84,212,255,255, 23,226,143,190,169, +/* 0x0260 */ 254, 11, 0,249, 7, 64, 33,139, 5, 0,128, 18, 4, 0,176, 82, +/* 0x0270 */ 24, 0, 0, 20,227, 19,193,168, 0, 0, 7,203, 66, 0, 3,203, +/* 0x0280 */ 130, 0, 0,185,228, 3, 0,170,224, 3, 3,170, 97, 0, 2,139, +/* 0x0290 */ 2, 0,128, 82,232, 31,128,210, 1, 0, 0,212,224, 3, 4,170, +/* 0x02a0 */ 254,135, 64,248,192, 3, 95,214,132, 0, 4, 43, 68, 0, 0, 52, +/* 0x02b0 */ 192, 3, 95,214, 4, 20, 64, 56,132, 0, 4, 58,132, 32, 9, 83, +/* 0x02c0 */ 132, 0, 4, 43,192, 3, 95,214, 3, 20, 64, 56, 67, 20, 0, 56, +/* 0x02d0 */ 246,255,255,151,162,255,255, 84, 33, 0,128, 82, 4, 0, 0, 20, +/* 0x02e0 */ 33, 4, 0, 81,241,255,255,151, 33, 0, 1, 58,239,255,255,151, +/* 0x02f0 */ 33, 0, 1, 58,237,255,255,151, 67,255,255, 84, 35, 12, 0,113, +/* 0x0300 */ 1, 0,128, 82, 35, 1, 0, 84, 5, 20, 64, 56,165, 32, 3, 42, +/* 0x0310 */ 229, 3, 37, 42, 5,251,255, 52,163, 0, 1, 83,165,124, 1, 83, +/* 0x0320 */ 99, 0, 3, 43, 2, 0, 0, 20,224,255,255,151, 33, 0, 1, 58, +/* 0x0330 */ 222,255,255,151, 33, 0, 1, 58,225, 0, 0, 84, 33, 0,128, 82, +/* 0x0340 */ 218,255,255,151, 33, 0, 1, 58,216,255,255,151,163,255,255, 84, +/* 0x0350 */ 33, 8, 0, 17, 33, 4, 0, 17,191, 0, 20, 49, 33, 52,129, 26, +/* 0x0360 */ 67, 0, 64, 57, 67,200,101, 56, 67, 20, 0, 56, 33, 4, 0,113, +/* 0x0370 */ 161,255,255, 84,215,255,255, 23, 1, 64, 33,139,225, 11,190,169, +/* 0x0380 */ 227,123, 1,169, 5, 0,128, 18, 4, 0,176, 82, 31, 0, 0, 20, +/* 0x0390 */ 228, 11, 64,249,225,143,193,168, 0, 0, 1,203, 66, 0, 3,203, +/* 0x03a0 */ 130, 0, 0,185,228, 3, 0,170,224, 3, 3,170, 97, 0, 2,139, +/* 0x03b0 */ 2, 0,128, 82,232, 31,128,210, 1, 0, 0,212,254,135, 64,248, +/* 0x03c0 */ 192, 3, 95,214,132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, +/* 0x03d0 */ 4, 20, 64, 56,132, 0, 4, 26,132, 32, 9, 83,132, 0, 4, 43, +/* 0x03e0 */ 192, 3, 95,214, 33, 0,128, 82,240, 3, 30,170,246,255,255,151, +/* 0x03f0 */ 33, 0, 1, 58,244,255,255,151,163,255,255, 84, 0, 2, 31,214, +/* 0x0400 */ 3, 20, 64, 56, 67, 20, 0, 56,239,255,255,151,162,255,255, 84, +/* 0x0410 */ 245,255,255,151, 35, 12, 0,113, 1, 0,128, 82,163, 0, 0, 84, +/* 0x0420 */ 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42, 37,251,255, 52, +/* 0x0430 */ 229,255,255,151, 33, 0, 1, 58,227,255,255,151, 33, 0, 1, 58, +/* 0x0440 */ 97, 0, 0, 84,232,255,255,151, 33, 8, 0, 17,191, 0, 52, 49, +/* 0x0450 */ 33, 36,129, 26, 67,200,101, 56, 33, 4, 0,113, 67, 20, 0, 56, +/* 0x0460 */ 162,255,255, 84,233,255,255, 23,230,123,191,169,227,147,190,169, +/* 0x0470 */ 229, 11, 0,249,232, 3, 1,170, 45, 64, 34,139,233, 3, 4,170, +/* 0x0480 */ 142, 64, 37,139,235, 3, 0,170, 6, 21, 64, 56,160, 5,128, 82, +/* 0x0490 */ 196, 8,192, 26, 0,124, 4, 27,198, 0, 0, 75, 32, 1,128, 82, +/* 0x04a0 */ 197, 8,192, 26, 0,124, 5, 27,198, 0, 0, 75,174, 0, 6, 11, +/* 0x04b0 */ 7, 0,128, 18,229, 32,197, 26,229, 3, 37, 42,228, 32,196, 26, +/* 0x04c0 */ 228, 3, 36, 42, 35, 0,128, 82, 34, 0,128, 82, 33, 0,128, 82, +/* 0x04d0 */ 32, 0,128, 82, 6, 0,128, 82,230, 31, 0,185, 2, 96,128, 82, +/* 0x04e0 */ 192,230,128, 82, 66, 32,206, 26, 66, 0, 0, 11, 0,128,128,210, +/* 0x04f0 */ 225, 3, 11,170, 0, 64, 0,170, 0,128, 0,170, 32,132, 0,248, +/* 0x0500 */ 66, 16, 0,113,204,255,255, 84, 0, 21, 0,145,231, 0, 0,148, +/* 0x0510 */ 31, 0, 8,235,193,255,255, 84,227, 67, 66,248,226, 19, 64,185, +/* 0x0520 */ 36, 1, 3,203,128, 0, 2, 10,224, 47, 0,185, 0, 16, 6, 11, +/* 0x0530 */ 97, 1, 0,145,225, 0, 0,148,129, 5, 0, 84,227, 23, 64,185, +/* 0x0540 */ 226, 27, 64,185, 99, 0, 4, 10,224,115, 64, 57, 99, 32,194, 26, +/* 0x0550 */ 226, 3, 2, 75, 66, 32, 0, 17, 2, 36,194, 26, 99, 0, 2, 11, +/* 0x0560 */ 106,177, 57,145, 99, 4, 3, 11,227, 3, 3, 42, 32, 0,128, 82, +/* 0x0570 */ 74, 37, 3,139,223, 28, 0,113, 3, 2, 0, 84,227,125, 64,147, +/* 0x0580 */ 227, 3, 3,203, 37,105, 99, 56,165,120, 31, 83, 65, 1, 8,145, +/* 0x0590 */ 164, 0, 24, 18,227, 3, 4, 42, 33, 4, 3,139,201, 0, 0,148, +/* 0x05a0 */ 3, 0, 0, 18,127, 32, 68,107,193, 0, 0, 84, 31, 0, 4,113, +/* 0x05b0 */ 195,254,255, 84, 5, 0, 0, 20,225, 3, 10,170,193, 0, 0,148, +/* 0x05c0 */ 31, 0, 4,113,163,255,255, 84, 98, 0,128, 82,195, 0,128, 82, +/* 0x05d0 */ 223, 40, 0,113, 67, 48,131, 26,223, 16, 0,113,195, 48,131, 26, +/* 0x05e0 */ 198, 0, 3, 75, 34, 0, 0, 20, 97, 1, 6,145,178, 0, 0,148, +/* 0x05f0 */ 129, 1, 0, 84,227, 11, 64,185,226, 7, 64,185,227, 15, 0,185, +/* 0x0600 */ 226, 11, 0,185,239, 7, 0,185, 3, 0,128, 82,223, 28, 0,113, +/* 0x0610 */ 102, 0,128, 82,102, 48,134, 26,106,145, 25,145, 42, 0, 0, 20, +/* 0x0620 */ 97, 97, 6,145,164, 0, 0,148, 97, 2, 0, 84,227, 47, 64,185, +/* 0x0630 */ 97,129, 7,145, 96, 16, 6, 11,160, 0, 0,148,161, 3, 0, 84, +/* 0x0640 */ 35, 1,128, 82,223, 28, 0,113,102, 1,128, 82,102, 48,134, 26, +/* 0x0650 */ 227, 67, 66,248, 36, 1, 3,203,159, 0, 15,107,131, 17, 0, 84, +/* 0x0660 */ 227,125, 64,147,227, 3, 3,203, 32,105, 99, 56, 32, 21, 0, 56, +/* 0x0670 */ 121, 0, 0, 20, 97,193, 6,145,143, 0, 0,148,228, 7, 64,185, +/* 0x0680 */ 64, 1, 0, 84, 97, 33, 7,145,139, 0, 0,148,228, 11, 64,185, +/* 0x0690 */ 128, 0, 0, 84,227, 11, 64,185,228, 15, 64,185,227, 15, 0,185, +/* 0x06a0 */ 227, 7, 64,185,227, 11, 0,185,239, 7, 0,185,239, 3, 4, 42, +/* 0x06b0 */ 3, 1,128, 82,223, 28, 0,113,102, 1,128, 82,102, 48,134, 26, +/* 0x06c0 */ 106,161, 41,145, 65, 1, 0,145,125, 0, 0,148, 1, 1, 0, 84, +/* 0x06d0 */ 227, 47, 64,185, 69, 17, 0,145,227, 3, 3, 42, 2, 0,128, 82, +/* 0x06e0 */ 165, 16, 3,139, 4, 1,128, 82, 14, 0, 0, 20, 65, 9, 0,145, +/* 0x06f0 */ 115, 0, 0,148, 1, 1, 0, 84,227, 47, 64,185, 69, 17, 4,145, +/* 0x0700 */ 227, 3, 3, 42, 2, 1,128, 82,165, 16, 3,139, 4, 1,128, 82, +/* 0x0710 */ 4, 0, 0, 20, 69, 17, 8,145, 2, 2,128, 82, 4, 32,128, 82, +/* 0x0720 */ 226, 55, 0,185, 32, 0,128, 82,225, 3, 5,170,101, 0, 0,148, +/* 0x0730 */ 3, 0, 4,107,163,255,255, 84,229, 55, 64,185,165, 0, 3, 11, +/* 0x0740 */ 229, 55, 0,185,223, 16, 0,113,194, 6, 0, 84,198, 28, 0, 17, +/* 0x0750 */ 99, 0,128, 82,191, 16, 0,113,101, 32,133, 26,227, 3, 5, 42, +/* 0x0760 */ 101, 29, 3,139,165,128, 13,145, 32, 0,128, 82, 4, 8,128, 82, +/* 0x0770 */ 225, 3, 5,170, 83, 0, 0,148, 3, 0, 4,107,163,255,255, 84, +/* 0x0780 */ 227, 47, 0,185,127, 16, 0,113, 99, 4, 0, 84,100,124, 1, 83, +/* 0x0790 */ 132, 4, 0, 81,111, 0, 0, 18,239, 1, 31, 50,127, 56, 0,113, +/* 0x07a0 */ 226, 0, 0, 84,239, 33,196, 26,106,121, 21,145,227, 1, 3, 75, +/* 0x07b0 */ 227, 3, 3, 42, 74, 5, 3,139, 12, 0, 0, 20,132, 16, 0, 81, +/* 0x07c0 */ 53, 0, 0,148,231,124, 1, 83,131, 1, 7,107,108, 32,140, 26, +/* 0x07d0 */ 239, 1, 15, 26,132, 4, 0,113, 65,255,255, 84,106, 17, 25,145, +/* 0x07e0 */ 239,109, 28, 83,132, 0,128, 82, 37, 0,128, 82, 32, 0,128, 82, +/* 0x07f0 */ 225, 3, 10,170, 51, 0, 0,148, 31, 0, 0,114, 64, 0, 0, 84, +/* 0x0800 */ 239, 1, 5, 42,165,120, 31, 83,132, 4, 0,113, 33,255,255, 84, +/* 0x0810 */ 2, 0, 0, 20,239, 47, 64,185,239, 5, 0, 49,229, 55, 64,185, +/* 0x0820 */ 227, 67, 66,248,165, 8, 0, 17, 35, 1, 3,203,255, 1, 3,107, +/* 0x0830 */ 232, 2, 0, 84,227,125, 64,147,227, 3, 3,203, 32,105, 99, 56, +/* 0x0840 */ 32, 21, 0, 56, 63, 1, 14,235,194, 0, 0, 84,165, 4, 0,113, +/* 0x0850 */ 97,255,255, 84,224,115, 0, 57, 63, 1, 14,235,227,229,255, 84, +/* 0x0860 */ 13, 0, 0,148, 0, 0,128, 82,226, 19, 64,249, 3, 1, 2,203, +/* 0x0870 */ 226, 31, 64,249, 67, 0, 0,185,226, 67, 66,248, 35, 1, 2,203, +/* 0x0880 */ 226, 55, 64,249, 67, 0, 0,185,255,243, 0,145, 32, 0,128, 82, +/* 0x0890 */ 246,255,255, 23,227,124, 24, 83,195, 0, 0, 53, 31, 1, 13,235, +/* 0x08a0 */ 231, 92, 24, 83, 66,255,255, 84, 3, 21, 64, 56,108, 32, 12, 42, +/* 0x08b0 */ 192, 3, 95,214,224, 3, 6, 42, 33, 68, 32,139, 0, 0,128, 82, +/* 0x08c0 */ 33, 68, 32,139,227,124, 24, 83,241, 3, 30,170, 94, 0, 0, 16, +/* 0x08d0 */ 99,254,255, 52, 35, 0, 64,121,226,124, 11, 83, 98,124, 2, 27, +/* 0x08e0 */ 159, 1, 2,107, 2, 1, 0, 84, 2, 0,129, 82,231, 3, 2, 42, +/* 0x08f0 */ 66, 0, 3, 75, 0, 0, 0, 58, 99, 20, 66, 11, 35, 0, 0,121, +/* 0x0900 */ 32, 2, 95,214,140, 1, 2, 75,231, 0, 2, 75, 99, 20, 67, 75, +/* 0x0910 */ 0, 0, 0, 58, 35, 0, 0,121, 32, 2, 95,214,194, 3,128, 82, +/* 0x0920 */ 33, 1, 0, 16, 64, 0,128, 82, 8, 8,128, 82, 1, 0, 0,212, +/* 0x0930 */ 192, 3, 95,214,224, 15,128, 82,168, 11,128, 82, 1, 0, 0,212, +/* 0x0940 */ 192, 3, 95,214, 80, 82, 79, 84, 95, 69, 88, 69, 67,124, 80, 82, +/* 0x0950 */ 79, 84, 95, 87, 82, 73, 84, 69, 32,102, 97,105,108,101,100, 46, +/* 0x0960 */ 10, 0,102,105,108,101, 32,102,111,114,109, 97,116, 32,101,108, +/* 0x0970 */ 102, 54, 52, 45,108,105,116,116,108,101, 97, 97,114, 99,104, 54, +/* 0x0980 */ 52, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120, +/* 0x0990 */ 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83, +/* 0x09a0 */ 105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, +/* 0x09b0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, +/* 0x09c0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70,105,108, +/* 0x09d0 */ 101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97, +/* 0x09e0 */ 103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, +/* 0x09f0 */ 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 52, 48, 32, 32, 48, +/* 0x0a00 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, +/* 0x0a10 */ 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0a20 */ 48, 32, 32, 48, 48, 48, 48, 48, 48, 52, 48, 32, 32, 50, 42, 42, +/* 0x0a30 */ 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 76, +/* 0x0a40 */ 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 49, +/* 0x0a50 */ 32, 76, 85, 78, 77, 80, 48, 48, 48, 32, 32, 32, 32, 32, 32, 48, +/* 0x0a60 */ 48, 48, 48, 48, 48, 48, 52, 32, 32, 48, 48, 48, 48, 48, 48, 48, +/* 0x0a70 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, +/* 0x0a80 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, +/* 0x0a90 */ 48, 48, 48, 56, 48, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, +/* 0x0aa0 */ 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, +/* 0x0ab0 */ 32, 32, 50, 32, 76, 85, 78, 77, 80, 48, 48, 49, 32, 32, 32, 32, +/* 0x0ac0 */ 32, 32, 48, 48, 48, 48, 48, 48, 48, 52, 32, 32, 48, 48, 48, 48, +/* 0x0ad0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, +/* 0x0ae0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, +/* 0x0af0 */ 48, 48, 48, 48, 48, 48, 56, 52, 32, 32, 50, 42, 42, 50, 32, 32, +/* 0x0b00 */ 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, +/* 0x0b10 */ 76, 89, 10, 32, 32, 51, 32, 69, 76, 70, 77, 65, 73, 78, 88,117, +/* 0x0b20 */ 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 48, 97, 99, 32, 32, 48, +/* 0x0b30 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, +/* 0x0b40 */ 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0b50 */ 48, 32, 32, 48, 48, 48, 48, 48, 48, 56, 56, 32, 32, 50, 42, 42, +/* 0x0b60 */ 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 76, +/* 0x0b70 */ 79, 67, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 52, +/* 0x0b80 */ 32, 78, 82, 86, 95, 72, 69, 65, 68, 32, 32, 32, 32, 32, 32, 48, +/* 0x0b90 */ 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, +/* 0x0ba0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, +/* 0x0bb0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, +/* 0x0bc0 */ 48, 48, 49, 51, 52, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, +/* 0x0bd0 */ 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, +/* 0x0be0 */ 32, 32, 53, 32, 78, 82, 86, 95, 84, 65, 73, 76, 32, 32, 32, 32, +/* 0x0bf0 */ 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, +/* 0x0c00 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, +/* 0x0c10 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, +/* 0x0c20 */ 48, 48, 48, 48, 48, 49, 51, 52, 32, 32, 50, 42, 42, 48, 32, 32, +/* 0x0c30 */ 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, +/* 0x0c40 */ 76, 89, 10, 32, 32, 54, 32, 78, 82, 86, 50, 69, 32, 32, 32, 32, +/* 0x0c50 */ 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 49, 50, 56, 32, 32, 48, +/* 0x0c60 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, +/* 0x0c70 */ 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0c80 */ 48, 32, 32, 48, 48, 48, 48, 48, 49, 51, 52, 32, 32, 50, 42, 42, +/* 0x0c90 */ 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, +/* 0x0ca0 */ 68, 79, 78, 76, 89, 10, 32, 32, 55, 32, 78, 82, 86, 50, 68, 32, +/* 0x0cb0 */ 32, 32, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, 49, 49, 99, +/* 0x0cc0 */ 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0cd0 */ 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0ce0 */ 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 50, 53, 99, 32, 32, +/* 0x0cf0 */ 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 44, 32, +/* 0x0d00 */ 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 56, 32, 78, 82, 86, +/* 0x0d10 */ 50, 66, 32, 32, 32, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 48, +/* 0x0d20 */ 53, 97, 52, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0d30 */ 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0d40 */ 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 51, 55, +/* 0x0d50 */ 56, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, +/* 0x0d60 */ 83, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, 32, 57, 32, +/* 0x0d70 */ 69, 76, 70, 77, 65, 73, 78, 89, 32, 32, 32, 32, 32, 32, 48, 48, +/* 0x0d80 */ 48, 48, 48, 48, 52, 54, 32, 32, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0d90 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, 48, +/* 0x0da0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, +/* 0x0db0 */ 48, 57, 49, 99, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, +/* 0x0dc0 */ 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, 76, 89, 10, 32, +/* 0x0dd0 */ 49, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 32, 32, 32, 32, +/* 0x0de0 */ 32, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, 48, 48, +/* 0x0df0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, 48, 48, +/* 0x0e00 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 48, +/* 0x0e10 */ 48, 48, 48, 48, 57, 54, 50, 32, 32, 50, 42, 42, 48, 32, 32, 67, +/* 0x0e20 */ 79, 78, 84, 69, 78, 84, 83, 44, 32, 82, 69, 65, 68, 79, 78, 76, +/* 0x0e30 */ 89, 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58, 10, +/* 0x0e40 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0e50 */ 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, +/* 0x0e60 */ 89, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0e70 */ 48, 48, 32, 69, 76, 70, 77, 65, 73, 78, 89, 10, 48, 48, 48, 48, +/* 0x0e80 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, +/* 0x0e90 */ 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 9, 48, 48, +/* 0x0ea0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 69, +/* 0x0eb0 */ 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0ec0 */ 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, +/* 0x0ed0 */ 32, 76, 85, 78, 77, 80, 48, 48, 48, 9, 48, 48, 48, 48, 48, 48, +/* 0x0ee0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 76, 85, 78, 77, 80, +/* 0x0ef0 */ 48, 48, 48, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0f00 */ 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 76, 85, 78, +/* 0x0f10 */ 77, 80, 48, 48, 49, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0f20 */ 48, 48, 48, 48, 48, 48, 32, 76, 85, 78, 77, 80, 48, 48, 49, 10, +/* 0x0f30 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0f40 */ 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, +/* 0x0f50 */ 88,117, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0f60 */ 48, 48, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88,117, 10, 48, 48, +/* 0x0f70 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, +/* 0x0f80 */ 32, 32, 32, 32,100, 32, 32, 78, 82, 86, 95, 72, 69, 65, 68, 9, +/* 0x0f90 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0fa0 */ 32, 78, 82, 86, 95, 72, 69, 65, 68, 10, 48, 48, 48, 48, 48, 48, +/* 0x0fb0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32, +/* 0x0fc0 */ 100, 32, 32, 78, 82, 86, 95, 84, 65, 73, 76, 9, 48, 48, 48, 48, +/* 0x0fd0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 78, 82, 86, +/* 0x0fe0 */ 95, 84, 65, 73, 76, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x0ff0 */ 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 78, +/* 0x1000 */ 82, 86, 50, 69, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1010 */ 48, 48, 48, 48, 48, 32, 78, 82, 86, 50, 69, 10, 48, 48, 48, 48, +/* 0x1020 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, +/* 0x1030 */ 32, 32,100, 32, 32, 78, 82, 86, 50, 68, 9, 48, 48, 48, 48, 48, +/* 0x1040 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 78, 82, 86, 50, +/* 0x1050 */ 68, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1060 */ 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 78, 82, 86, 50, 66, +/* 0x1070 */ 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1080 */ 48, 32, 78, 82, 86, 50, 66, 10, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1090 */ 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, +/* 0x10a0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 9, 48, 48, 48, 48, 48, 48, +/* 0x10b0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 69, 76, 70, 77, 65, +/* 0x10c0 */ 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x10d0 */ 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, +/* 0x10e0 */ 68, 42, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x10f0 */ 48, 48, 48, 32, 76, 69, 78, 70, 10, 48, 48, 48, 48, 48, 48, 48, +/* 0x1100 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, +/* 0x1110 */ 32, 32, 42, 85, 78, 68, 42, 9, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1120 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 67, 80, 82, 48, 10, 48, 48, +/* 0x1130 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, +/* 0x1140 */ 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 9, 48, 48, 48, +/* 0x1150 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 77, 70, +/* 0x1160 */ 76, 71, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1170 */ 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, +/* 0x1180 */ 42, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1190 */ 48, 48, 32, 65, 68, 82, 77, 10, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x11a0 */ 48, 48, 48, 48, 48, 48, 49, 52, 32,103, 32, 32, 32, 32, 32, 32, +/* 0x11b0 */ 32, 69, 76, 70, 77, 65, 73, 78, 88, 9, 48, 48, 48, 48, 48, 48, +/* 0x11c0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 95,115,116, 97,114, +/* 0x11d0 */ 116, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x11e0 */ 48, 48, 32,103, 32, 32, 32, 32, 32, 70, 32, 78, 82, 86, 50, 69, +/* 0x11f0 */ 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 50, +/* 0x1200 */ 56, 32,117, 99,108, 95,110,114,118, 50,101, 95,100,101, 99,111, +/* 0x1210 */ 109,112,114,101,115,115, 95, 56, 10, 48, 48, 48, 48, 48, 48, 48, +/* 0x1220 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, +/* 0x1230 */ 70, 32, 78, 82, 86, 50, 68, 9, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1240 */ 48, 48, 48, 48, 48, 49, 49, 99, 32,117, 99,108, 95,110,114,118, +/* 0x1250 */ 50,100, 95,100,101, 99,111,109,112,114,101,115,115, 95, 56, 10, +/* 0x1260 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1270 */ 32,103, 32, 32, 32, 32, 32, 70, 32, 78, 82, 86, 50, 66, 9, 48, +/* 0x1280 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,102, 48, 32, +/* 0x1290 */ 117, 99,108, 95,110,114,118, 50, 98, 95,100,101, 99,111,109,112, +/* 0x12a0 */ 114,101,115,115, 95, 56, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x12b0 */ 48, 48, 48, 48, 48,102, 48, 32,103, 32, 32, 32, 32, 32, 32, 32, +/* 0x12c0 */ 78, 82, 86, 50, 66, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x12d0 */ 48, 48, 48, 48, 48, 48, 32, 76,122,109, 97, 68,101, 99,111,100, +/* 0x12e0 */ 101, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x12f0 */ 48, 48, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, +/* 0x1300 */ 73, 78, 89, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1310 */ 48, 48, 48, 48, 32,101,110,100, 95,100,101, 99,111,109,112,114, +/* 0x1320 */ 101,115,115, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1330 */ 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, +/* 0x1340 */ 77, 65, 73, 78, 90, 9, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1350 */ 48, 48, 48, 48, 48, 48, 32, 99,112,114, 48, 10, 10, 82, 69, 76, +/* 0x1360 */ 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, +/* 0x1370 */ 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, +/* 0x1380 */ 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +/* 0x1390 */ 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +/* 0x13a0 */ 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, +/* 0x13b0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 65, 65, 82, 67, +/* 0x13c0 */ 72, 54, 52, 95, 65, 66, 83, 51, 50, 32, 32, 32, 76, 69, 78, 70, +/* 0x13d0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x13e0 */ 52, 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, 95, 65, 66, 83, 51, +/* 0x13f0 */ 50, 32, 32, 32, 67, 80, 82, 48, 10, 48, 48, 48, 48, 48, 48, 48, +/* 0x1400 */ 48, 48, 48, 48, 48, 48, 48, 48, 56, 32, 82, 95, 65, 65, 82, 67, +/* 0x1410 */ 72, 54, 52, 95, 65, 66, 83, 51, 50, 32, 32, 32, 77, 70, 76, 71, +/* 0x1420 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x1430 */ 99, 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, 95, 65, 66, 83, 54, +/* 0x1440 */ 52, 32, 32, 32, 65, 68, 82, 77, 10, 10, 82, 69, 76, 79, 67, 65, +/* 0x1450 */ 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, +/* 0x1460 */ 32, 91, 69, 76, 70, 77, 65, 73, 78, 88,117, 93, 58, 10, 79, 70, +/* 0x1470 */ 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, +/* 0x1480 */ 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, +/* 0x1490 */ 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, +/* 0x14a0 */ 48, 48, 48, 48, 48, 50, 99, 32, 82, 95, 65, 65, 82, 67, 72, 54, +/* 0x14b0 */ 52, 95, 67, 79, 78, 68, 66, 82, 49, 57, 32, 32, 69, 76, 70, 77, +/* 0x14c0 */ 65, 73, 78, 89, 10 +}; diff --git a/src/stub/arm64-linux.elf-fold.h b/src/stub/arm64-linux.elf-fold.h new file mode 100644 index 00000000..b9734d8c --- /dev/null +++ b/src/stub/arm64-linux.elf-fold.h @@ -0,0 +1,189 @@ +/* arm64-linux.elf-fold.h + created from arm64-linux.elf-fold.bin, 2400 (0x960) bytes + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2017 Laszlo Molnar + Copyright (C) 2000-2017 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 + + + John F. Reiser + + */ + + +#define STUB_ARM64_LINUX_ELF_FOLD_SIZE 2400 +#define STUB_ARM64_LINUX_ELF_FOLD_ADLER32 0x14516166 +#define STUB_ARM64_LINUX_ELF_FOLD_CRC32 0x405ee243 + +unsigned char stub_arm64_linux_elf_fold[2400] = { +/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0010 */ 2, 0,183, 0, 1, 0, 0, 0,188, 0, 16, 0, 0, 0, 0, 0, +/* 0x0020 */ 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0030 */ 0, 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 */ 96, 9, 0, 0, 0, 0, 0, 0, 96, 9, 0, 0, 0, 0, 0, 0, +/* 0x0070 */ 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, +/* 0x0080 */ 96, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x0090 */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +/* 0x00a0 */ 0, 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,227, 19,193,168, +/* 0x00c0 */ 232, 47, 65,169,230, 31,194,168,224, 3, 0,145,225, 75, 43,139, +/* 0x00d0 */ 33, 32, 0,145, 34,132, 64,248,226,255,255,181, 34, 4, 65,248, +/* 0x00e0 */ 226,255,255,181, 32, 4, 64,209, 0, 32, 0,209, 33, 0, 30,203, +/* 0x00f0 */ 0,252, 78,211, 0, 4, 0,209, 0,196,114,211, 0, 0, 1,203, +/* 0x0100 */ 0, 32, 0,209,225, 3, 0,145, 31, 0, 0,145,231, 47,191,169, +/* 0x0110 */ 226,147,190,169,230, 11, 0,249, 34,132, 64,248, 2,132, 0,248, +/* 0x0120 */ 194,255,255,181, 34,132, 64,248, 2,132, 0,248,194,255,255,181, +/* 0x0130 */ 4, 32, 0,209, 2,132, 0,248,224,143, 31,248, 34, 12, 65,169, +/* 0x0140 */ 2, 12, 1,169,193,255,255,181,224, 11, 0,249, 1, 16, 64,145, +/* 0x0150 */ 129, 0, 0,249,228, 3, 0,170, 98, 8, 0, 24, 34,132, 0,184, +/* 0x0160 */ 2, 0,130,210, 32, 8, 0, 16, 66, 4, 0,209,115, 0, 0,148, +/* 0x0170 */ 31, 4, 64,177, 98, 0, 0, 84, 2, 0,128, 82, 34,104, 32, 56, +/* 0x0180 */ 64, 7, 0, 16, 1, 0,128, 82, 88, 0, 0,148, 1, 0,128,210, +/* 0x0190 */ 224, 7,191,169,224, 3, 4,170, 1, 0,130, 82, 34, 0,128, 82, +/* 0x01a0 */ 67, 2,128, 82,119, 0, 0,148,224,135, 64,248, 83, 0, 0,148, +/* 0x01b0 */ 225, 15,193,168,255, 3, 40,209,228, 3, 9, 42, 73, 5, 64,185, +/* 0x01c0 */ 232, 3, 0,145, 71, 1, 64,185,134, 5, 0, 16, 41, 49, 0, 17, +/* 0x01d0 */ 11, 0,128,210,172, 11, 0, 24,235, 51,191,169,232,167,190,169, +/* 0x01e0 */ 234, 11, 0,249,230, 31,191,169,227,147,190,169,229, 11, 0,249, +/* 0x01f0 */ 226, 15, 65,169,224, 7,194,168,133, 1, 0,148,253, 3, 0,170, +/* 0x0200 */ 255,195, 0,145,255, 3, 40,145,226, 15, 65,169,224, 7,194,168, +/* 0x0210 */ 0, 0, 3,139, 33, 0, 3,203, 3, 0,128, 82, 4, 0,128, 82, +/* 0x0220 */ 5, 0,128, 82, 6, 0,128, 82, 8, 0,128, 82, 9, 0,128, 82, +/* 0x0230 */ 10, 0,128, 82, 11, 0,128, 82,236, 3, 66,209,231, 7, 94,248, +/* 0x0240 */ 231, 3, 0,249,231, 3, 64,249,159, 1, 30,235,131,255,255, 84, +/* 0x0250 */ 255, 3, 66,145,232, 26,128, 82, 12, 0,128, 82, 72,128, 95,248, +/* 0x0260 */ 0, 1, 31,214, 32, 32, 32, 61, 47,112,114,111, 99, 47,115,101, +/* 0x0270 */ 108,102, 47,101,120,101, 0, 0, 99, 28, 0, 18,127, 64, 1,113, +/* 0x0280 */ 129, 1, 0, 84, 33,252, 66,211, 65, 1, 0,180, 33, 4, 0,209, +/* 0x0290 */ 2,120, 97,184, 67,120, 26, 83,127, 20, 0,113,129, 0, 0, 84, +/* 0x02a0 */ 66, 0, 1, 75, 98, 20, 26, 83, 2,120, 33,184, 1,255,255,181, +/* 0x02b0 */ 192, 3, 95,214,240, 1,240,231,192, 3, 95,214,200, 11,128, 82, +/* 0x02c0 */ 1, 0, 0,212,192, 3, 95,214,232, 7,128, 82, 1, 0, 0,212, +/* 0x02d0 */ 192, 3, 95,214,192, 3, 95,214, 8, 8,128, 82, 1, 0, 0,212, +/* 0x02e0 */ 192, 3, 95,214,192, 3, 95,214, 8, 7,128, 82, 1, 0, 0,212, +/* 0x02f0 */ 192, 3, 95,214,192, 3, 95,214, 40, 7,128, 82, 1, 0, 0,212, +/* 0x0300 */ 192, 3, 95,214,192, 3, 95,214,104, 4,128, 82, 1, 0, 0,212, +/* 0x0310 */ 192, 3, 95,214,192, 3, 95,214,168, 21,128, 82, 1, 0, 0,212, +/* 0x0320 */ 192, 3, 95,214,192, 3, 95,214,200, 26,128, 82, 1, 0, 0,212, +/* 0x0330 */ 192, 3, 95,214,192, 3, 95,214,200, 9,128, 82, 1, 0, 0,212, +/* 0x0340 */ 192, 3, 95,214,192, 3, 95,214,232, 26,128, 82, 1, 0, 0,212, +/* 0x0350 */ 192, 3, 95,214,192, 3, 95,214, 72, 28,128, 82, 1, 0, 0,212, +/* 0x0360 */ 192, 3, 95,214,192, 3, 95,214, 0, 0, 64,212, 2, 0,128, 82, +/* 0x0370 */ 8, 0,128, 82, 1, 0, 0,212,192, 3, 95,214,192, 3, 95,214, +/* 0x0380 */ 228, 23,191,169,228, 23, 65,169,165,252, 76,211,200, 27,128, 82, +/* 0x0390 */ 1, 0, 0,212,192, 3, 95,214,228, 23,193,168,192, 3, 95,214, +/* 0x03a0 */ 204,232,255, 88,228, 23,191,169, 5, 0,128, 82, 4, 0,128,146, +/* 0x03b0 */ 99, 0, 12, 42,246,255,255, 23,128, 1, 0,180, 3, 0, 64,249, +/* 0x03c0 */ 228, 3, 1, 42,127, 0, 4,235, 97, 0, 0, 84, 4, 8, 0,169, +/* 0x03d0 */ 192, 3, 95,214, 63, 0, 31,107, 96, 24, 65,250,128,255,255, 84, +/* 0x03e0 */ 0, 64, 0,145,246,255,255, 23,192, 3, 95,214, 3, 16, 64,169, +/* 0x03f0 */ 127, 0, 2,235, 99, 0, 0, 84, 3, 0,128,210, 5, 0, 0, 20, +/* 0x0400 */ 253,123,191,169,224, 15,128, 82,253, 3, 0,145,172,255,255,151, +/* 0x0410 */ 95, 0, 3,235,160, 0, 0, 84,133,104, 99, 56, 37,104, 35, 56, +/* 0x0420 */ 99, 4, 0,145,251,255,255, 23, 1, 4, 64,249, 33, 0, 2,139, +/* 0x0430 */ 1, 4, 0,249, 1, 0, 64,249, 34, 0, 2,203, 2, 0, 0,249, +/* 0x0440 */ 192, 3, 95,214,253,123,187,169,253, 3, 0,145,243, 83, 1,169, +/* 0x0450 */ 245, 91, 2,169,244, 3, 0,170,243, 3, 1,170,246, 3, 2,170, +/* 0x0460 */ 245, 3, 3,170, 96, 2, 64,249,192, 7, 0,180,161, 3, 1,145, +/* 0x0470 */ 224, 3, 20,170,130, 1,128,210,221,255,255,151,160, 7, 72, 41, +/* 0x0480 */ 0, 1, 0, 53,160, 10,138, 82, 0, 43,164,114, 63, 0, 0,107, +/* 0x0490 */ 225, 0, 0, 84,128, 2, 64,249, 64, 6, 0,180, 4, 0, 0, 20, +/* 0x04a0 */ 31, 0, 1,107, 36, 32, 95,122, 97, 0, 0, 84,224, 15,128, 82, +/* 0x04b0 */ 131,255,255,151, 98, 2, 64,249, 95, 64, 32,235,131,255,255, 84, +/* 0x04c0 */ 31, 0, 1,107,169, 3, 0, 84,160, 63, 0,185,163,243, 0,145, +/* 0x04d0 */ 164, 35, 65, 57, 98, 6, 64,249,128, 6, 64,249,192, 2, 63,214, +/* 0x04e0 */ 96,254,255, 53,160,135, 71, 41, 63, 0, 0,107, 1,254,255, 84, +/* 0x04f0 */ 163, 39, 65, 57,191, 2, 31,235,100, 16, 95,122, 32, 1, 0, 84, +/* 0x0500 */ 63, 0, 8,113,136, 0, 0, 84, 96, 2, 64,249, 31, 64, 33,235, +/* 0x0510 */ 129, 0, 0, 84,162, 43, 65, 57, 96, 6, 64,249,160, 2, 63,214, +/* 0x0520 */ 128, 6, 64,169,162, 71, 64,185, 33, 0, 2,139, 0, 0, 2,203, +/* 0x0530 */ 128, 6, 0,169, 5, 0, 0, 20,226, 3, 1, 42, 97, 6, 64,249, +/* 0x0540 */ 224, 3, 20,170,170,255,255,151, 96, 6, 64,169,162, 67, 64,185, +/* 0x0550 */ 33, 0, 2,139, 0, 0, 2,203, 96, 6, 0,169,194,255,255, 23, +/* 0x0560 */ 243, 83, 65,169,245, 91, 66,169,253,123,197,168,192, 3, 95,214, +/* 0x0570 */ 253,123,181,169,253, 3, 0,145,247, 99, 3,169,247, 3, 0,170, +/* 0x0580 */ 166, 67, 0,249, 6, 16, 64,249,249,107, 4,169, 25, 0, 6,139, +/* 0x0590 */ 0, 32, 64,121,243, 83, 1,169, 31, 12, 0,113,224,114, 64,121, +/* 0x05a0 */ 244, 3, 2, 42, 2, 7,128, 82,251,115, 5,169, 2,124,162,155, +/* 0x05b0 */ 252, 3, 3,170, 3, 2,128, 82, 99, 16,159, 26, 19, 0,128,146, +/* 0x05c0 */ 245, 91, 2,169,165, 19, 6,169,246, 3, 1,170, 99,136, 0, 17, +/* 0x05d0 */ 1, 0,128,210, 34, 3, 2,139,224, 3, 25,170, 31, 0, 2,235, +/* 0x05e0 */ 160, 1, 0, 84, 4, 0, 64,185,159, 4, 0,113, 1, 1, 0, 84, +/* 0x05f0 */ 5, 8, 64,249, 4, 20, 64,249,127, 2, 5,235,164, 0, 4,139, +/* 0x0600 */ 115,146,133,154, 63, 0, 4,235, 33, 32,132,154, 0,224, 0,145, +/* 0x0610 */ 243,255,255, 23,115,206,116,146, 33,252, 63,145, 33, 0, 19,203, +/* 0x0620 */ 224, 3, 19,170, 33,204,116,146, 5, 0,128,210, 4, 0,128, 18, +/* 0x0630 */ 2, 0,128, 82, 26, 0,128, 82, 82,255,255,151, 19, 0, 19,203, +/* 0x0640 */ 223, 2, 31,235, 64, 0,128, 82, 0, 16,159, 26,160,127, 0,185, +/* 0x0650 */ 128, 2,159, 90, 65, 6,128, 82,160,123, 0,185, 64, 2,128, 82, +/* 0x0660 */ 32, 16,128, 26,160,119, 0,185,224,114, 64,121, 95, 3, 0,107, +/* 0x0670 */ 106, 11, 0, 84, 32, 3, 64,185, 54, 1, 0,180, 31, 24, 0,113, +/* 0x0680 */ 225, 0, 0, 84, 34, 11, 64,249, 97, 0,128, 82,224, 3, 28,170, +/* 0x0690 */ 98, 2, 2,139, 73,255,255,151, 78, 0, 0, 20, 31, 4, 0,113, +/* 0x06a0 */ 129, 9, 0, 84, 56, 7, 64,185, 1, 72,140, 82, 33,106,174,114, +/* 0x06b0 */ 53, 19, 64,249, 24, 11, 30, 83, 32, 36,216, 26,160,147, 0,185, +/* 0x06c0 */ 37,211, 64,169, 27, 8, 0, 18, 32, 23, 64,249,116, 2, 20,139, +/* 0x06d0 */ 128, 2, 0,139,160, 71, 0,249,128, 46, 64,146,181, 83, 10,169, +/* 0x06e0 */ 165, 0, 0,203,181, 2, 0,139,160,127, 64,185,148,206,116,146, +/* 0x06f0 */ 163,147, 78, 41, 2, 0, 27, 42,225, 3, 21,170,224, 3, 20,170, +/* 0x0700 */ 32,255,255,151,159, 2, 0,235, 96, 0, 0, 84,224, 15,128, 82, +/* 0x0710 */ 235,254,255,151,182, 0, 0,180,163, 11, 70,169,161,131, 2,145, +/* 0x0720 */ 224, 3, 22,170, 72,255,255,151,160, 75, 64,249,227, 3, 21,203, +/* 0x0730 */ 120, 44, 64,146, 96, 0, 8, 55, 86, 1, 0,181, 23, 0, 0, 20, +/* 0x0740 */ 216,255,255,180,129, 2, 21,139, 0, 0,128,210, 63,104, 32, 56, +/* 0x0750 */ 0, 4, 0,145, 31, 0, 24,235,161,255,255, 84,247,255,255, 23, +/* 0x0760 */ 32, 7, 64,249, 0, 1, 0,181,226, 3, 20,170,224,161,128, 82, +/* 0x0770 */ 96, 24,178,114, 1, 0,128, 82, 64,204, 0,184,224, 3, 28,170, +/* 0x0780 */ 14,255,255,151,226, 3, 27, 42,225, 3, 21,170,224, 3, 20,170, +/* 0x0790 */ 242,254,255,151,192,251,255, 53,181, 2, 24,139,160, 71, 64,249, +/* 0x07a0 */ 148, 2, 21,139, 31, 0, 20,235, 73, 1, 0, 84, 1, 0, 20,203, +/* 0x07b0 */ 5, 0,128,210, 4, 0,128, 18, 67, 6,128, 82,226, 3, 27, 42, +/* 0x07c0 */ 224, 3, 20,170,239,254,255,151,159, 2, 0,235, 1,250,255, 84, +/* 0x07d0 */ 57,227, 0,145, 90, 7, 0, 17,164,255,255, 23,160, 67, 64,249, +/* 0x07e0 */ 64, 0, 0,180, 19, 0, 0,249,224, 14, 64,249,245, 91, 66,169, +/* 0x07f0 */ 249,107, 68,169,251,115, 69,169, 96, 2, 0,139,243, 83, 65,169, +/* 0x0800 */ 247, 99, 67,169,253,123,203,168,192, 3, 95,214,253,123,184,169, +/* 0x0810 */ 253, 3, 0,145,243, 83, 1,169,243, 3, 2,170, 84, 0, 1,145, +/* 0x0820 */ 162,135, 5,169, 2, 0, 64,185,245, 91, 2,169,160,135, 6,169, +/* 0x0830 */ 245, 3, 3,170,160, 63, 0,249, 3, 0,128,210,161, 67, 1,145, +/* 0x0840 */ 160,195, 1,145,162, 43, 0,249,226, 3, 4,170,246, 3, 4,170, +/* 0x0850 */ 166, 39, 0,249,247, 27, 0,249,247, 3, 5,170,250,254,255,151, +/* 0x0860 */ 130, 10, 64,249,224, 3, 21,170, 97, 0,128, 82, 66, 0, 1,145, +/* 0x0870 */ 210,254,255,151, 98,114, 64,121,224, 3, 21,170,161, 0,128, 82, +/* 0x0880 */ 206,254,255,151,228, 3, 22,170,227, 3, 21,170,166, 35, 1,145, +/* 0x0890 */ 229, 3, 23,170, 2, 0,128, 82,161,131, 1,145,224, 3, 19,170, +/* 0x08a0 */ 52,255,255,151,226, 3, 0,170,246, 3, 0,170, 33, 1,128, 82, +/* 0x08b0 */ 224, 3, 21,170, 21, 0,128, 82,192,254,255,151, 96,114, 64,121, +/* 0x08c0 */ 191, 2, 0,107, 42, 4, 0, 84,128, 2, 64,185, 31, 12, 0,113, +/* 0x08d0 */ 97, 3, 0, 84,131, 10, 64,249, 2, 0,128, 82,160, 39, 64,249, +/* 0x08e0 */ 1, 0,128, 82, 96, 0, 0,139,128,254,255,151,247, 3, 0, 42, +/* 0x08f0 */ 96, 0,248, 54,224, 15,128, 82,113,254,255,151, 2,128,128,210, +/* 0x0900 */ 225, 3, 19,170,113,254,255,151, 31, 0, 16,241, 65,255,255, 84, +/* 0x0910 */ 6, 0,128,210, 5, 0,128,210, 4, 0,128,210, 3, 0,128,210, +/* 0x0920 */ 226, 3, 23, 42, 1, 0,128,210,224, 3, 19,170, 17,255,255,151, +/* 0x0930 */ 246, 3, 0,170,224, 3, 23, 42,112,254,255,151,148,226, 0,145, +/* 0x0940 */ 181, 6, 0, 17,222,255,255, 23,224, 3, 22,170,247, 27, 64,249, +/* 0x0950 */ 243, 83, 65,169,245, 91, 66,169,253,123,200,168,192, 3, 95,214 +}; diff --git a/src/stub/scripts/xstrip.py b/src/stub/scripts/xstrip.py index a3e78a13..0fe072f3 100644 --- a/src/stub/scripts/xstrip.py +++ b/src/stub/scripts/xstrip.py @@ -27,6 +27,11 @@ # # +from __future__ import print_function +import sys + +def eprint(*args, **kwargs): + print(*args, file=sys.stderr, **kwargs) import getopt, os, re, string, struct, sys @@ -47,16 +52,18 @@ def strip_with_dump(dump_fn, eh, idata): lines = open(dump_fn, "rb").readlines() for l in lines: l = re.sub(r"\s+", " ", l.strip()) + # eprint("l=", l, "\n") f = l.split(" ") + # eprint("f=", f, "len(f)=", len(f), "\n") if len(f) >= 8: if f[7].startswith("CONTENTS"): sh_offset = int("0x" + f[5], 16) sh_size = int("0x" + f[2], 16) if sh_offset + sh_size > new_len: new_len = sh_offset + sh_size - ##print sh_offset, sh_size, f + # eprint("sh_offset=", sh_offset, "sh_size=", sh_size, "f=", f, "\n") if new_len > len(eh): - ##print dump_fn, new_len + # eprint("dump_fn=", dump_fn, "new_len=", new_len, "\n") return eh, idata[:new_len-len(eh)] return eh, idata @@ -177,6 +184,8 @@ def do_file(fn): if re.search(r"^powerpc64le-", os.path.basename(fn)): # FIXME / TODO pass + elif re.search(r"^arm64-", os.path.basename(fn)): + pass else: assert pos == len(odata), ("unexpected strip_with_dump", pos, len(odata)) else: diff --git a/src/stub/src/arch/arm64/v8/macros.S b/src/stub/src/arch/arm64/v8/macros.S index c1953dae..9ef7a0d0 100644 --- a/src/stub/src/arch/arm64/v8/macros.S +++ b/src/stub/src/arch/arm64/v8/macros.S @@ -46,80 +46,24 @@ .section \name .endm -/* The order of #if-#elif matters: ARMEL_EABI4 takes precedence over ARM_OLDABI */ -#if defined(ARMEL_DARWIN) /*{*/ __NR_SYSCALL_BASE = 0 .macro do_sys N mov w8,#\N - brk #0x80 // sets Carry iff error + svc #0 // sets Carry iff error // orrcs r0,r0,#(1<<31) // force negative on error; FIXME: needed? ret .endm -.macro do_sys7t N - do_sys \N -.endm .macro do_dcache_flush // In: r0=addr; r1=len mov w3,#1 // _sys_dcache_flush mov w8,#(1<<31) // syscall number? - brk #0x80 + svc #0 .endm .macro do_icache_invalidate // In: r0=addr; r1=len mov w3,#0 // _sys_icache_invalidate mov w8,#(1<<31) // syscall number? - brk #0x80 -.endm -#elif defined(ARMEL_EABI4) /*}{*/ - -__NR_SYSCALL_BASE = 0 -.macro do_sys7t N - mov r7,#\N // syscall number - brk #0 -.endm -.macro do_sys N - mov r12,r7 // save r7 in ip - do_sys7t \N - mov r7,r12 // restore r7 from ip -.endm -.macro do_sys7t2 N - mov r7, #(\N) & 0xff // syscall number - orr r7,r7,#(\N) &~0xff // high bits - brk #0 -.endm -.macro do_sys2 N - mov r12,r7 // save r7 in ip - do_sys7t2 \N - mov r7,r12 // restore r7 from ip -.endm - -#elif defined(ARM_OLDABI) /*}{*/ - -__NR_SYSCALL_BASE = 0x900000 -.macro do_sys N - brk #\N -.endm -.macro do_sys7t N - do_sys \N -.endm -.macro do_sys2 N - brk #\N -.endm -.macro do_sys7t2 N - do_sys2 \N -.endm - -#else /*}{*/ -.macro do_sys N - error \N // ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ? -.endm -.macro do_sys2 N - error \N // ARM_OLDABI, ARMEL_EABI4, ARMEL_DARWIN ? -.endm -#endif /*}*/ - -.macro loadcon8 reg,val8 - .long (0xe3<<24)|(0xa0<<16)|((\reg<<4)<<8)+(\val8) /* mov \reg,#\val8 */ + svc #0 .endm #endif //} diff --git a/src/stub/src/arch/arm64/v8/nrv2b_d8.S b/src/stub/src/arch/arm64/v8/nrv2b_d8.S index cb7e70df..fd8917f6 100644 --- a/src/stub/src/arch/arm64/v8/nrv2b_d8.S +++ b/src/stub/src/arch/arm64/v8/nrv2b_d8.S @@ -77,8 +77,8 @@ eof_n2b: mov x0,x3 // orig_dst add x1,x3,dst // orig_dst + dst_len mov w2,#0 - do_sys2 __ARM_NR_cacheflush // decompressed region - mov x0,x4 // result value + mov x8,#255 // __ARM_NR_cacheflush FIXME + svc #0 #endif /*}*/ #if defined(DARWIN_ARM_CACHEFLUSH) /*{*/ mov x4,x0 // save result value diff --git a/src/stub/src/arch/arm64/v8/nrv2d_d8.S b/src/stub/src/arch/arm64/v8/nrv2d_d8.S index d5674a0a..fa554bda 100644 --- a/src/stub/src/arch/arm64/v8/nrv2d_d8.S +++ b/src/stub/src/arch/arm64/v8/nrv2d_d8.S @@ -117,7 +117,8 @@ eof_n2d: mov x0,x3 // orig_dst add x1,x3,dst // orig_dst + dst_len mov w2,#0 - do_sys2 __ARM_NR_cacheflush // decompressed region + mov x8,#255 // __ARM_NR_cacheflush FIXME + svc #0 mov x0,x4 // result value #endif /*}*/ #if defined(DARWIN_ARM_CACHEFLUSH) /*{*/ diff --git a/src/stub/src/arch/arm64/v8/nrv2e_d8.S b/src/stub/src/arch/arm64/v8/nrv2e_d8.S index 1241d2c9..04b3a852 100644 --- a/src/stub/src/arch/arm64/v8/nrv2e_d8.S +++ b/src/stub/src/arch/arm64/v8/nrv2e_d8.S @@ -117,7 +117,8 @@ eof_n2e: mov x0,x3 // orig_dst add x1,x3,dst // orig_dst + dst_len mov x2,#0 - do_sys2 __ARM_NR_cacheflush // decompressed region + mov x8,#255 // __ARM_NR_cacheflush FIXME + svc #0 mov x0,x4 // result value #endif /*}*/ #if defined(DARWIN_ARM_CACHEFLUSH) /*{*/ diff --git a/src/stub/src/arm64-linux.elf-entry.S b/src/stub/src/arm64-linux.elf-entry.S new file mode 100644 index 00000000..f52914e0 --- /dev/null +++ b/src/stub/src/arm64-linux.elf-entry.S @@ -0,0 +1,247 @@ +/* aarch64-linux.elf-entry.S -- Linux program entry point & decompressor (Elf binary) +* +* This file is part of the UPX executable compressor. +* +* Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer +* Copyright (C) 1996-2015 Laszlo Molnar +* Copyright (C) 2000-2015 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 +* +* +* John F. Reiser +* +*/ + +#include "arch/arm64/v8/macros.S" + +#define bkpt .long 0xe7f001f0 /* reserved instr; Linux GNU eabi breakpoint */ +sz_Elf64_Ehdr= 64 +sz_Elf64_Phdr= 56 + +sz_b_info= 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 +sz_l_info= 12 +sz_p_info= 12 + +PROT_READ= 1 +PROT_WRITE= 2 +PROT_EXEC= 4 + +MAP_FIXED= 0x10 + +PAGE_SHIFT= 12 +PAGE_SIZE = -(~0<'; strb r1,[r2],#1 + + mov r5,#3 @ rows to print +L600: @ each row + sub r0,r4,#TRACE_BUFLEN + sub r0,r0,sp + mov r0,r0,lsr #2; mov r1,#'\n'; bl trace_hex @ which block of 8 + + mov r6,#8 @ words per row +L610: @ each word + ldr r0,[r4],#4; mov r1,#' '; bl trace_hex @ next word + subs r6,r6,#1; bgt L610 + + subs r5,r5,#1; bgt L600 + + mov r0,#'\n'; strb r0,[r2],#1 + sub r2,r2,sp @ count + mov r1,sp @ buf + mov r0,#2 @ FD_STDERR + do_sys __NR_write + add sp,sp,#TRACE_BUFLEN + ldmia sp!,{TRACE_REGS} + +trace_hex: // In: r0=val, r1=punctuation before, r2=ptr; Uses: r3, ip + strb r1,[r2],#1 @ punctuation + mov r3,#4*(8 -1) @ shift count + adr ip,hex +L620: + mov r1,r0,lsr r3 + and r1,r1,#0xf + ldrb r1,[ip, r1] + strb r1,[r2],#1 + subs r3,r3,#4; bge L620 + ret +hex: + .ascii "0123456789abcdef" +#endif /*}*/ + +f_decompress: +#define LINUX_ARM_CACHEFLUSH 1 + + section NRV_HEAD + // empty + section NRV_TAIL + // empty + + section NRV2E +#include "arch/arm64/v8/nrv2e_d8.S" + + section NRV2D +#include "arch/arm64/v8/nrv2d_d8.S" + + section NRV2B +#include "arch/arm64/v8/nrv2b_d8.S" + +#include "arch/arm64/v8/lzma_d.S" + + section ELFMAINY +end_decompress: .globl end_decompress + +msg_SELinux: + mov w2,#L71 - L70 // length + adr x1,L70 // message text + mov w0,#2 // fd stderr + do_sys __NR_write +die: + mov w0,#127 + do_sys __NR_exit +L70: + .asciz "PROT_EXEC|PROT_WRITE failed.\n" +L71: + /* IDENTSTR goes here */ + + section ELFMAINZ +cpr0: .globl cpr0 + /* { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...} */ + +/* +vi:ts=8:et:nowrap +*/ + diff --git a/src/stub/src/arm64-linux.elf-fold.S b/src/stub/src/arm64-linux.elf-fold.S new file mode 100644 index 00000000..f707f9b4 --- /dev/null +++ b/src/stub/src/arm64-linux.elf-fold.S @@ -0,0 +1,434 @@ +// aarch64-linux.elf-fold.S -- linkage to C code to process Elf binary +// +// This file is part of the UPX executable compressor. +// +// Copyright (C) 2000-2015 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 +// +// +// John F. Reiser +// +// + +#define ARM_OLDABI 1 +#include "arch/arm64/v8/macros.S" +#define bkpt .long 0xe7f001f0 /* reserved instr; Linux GNU eabi breakpoint */ + +sz_Elf64_Ehdr= 64 +sz_Elf64_Phdr= 56 +sz_l_info = 12 +sz_p_info = 12 +sz_b_info = 12 + sz_unc= 0 + sz_cpr= 4 + b_method= 8 + +MAP_PRIVATE= 0x02 +MAP_FIXED= 0x10 + +PROT_READ= 0x1 + +O_RDONLY= 0 + +PAGE_SHIFT= 12 +PAGE_SIZE = -(~0<'; strb r1,[r2],#1 + + mov r5,#3 // rows to print +L600: // each row + sub r0,r4,#TRACE_BUFLEN + sub r0,r0,sp + mov r0,r0,lsr #2; mov r1,#'\n'; bl trace_hex // which block of 8 + + mov r6,#8 // words per row +L610: // each word + ldr r0,[r4],#4; mov r1,#' '; bl trace_hex // next word + subs r6,r6,#1; bgt L610 + + subs r5,r5,#1; bgt L600 + + mov r0,#'\n'; strb r0,[r2],#1 + sub r2,r2,sp // count + mov r1,sp // buf + mov r0,#2 // FD_STDERR +#if defined(ARMEL_EABI4) /*{*/ + mov r7,#__NR_write + swi 0 +#else /*}{*/ + swi __NR_write +#endif /*}*/ + add sp,sp,#TRACE_BUFLEN + ldmia sp!,{TRACE_REGS} + +trace_hex: // In: r0=val, r1=punctuation before, r2=ptr; Uses: r3, ip + strb r1,[r2],#1 // punctuation + mov r3,#4*(8 -1) // shift count + adr ip,hex +L620: + mov r1,r0,lsr r3 + and r1,r1,#0xf + ldrb r1,[ip, r1] + strb r1,[r2],#1 + subs r3,r3,#4; bge L620 + ret +hex: + .ascii "0123456789abcdef" +#endif /*}*/ + .unreq ptr + .unreq len + .unreq cto + .unreq fid + +__NR_SYSCALL_BASE= 0 + +__NR_exit = 0x5e + __NR_SYSCALL_BASE // 94 exit_group +__NR_read = 0x3f + __NR_SYSCALL_BASE // 63 +__NR_write = 0x40 + __NR_SYSCALL_BASE // 64 +__NR_open = 0x38 + __NR_SYSCALL_BASE // 56 +__NR_close = 0x39 + __NR_SYSCALL_BASE // 57 +__NR_unlink= 0x23 + __NR_SYSCALL_BASE // 35 +__NR_getpid= 0xad + __NR_SYSCALL_BASE // 172 +__NR_brk = 0xd6 + __NR_SYSCALL_BASE // 214 +__NR_readlink=0x4e+ __NR_SYSCALL_BASE // 78 + + +__NR_mmap2 = 0xde + __NR_SYSCALL_BASE // 222 +__NR_mprotect = 0xe2 + __NR_SYSCALL_BASE // 226 +__NR_munmap = 0xd7 + __NR_SYSCALL_BASE // 215 + +__ARM_NR_BASE = 0x0f0000 + __NR_SYSCALL_BASE +__ARM_NR_cacheflush = 2 + __ARM_NR_BASE + + .globl my_bkpt +my_bkpt: + bkpt + ret + + .globl exit +exit: + do_sys __NR_exit + + .globl read +read: + do_sys __NR_read; ret + + .globl write +write: + do_sys __NR_write; ret + + .globl open +open: + do_sys __NR_open; ret + + .globl close +close: + do_sys __NR_close; ret + + .globl unlink +unlink: + do_sys __NR_unlink; ret + + .globl getpid +getpid: + do_sys __NR_getpid; ret + + .globl brk +brk: + do_sys __NR_brk; ret + + .globl readlink +readlink: + do_sys __NR_readlink; ret + + .globl munmap +munmap: + do_sys __NR_munmap; ret + + .globl mprotect +mprotect: + do_sys __NR_mprotect; ret + + .globl __clear_cache +__clear_cache: + hlt #0 + mov w2,#0 + do_sys 0; ret // FIXME + + .globl mmap +mmap: + PUSH2(x4,x5) + ldp x4,x5,[sp,#2*8] + lsr x5,x5,#12 // convert to page number +mmap_do: + do_sys __NR_mmap2 + POP2(x4,x5) + ret + +bits_privanon= -4+ fold_begin // entry stores: MAP_{PRIVATE|ANON} QNX vs linux + +mmap_privanon: .globl mmap_privanon + ldr x12,bits_privanon // r12 === ip + PUSH2(x4,x5) + mov w5,#0 // offset= 0 + mov x4,#-1 // fd= -1 + orr w3,w3,w12 // flags |= MAP_{PRIVATE|ANON} [QNX vs Linux] + b mmap_do + + +#if DEBUG /*{*/ + +div10: .globl div10 + mov ip,r0 // extra copy used at end + sub r1,r1,r1 // hi + + mov r2,r0 // copy lo + adds r0,r0,r0,lsl #3 // 9*lo + adc r1,r1,r1,lsl #3 // 9*hi + C + add r1,r1,r2,lsr #(32 - 3) // bits shifted from lo to hi + + mov r2,r0 // copy lo + adds r0,r0,r0,lsl #4 + adc r1,r1,r1,lsl #4 + add r1,r1,r2,lsr #(32 - 4) // * 0x99 + + mov r2,r0 // copy lo + adds r0,r0,r0,lsl #8 + adc r1,r1,r1,lsl #8 + add r1,r1,r2,lsr #(32 - 8) // * 0x9999 + + mov r2,r0 // copy lo + adds r0,r0,r0,lsl #16 + adc r1,r1,r1,lsl #16 + add r1,r1,r2,lsr #(32 - 16) // * 0x99999999 + + subs r0,r0,ip,lsl #(32 - 1) // - * 0x80000000 + sbc r1,r1,ip,lsr #1 // * 0x19999999 + + adds r0,r0,ip + adc r0,r1,#0 // * 0x0.1999999a + ret + +#endif /*}*/ + +// vi:ts=8:et:nowrap + diff --git a/src/stub/src/arm64-linux.elf-fold.lds b/src/stub/src/arm64-linux.elf-fold.lds new file mode 100644 index 00000000..59c1dd75 --- /dev/null +++ b/src/stub/src/arm64-linux.elf-fold.lds @@ -0,0 +1,48 @@ +/* arm64-linux.elf-fold.lds -- static linker script to build arm64-linux.elf-fold.bin + + This file is part of the UPX executable compressor. + + Copyright (C) 2000-2017 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 + + + John F. Reiser + + */ + + +OUTPUT_FORMAT("elf64-littleaarch64", "elf64-bigaarch64", "elf64-littleaarch64") +OUTPUT_ARCH(aarch64) +/*ENTRY(_start)*/ +PHDRS +{ + text PT_LOAD FILEHDR PHDRS FLAGS ( 5 ) ; /* r-x (no -w-) */ + data PT_LOAD ; /* for setting brk(0) */ +} +SECTIONS +{ + . = 0x00100000 + SIZEOF_HEADERS + 12; /* 12==sizeof(l_info) */ + .text : { + *(.text) + *(.data) + } : text + .data : { + } : data +} diff --git a/src/stub/src/arm64-linux.elf-main.c b/src/stub/src/arm64-linux.elf-main.c new file mode 100644 index 00000000..5196476c --- /dev/null +++ b/src/stub/src/arm64-linux.elf-main.c @@ -0,0 +1,370 @@ +/* arm64-linux.elf-main.c -- stub loader for Linux 64-bit ELF executable + + This file is part of the UPX executable compressor. + + Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer + Copyright (C) 1996-2017 Laszlo Molnar + Copyright (C) 2000-2017 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 + + + John F. Reiser + + */ + + +#include "include/linux.h" + + +/************************************************************************* +// configuration section +**************************************************************************/ + +// In order to make it much easier to move this code at runtime and execute +// it at an address different from it load address: there must be no +// static data, and no string constants. + +#define MAX_ELF_HDR 1024 // Elf64_Ehdr + n*Elf64_Phdr must fit in this + + +/************************************************************************* +// "file" util +**************************************************************************/ + +typedef struct { + size_t size; // must be first to match size[0] uncompressed size + char *buf; +} Extent; + + +static void +xread(Extent *x, char *buf, size_t count) +{ + char *p=x->buf, *q=buf; + size_t j; + if (x->size < count) { + exit(127); + } + for (j = count; 0!=j--; ++p, ++q) { + *q = *p; + } + x->buf += count; + x->size -= count; +} + + +/************************************************************************* +// util +**************************************************************************/ + +#if 1 //{ save space +#define ERR_LAB error: exit(127); +#define err_exit(a) goto error +#else //}{ save debugging time +#define ERR_LAB /*empty*/ +static void +err_exit(int a) +{ + (void)a; // debugging convenience + exit(127); +} +#endif //} + +/************************************************************************* +// UPX & NRV stuff +**************************************************************************/ + +typedef void f_unfilter( + nrv_byte *, // also addvalue + nrv_uint, + unsigned cto8, // junk in high 24 bits + unsigned ftid +); +typedef int f_expand( + const nrv_byte *, nrv_uint, + nrv_byte *, nrv_uint *, unsigned ); + +static void +unpackExtent( + Extent *const xi, // input + Extent *const xo, // output + f_expand *const f_decompress, + f_unfilter *f_unf +) +{ + while (xo->size) { + struct b_info h; + // Note: if h.sz_unc == h.sz_cpr then the block was not + // compressible and is stored in its uncompressed form. + + // Read and check block sizes. + xread(xi, (char *)&h, sizeof(h)); + if (h.sz_unc == 0) { // uncompressed size 0 -> EOF + if (h.sz_cpr != UPX_MAGIC_LE32) // h.sz_cpr must be h->magic + err_exit(2); + if (xi->size != 0) // all bytes must be written + err_exit(3); + break; + } + if (h.sz_cpr <= 0) { + err_exit(4); +ERR_LAB + } + if (h.sz_cpr > h.sz_unc + || h.sz_unc > xo->size ) { + err_exit(5); + } + // Now we have: + // assert(h.sz_cpr <= h.sz_unc); + // assert(h.sz_unc > 0 && h.sz_unc <= blocksize); + // assert(h.sz_cpr > 0 && h.sz_cpr <= blocksize); + + if (h.sz_cpr < h.sz_unc) { // Decompress block + nrv_uint out_len = h.sz_unc; // EOF for lzma + int const j = (*f_decompress)((unsigned char *)xi->buf, h.sz_cpr, + (unsigned char *)xo->buf, &out_len, h.b_method ); + if (j != 0 || out_len != (nrv_uint)h.sz_unc) + err_exit(7); + // Skip Ehdr+Phdrs: separate 1st block, not filtered + if (h.b_ftid!=0 && f_unf // have filter + && ((512 < out_len) // this block is longer than Ehdr+Phdrs + || (xo->size==(unsigned)h.sz_unc) ) // block is last in Extent + ) { + (*f_unf)((unsigned char *)xo->buf, out_len, h.b_cto8, h.b_ftid); + } + xi->buf += h.sz_cpr; + xi->size -= h.sz_cpr; + } + else { // copy literal block + xread(xi, xo->buf, h.sz_cpr); + } + xo->buf += h.sz_unc; + xo->size -= h.sz_unc; + } +} + +#if 1 /*{*/ +static void +upx_bzero(char *p, size_t len) +{ + if (len) do { + *p++= 0; + } while (--len); +} +#define bzero upx_bzero +#else +#define bzero(a,b) __builtin_memset(a,0,b) +#endif /*}*/ + +static void +auxv_up(Elf64_auxv_t *av, unsigned const type, uint64_t const value) +{ + if (av) + for (;; ++av) { + if (av->a_type==type || (av->a_type==AT_IGNORE && type!=AT_NULL)) { + av->a_type = type; + av->a_un.a_val = value; + return; + } + } +} + +// The PF_* and PROT_* bits are {1,2,4}; the conversion table fits in 32 bits. +#define REP8(x) \ + ((x)|((x)<<4)|((x)<<8)|((x)<<12)|((x)<<16)|((x)<<20)|((x)<<24)|((x)<<28)) +#define EXP8(y) \ + ((1&(y)) ? 0xf0f0f0f0 : (2&(y)) ? 0xff00ff00 : (4&(y)) ? 0xffff0000 : 0) +#define PF_TO_PROT(pf) \ + ((PROT_READ|PROT_WRITE|PROT_EXEC) & ( \ + ( (REP8(PROT_EXEC ) & EXP8(PF_X)) \ + |(REP8(PROT_READ ) & EXP8(PF_R)) \ + |(REP8(PROT_WRITE) & EXP8(PF_W)) \ + ) >> ((pf & (PF_R|PF_W|PF_X))<<2) )) + + +// Find convex hull of PT_LOAD (the minimal interval which covers all PT_LOAD), +// and mmap that much, to be sure that a kernel using exec-shield-randomize +// won't place the first piece in a way that leaves no room for the rest. +static unsigned long // returns relocation constant +xfind_pages(unsigned mflags, Elf64_Phdr const *phdr, int phnum, + char **const p_brk +) +{ + size_t lo= ~0, hi= 0, szlo= 0; + char *addr; + mflags += MAP_PRIVATE | MAP_ANONYMOUS; // '+' can optimize better than '|' + for (; --phnum>=0; ++phdr) if (PT_LOAD==phdr->p_type) { + if (phdr->p_vaddr < lo) { + lo = phdr->p_vaddr; + szlo = phdr->p_filesz; + } + if (hi < (phdr->p_memsz + phdr->p_vaddr)) { + hi = phdr->p_memsz + phdr->p_vaddr; + } + } + szlo += ~PAGE_MASK & lo; // page fragment on lo edge + lo -= ~PAGE_MASK & lo; // round down to page boundary + hi = PAGE_MASK & (hi - lo - PAGE_MASK -1); // page length + szlo = PAGE_MASK & (szlo - PAGE_MASK -1); // page length + addr = mmap((void *)lo, hi, PROT_NONE, mflags, -1, 0); + *p_brk = hi + addr; // the logical value of brk(0) + //mprotect(szlo + addr, hi - szlo, PROT_NONE); // no access, but keep the frames! + return (unsigned long)addr - lo; +} + +static Elf64_Addr // entry address +do_xmap( + Elf64_Ehdr const *const ehdr, + Extent *const xi, + int const fdi, + Elf64_auxv_t *const av, + f_expand *const f_decompress, + f_unfilter *const f_unf, + Elf64_Addr *p_reloc +) +{ + Elf64_Phdr const *phdr = (Elf64_Phdr const *) (ehdr->e_phoff + + (char const *)ehdr); + char *v_brk; + unsigned long const reloc = xfind_pages( + ((ET_DYN!=ehdr->e_type) ? MAP_FIXED : 0), phdr, ehdr->e_phnum, &v_brk); + int j; + for (j=0; j < ehdr->e_phnum; ++phdr, ++j) + if (xi && PT_PHDR==phdr->p_type) { + auxv_up(av, AT_PHDR, phdr->p_vaddr + reloc); + } else + if (PT_LOAD==phdr->p_type) { + unsigned const prot = PF_TO_PROT(phdr->p_flags); + Extent xo; + size_t mlen = xo.size = phdr->p_filesz; + 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; + + if (addr != mmap(addr, mlen, prot | (xi ? PROT_WRITE : 0), + MAP_FIXED | MAP_PRIVATE | (xi ? MAP_ANONYMOUS : 0), + (xi ? -1 : fdi), phdr->p_offset - frag) ) { + err_exit(8); + } + if (xi) { + unpackExtent(xi, &xo, f_decompress, f_unf); + } + // Linux does not fixup the low end, so neither do we. + //if (PROT_WRITE & prot) { + // bzero(addr, frag); // fragment at lo end + //} + frag = (-mlen) &~ PAGE_MASK; // distance to next page boundary + if (PROT_WRITE & prot) { // note: read-only .bss not supported here + bzero(mlen+addr, frag); // fragment at hi end + } + if (xi) { + if (0==phdr->p_offset) { + Elf64_Ehdr *const ehdr = (Elf64_Ehdr *)addr; + int *const p = (int *)&ehdr->e_ident[12]; + *p = 0x90c3050f; // syscall; ret; nop + auxv_up(av, AT_NULL, (uint64_t)&ehdr->e_ident[12]); + } + if (0!=mprotect(addr, mlen, prot)) { + err_exit(10); +ERR_LAB + } + } + addr += mlen + frag; /* page boundary on hi end */ + if (addr < haddr) { // need pages for .bss + if (addr != mmap(addr, haddr - addr, prot, + MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0 ) ) { + err_exit(9); + } + } + } + if (xi) { // 1st call (main); also have (0!=av) here + if (ET_DYN!=ehdr->e_type) { + // Needed only if compressed shell script invokes compressed shell. + // brk(v_brk); // SIGSEGV when is_big [unmaps ourself!] + } + } + if (0!=p_reloc) { + *p_reloc = reloc; + } + return ehdr->e_entry + reloc; +} + + +/************************************************************************* +// upx_main - called by our entry code +// +// This function is optimized for size. +**************************************************************************/ + +void * +upx_main( // returns entry address + struct b_info const *const bi, // 1st block header + size_t const sz_compressed, // total length + Elf64_Ehdr *const ehdr, // temp char[sz_ehdr] for decompressing + Elf64_auxv_t *const av, + f_expand *const f_decompress, + f_unfilter *const f_unf, + Elf64_Addr reloc // IN OUT; value result for ET_DYN +) +{ + Elf64_Phdr const *phdr = (Elf64_Phdr const *)(1+ ehdr); + Elf64_Addr entry; + + Extent xo, xi1, xi2; + xo.buf = (char *)ehdr; + xo.size = bi->sz_unc; + xi2.buf = CONST_CAST(char *, bi); xi2.size = sz_compressed; + xi1.buf = CONST_CAST(char *, bi); xi1.size = sz_compressed; + + // ehdr = Uncompress Ehdr and Phdrs + unpackExtent(&xi2, &xo, f_decompress, 0); // never filtered? + + // AT_PHDR.a_un.a_val is set again by do_xmap if PT_PHDR is present. + auxv_up(av, AT_PHDR , (unsigned long)(1+(Elf64_Ehdr *)phdr->p_vaddr)); + auxv_up(av, AT_PHNUM , ehdr->e_phnum); + //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, &xi1, 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 = reloc + (char const *)phdr->p_vaddr; + int const fdi = open(iname, O_RDONLY, 0); + if (0 > fdi) { + err_exit(18); + } + if (MAX_ELF_HDR!=read(fdi, (void *)ehdr, MAX_ELF_HDR)) { +ERR_LAB + err_exit(19); + } + entry = do_xmap(ehdr, 0, fdi, 0, 0, 0, 0); + close(fdi); + } + } + + return (void *)entry; +} + +/* vim:set ts=4 sw=4 et: */ diff --git a/src/stub/src/include/linux.h b/src/stub/src/include/linux.h index 00d46ea5..671bdc4d 100644 --- a/src/stub/src/include/linux.h +++ b/src/stub/src/include/linux.h @@ -96,7 +96,7 @@ struct timespec { #elif defined(__amd64__) #define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page #define PAGE_SIZE ( 1ul<<12) -#elif defined(__i386__) || defined(__powerpc__) || defined(__arm__) +#elif defined(__i386__) || defined(__powerpc__) || defined(__arm__) || defined(__AARCH64EL__) #define PAGE_MASK (~0ul<<12) // discards the offset, keeps the page #define PAGE_SIZE ( 1ul<<12) #endif