Compare commits

..

1388 Commits

Author SHA1 Message Date
Markus F.X.J. Oberhumer 7a3637ff5a Update NEWS. 2018-08-26 04:58:09 +02:00
John Reiser 2923c0968e Merge branch 'devel' of https://github.com/upx/upx into devel
Fix Conflicts:
	.github/travis_testsuite_1.sh
2018-08-22 14:58:36 -07:00
John Reiser 98cfe99d65 sync testsuite
modified:   .github/travis_testsuite_1.sh
2018-08-22 14:52:00 -07:00
John Reiser bdd97fe0b2 build stubs
modified:   amd64-linux.elf-fold.h
	modified:   arm64-linux.elf-fold.h
	modified:   i386-bsd.elf-fold.h
	modified:   i386-linux.elf.interp-fold.h
	modified:   i386-netbsd.elf-fold.h
	modified:   i386-openbsd.elf-fold.h
	modified:   powerpc64-linux.elf-fold.h
	modified:   powerpc64le-linux.elf-fold.h
	modified:   tmp/amd64-linux.elf-fold.map
	modified:   tmp/arm64-linux.elf-fold.map
	modified:   tmp/i386-bsd.elf-fold.map
	modified:   tmp/i386-linux.elf.interp-fold.map
	modified:   tmp/i386-netbsd.elf-fold.map
	modified:   tmp/i386-openbsd.elf-fold.map
	modified:   tmp/powerpc64-linux.elf-fold.map
	modified:   tmp/powerpc64le-linux.elf-fold.map
2018-08-22 14:48:15 -07:00
John Reiser 6b500bc83b auxv_up() quit at AT_NULL, especially when AT_BASE has been omitted.
Based on contribution from Brian Geffon 'bgaff'
https://github.com/upx/upx/pull/215 ; bgaff
	modified:   amd64-linux.elf-main.c
	modified:   i386-bsd.elf-main.c
	modified:   i386-linux.elf.interp-main.c
	modified:   i386-openbsd.elf-main.c
2018-08-22 14:39:14 -07:00
Markus F.X.J. Oberhumer 92a12a2ec1 Update testsuite checksums caused by version date bump. 2018-08-22 13:16:39 +02:00
Markus F.X.J. Oberhumer 04d79040f9 Bump tentative release date. 2018-08-22 13:15:50 +02:00
Markus F.X.J. Oberhumer 3201ddc680 Update .editorconfig. 2018-08-22 13:06:39 +02:00
Markus F.X.J. Oberhumer 2f06de54c5 Cosmetic update. 2018-08-22 12:43:23 +02:00
John Reiser 6489ec9bba Fix PT_LOAD for ELF shared library.
modified:   p_lx_elf.cpp
2018-08-20 19:36:27 -07:00
John Reiser 1a5ba22fe7 Highlight changes for upx-3.95.
modified:   NEWS
2018-08-20 17:10:00 -07:00
John Reiser 8f9713ed53 Appease MSVC warning C4018: s/igned/unsigned mismatch
modified:   p_lx_elf.cpp
2018-08-13 18:47:42 -07:00
John Reiser 90eb68b3b9 Adapt to 4 PT_LOAD in binutils-2.31 and gcc-8.2.1 (Fedora 29)
0:        PF_R: .gnu.hash .dynsym .dynstr
1: PF_X | PF_R: .plt .plt.sec .text
2:        PF_R: .rodata .hash
3: PF_W | PF_R: .data.rel.ro .dynamic .got .got.plt .data .bss
	modified:   p_lx_elf.cpp

https://github.com/upx/upx/issues/212 (partial, Fedora 29)
2018-08-13 17:36:56 -07:00
John Reiser 95fcbcb4f2 ::PackLinuxElf64amd() sets lg2_page back to 12.
https://github.com/upx/upx/issues/212 (partial, Fedora 29)
	modified:   p_lx_elf.cpp
2018-08-10 20:28:40 -07:00
John Reiser b97688d119 Stub updates AT_PHDR for 32-bit libmusl, particularly -fPIE
https://github.com/upx/upx/issues/200
	modified:   stub/src/i386-linux.elf-main.c
	  also *.elf-fold.h, *.elf-fold.map for arm, armeb, i386, mips, mipsel, powerpc
	modified:   ../.github/travis_testsuite_1.sh
2018-08-04 18:26:02 -07:00
John Reiser 5ea3627cab --android-shlib, --force-pie
modified:   NEWS
2018-05-19 06:30:23 -07:00
John Reiser d9288213ec More checking of PT_DYNAMIC and its contents.
https://github.com/upx/upx/issues/206
	modified:   p_lx_elf.cpp
2018-05-17 21:48:26 -07:00
John Reiser 614c86fb7d --force-pie inhibits treating as shared library (for 'rust', etc.)
https://github.com/upx/upx/issues/200
	modified:   main.cpp
	modified:   options.h
	modified:   p_lx_elf.cpp
2018-04-26 13:44:17 -07:00
John Reiser 9f651ee40f Ignore ElfXX_Shdr if not CMD_COMPRESS; beware unpack when PT_DYNAMIC in other PT_LOAD
https://github.com/upx/upx/issues/200
	modified:   p_lx_elf.cpp
2018-04-26 08:34:58 -07:00
John Reiser 774c8c3fd4 Fix forgotten get_teXX() in canPack() and invert_pt_dynamic()
https://github.com/upx/upx/issues/200
	modified:   p_lx_elf.cpp
2018-04-25 23:05:17 -07:00
John Reiser b711d2f750 TLS callbacks: one entry only
https://github.com/upx/upx/issues/186  [partial, incomplete]
(Laszlo hints there is more, but meanwhile this does fix some.)
	modified:   pefile.cpp
2018-04-06 13:44:24 -07:00
John Reiser 8a793d5942 ELF shlib when no DT_INIT (especially --android-shlib)
https://github.com/upx/upx/issues/191
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-04-04 09:15:18 -07:00
John Reiser 99f52c60ed Merge branch 'Mattiwatti-offset-to-rva-fix' into devel
https://github.com/upx/upx/pull/193
2018-04-02 09:08:57 -07:00
Mattiwatti 2c2e108301 PE: fix comparison against a constant value
... due to size always being assigned to right before this comparison,
and instead check against the RVA and size of the export directory
from the header. (note: this is still stricter than the Windows loader
which ignores all of these except the directory RVA, but if the name RVA
is invalid the PE was probably tampered with).
Change 'offset' to 'RVA' in exception message; this field is always an RVA

  Author:    Mattiwatti <mattiwatti@gmail.com>
	modified:   pefile.cpp
2018-04-02 09:07:29 -07:00
John Reiser 563165e6ae Defensive patches from hints by Sean Williams <rootkit@google.com>
modified:   pefile.cpp
2018-03-29 16:55:21 -07:00
John Reiser f1a31b4793 ELf32::unpack; Elf64 parity with Elf32 for shlib with no DT_INIT
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
2018-03-27 19:15:47 -07:00
John Reiser 5e9b6bd69d more ELF shlib when no DT_INIT (especially Android): hook DT_INIT_ARRAY[0]
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
2018-03-26 16:30:52 -07:00
John Reiser 9b990c4eae clarity
modified:   p_lx_elf.cpp
2018-03-24 13:52:29 -07:00
John Reiser 7a625a449a ELF shlib without DT_INIT: steal a DT_NULL from PT_DYNAMIC
https://github.com/upx/upx/issues/191  [partial, not finished]
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-03-24 09:41:58 -07:00
John Reiser c2b62359d5 arm32 stubs on linux: allow 0==user_DT_INIT as nop; somewhat expensive
modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
	modified:   stub/tmp/arm.v5a-linux.shlib-init.bin.dump
	modified:   stub/tmp/arm.v5t-linux.shlib-init.bin.dump
2018-03-24 08:55:04 -07:00
John Reiser 6722e8972e cleanup dead variables: is_big, all_pages
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-03-23 08:06:31 -07:00
John Reiser fefe7a3452 Fix segTEXT.vmsize and data for entry to shlib.
https://github.com/upx/upx/issues/57
	modified:   p_mach.cpp
2018-03-19 14:59:20 -07:00
John Reiser 90a1322929 Also check for wrap-around when checking oversize involving e_shoff and e_shnum.
raised by https://github.com/upx/upx/pull/190
	modified:   p_lx_elf.cpp
2018-03-15 21:25:20 -07:00
John Reiser d698eb69e2 Fix decompression stub for arm64 --lzma
https://github.com/upx/upx/issues/181
	modified:   stub/src/arch/arm64/v8/lzma_d.S
2018-02-24 13:04:15 -08:00
John Reiser 0ef00e9b82 Fix --lzma (and so --ultra-brute) for 32-bit ARM
https://github.com/upx/upx/issues/167  (comment #14)
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   ../.github/travis_testsuite_1.sh
2018-02-03 15:44:00 -08:00
John Reiser 95cedb6640 upgrade ::unpack for --android-shlib
modified:   p_elf_enum.h
    	modified:   p_lx_elf.cpp
    	modified:   p_lx_elf.h
    	modified:   stub/src/arm64-linux.shlib-init.S
    	modified:   stub/src/arm.v4t-linux.shlib-init.S
2018-02-02 14:50:56 -08:00
John Reiser d736da4208 Elf32, not shared lib: leave alone the hole between .text and .data
In theory Linux might put pages there (and that would be a problem),
but postpone closing the gap until more experience.
	modified:   p_lx_elf.cpp
2018-01-28 13:30:10 -08:00
John Reiser be83788666 --android-shlib for 32-bit ARM
Includes better handling of asl_delta in execution stub.

    	modified:   p_lx_elf.cpp
    	modified:   p_lx_elf.h
    	modified:   stub/src/arm.v4t-linux.shlib-init.S
    	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-27 22:00:16 -08:00
John Reiser 5a28a51abc android shlib: better handling of asl_delta in execution stub
modified:   p_lx_elf.cpp
    	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-26 12:35:06 -08:00
John Reiser 8a84df752c Compiler nit: ptr->ENUM is not always considered a constant
modified:   p_lx_elf.cpp
2018-01-26 11:54:33 -08:00
John Reiser 85f53b210d de-compression of arm64 --android-shlib
modified:   src/p_lx_elf.cpp
	modified:   src/p_lx_elf.h
	modified:   src/stub/src/arm64-linux.shlib-init.S
2018-01-24 15:39:46 -08:00
John Reiser 5d13c6cd01 elfout is unset for shlib in PackLinuxElf64::updateLoader
modified:   p_lx_elf.cpp
2018-01-22 16:15:53 -08:00
John Reiser 98a0d381e9 Merge branch 'devel' into jreiser-android
modified:   p_lx_elf.cpp
2018-01-22 13:55:45 -08:00
John Reiser e1d20fd0b5 Fix wobble in PackLinuxElf64::pack2
modified:   p_lx_elf.cpp
2018-01-22 13:48:26 -08:00
John Reiser d1035ecd8f Fix PLT for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-22 13:05:18 -08:00
John Reiser 0e651facdd Fix PLT for --android-shlib
NYI: unpack of PLT, DT_INIT etc.  Also e_entry.
	modified:   p_lx_elf.cpp
2018-01-22 13:01:20 -08:00
John Reiser 9fdddfc332 work in progress: de-compression of --android-shlib
OK except for asl_delta not removed from DT_INIT, DT_INIT_ARRAY,
DT_FINI_ARRAY, DT_PREINIT_ARRAY
	modified:   ../p_lx_elf.cpp
2018-01-21 18:59:21 -08:00
John Reiser 7d2913709c MemBuffer lowmem; for shlib, especially android
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-21 14:03:52 -08:00
John Reiser 3623199e8d Merge branch 'devel' into jreiser-android 2018-01-21 10:55:56 -08:00
John Reiser e4b23f7a47 Merge branch 'devel' of https://github.com/upx/upx into devel 2018-01-21 10:30:42 -08:00
John Reiser f056ecdcd5 pefile: Allow overlap of MZ header and PE header (h.nexepos==0x10)
https://github.com/upx/upx/issues/169
This means .codebase is aliased to .nexepos, with both equal to 0x10.
	modified:   pefile.cpp
2018-01-21 10:29:17 -08:00
John Reiser 857a03a074 fix sh_offset for new Shdr[e_shstrndx]
modified:   p_lx_elf.cpp
2018-01-20 16:41:32 -08:00
John Reiser a34deee4f5 work in progress for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-20 16:34:52 -08:00
John Reiser fc9c8ae482 fix updating of DT_INIT
modified:   p_lx_elf.cpp
2018-01-20 09:48:28 -08:00
John Reiser 08c63f06eb p_lx_elf.h: phdro for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-19 22:01:56 -08:00
John Reiser bbff510ef1 Merge branch 'devel' into jreiser-android
Conflicts:
	src/p_lx_elf.cpp
	src/p_lx_elf.h

	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_exe.cpp
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   pefile.cpp
2018-01-19 21:51:49 -08:00
Markus F.X.J. Oberhumer f747435952 For consistency, add missing "virtual". 2018-01-19 20:21:18 +01:00
Markus F.X.J. Oberhumer e6edad8f46 Clean up OptVar handling. 2018-01-19 19:50:28 +01:00
Markus F.X.J. Oberhumer 05e44b9644 Fix powerpc64 cross build. 2018-01-19 15:05:43 +01:00
Markus F.X.J. Oberhumer 16bb7ab841 clang-format files. 2018-01-19 14:18:47 +01:00
Markus F.X.J. Oberhumer 9248f02557 Silence some gcc-8-snapshot compiler warnings. 2018-01-19 14:13:58 +01:00
Markus F.X.J. Oberhumer 9485a56af1 Update Travis. 2018-01-19 11:30:34 +01:00
Markus F.X.J. Oberhumer 021c8db58a Welcome 2018. 2018-01-19 10:55:32 +01:00
John Reiser 8ab180edf8 MS-DOS .exe (not PE): default to file_size when ih.m512 and ih.p512 are zero
https://github.com/upx/upx/issues/169
	modified:   p_exe.cpp
2018-01-18 12:00:38 -08:00
John Reiser ab35b685d4 Fix pefile.cpp bad range checking for reloc type 3 and 10
modified:   pefile.cpp
2018-01-18 11:11:19 -08:00
John Reiser 86745721ee MSVC strikes again
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-15 16:27:00 -08:00
John Reiser c34fe09a79 Revamp --android-shlib
Android "Oreo" wants to deal with ElfXX_Shdr[].  So splice 4KiB into PT_LOAD[0]
with an "extra" copy of them.  This requires careful relocation processing.
It also costs a page at run time, and an average of a page in the file
(depending on fragmentation at the boundary between r-x and rw- .)

https://github.com/upx/upx/issues/124
https://github.com/upx/upx/issues/139
https://github.com/upx/upx/issues/142

	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
	modified:   stub/src/arm64-linux.shlib-init.S

	modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/arm64-linux.shlib-init.h

	modified:   ../.github/travis_testsuite_1.sh
2018-01-15 16:08:34 -08:00
John Reiser 1fa9ff2c05 --android-shlib handles implicit relocation in PLT
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2018-01-15 15:45:37 -08:00
John Reiser e8ef0cf63f Merge branch 'devel' into jreiser-android 2018-01-13 09:25:55 -08:00
John Reiser 8c84efb8fb --android-shlib for Android "Oreo"
Android "Oreo" wants to deal with ElfXX_Shdr[].  So splice 4KiB into PT_LOAD[0]
with an "extra" copy of them.  This requires careful relocation processing.
It also costs a page at run time.
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-13 09:20:04 -08:00
John Reiser f3a7620ae8 ARM: recognize R_ARM_CALL and R_ARM_JUMP24 as equivalent to R_ARM_PC24
modified:   linker.cpp
2018-01-12 08:42:34 -08:00
John Reiser c7969ed5a5 work in progress for --android-shlib
modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   stub/src/arm.v4a-linux.shlib-init.S
	modified:   stub/src/arm.v4t-linux.shlib-init.S
2018-01-12 08:32:24 -08:00
Markus F.X.J. Oberhumer 900926c0ed Avoid a MSVC warning. 2018-01-12 10:19:14 +01:00
John Reiser df94f4288a picky, picky
modified:   p_lx_elf.cpp
2018-01-11 12:09:43 -08:00
John Reiser 969efe687d MSVC pecadillos
modified:   p_lx_elf.cpp
	modified:   pefile.cpp
2018-01-11 12:01:00 -08:00
John Reiser ee3f1292d0 fix editing rot for mach-o .dylib
https://github.com/upx/upx/issues/57
	modified:   p_mach.cpp
2018-01-11 11:33:15 -08:00
John Reiser cacb239040 work in progress for --android-shlib
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/src/arm64-linux.shlib-init.S
2018-01-11 09:39:26 -08:00
John Reiser 28d1789783 work in progress for --android-shlib
modified:   p_lx_elf.cpp
2018-01-08 14:04:38 -08:00
John Reiser 633eb98e34 Merge branch 'devel' into jreiser-android 2018-01-06 09:53:43 -08:00
John Reiser 4854c03096 uint64_t ==> upx_uint64_t
MSVC error C2065: 'uint64_t' : undeclared identifier
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_mach.cpp
2018-01-06 09:33:04 -08:00
John Reiser e853119c77 canonicalize bool in OR
MSVC error C4805: '|' : unsafe mix of type 'bool' and type 'unsigned int' in operation
	modified:   p_lx_elf.cpp
2018-01-06 09:20:46 -08:00
John Reiser 161a58bafb work in progress for --android-shlib
modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2018-01-06 09:18:17 -08:00
John Reiser f5fd94e815 Android shlib: work in progress
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-12-31 22:40:57 -08:00
John Reiser edde6210f1 amd64 linux stack align
forgotten as part of 4a35bf32ea
	modified:   stub/src/amd64-linux.elf-fold.S

	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
	modified:   ../.github/travis_testsuite_1.sh
2017-12-31 10:36:14 -08:00
John Reiser 507e19945e more checking of PT_DYNAMIC
https://github.com/upx/upx/issues/166
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-12-30 22:31:50 -08:00
John Reiser 4a35bf32ea static uClibc on amd64 passes entry.%rdx to 'atexit'
https://github.com/upx/upx/issues/166
	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main.c
2017-12-30 17:20:01 -08:00
John Reiser e04bf9e4bc more checking of PT_DYNAMIC
https://github.com/upx/upx/issues/164
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-12-28 17:40:04 -08:00
John Reiser c384d224c0 Mach-o stubs turn off DEBUG
Branch jreiser-macho has DEBUG 1
	modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
2017-12-27 10:23:19 -08:00
John Reiser 35427f998e Mach-o stubs turn off SIMULATE_ON_LINUX_EABI4
modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
2017-12-27 09:12:38 -08:00
John Reiser 1174da2bc3 arm64 stubs use NBPW in TRACE etc
modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.shlib-init.S
2017-12-26 16:39:51 -08:00
John Reiser 11e8a47030 DEBUG and TRACE for arm*-darwin.macho-* stubs
modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
2017-12-26 15:44:54 -08:00
John Reiser 8c4e9bcf0d typo
modified:   stub/src/arm.v4a-linux.elf-entry.S
2017-12-26 15:43:58 -08:00
John Reiser 9dfd624901 fix TRACE macro
modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
2017-12-26 15:43:01 -08:00
John Reiser 79e65503a9 Merge branch 'devel' into jreiser-macho 2017-12-26 10:41:26 -08:00
John Reiser 59f18b9d9f stash work-in-progress
modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
2017-12-22 23:07:03 -08:00
John Reiser fb3699fb89 stash work-in-progress
modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/amd64-darwin.macho-upxmain.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-fold.S
	modified:   stub/src/arm.v5a-darwin.macho-main.c
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/i386-darwin.macho-upxmain.c
2017-12-22 10:20:32 -08:00
John Reiser 9d2d59b5d2 stash work-in-progress
modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm64-darwin.macho-fold.S
2017-12-19 21:19:53 -08:00
John Reiser aefb2fa3c3 bad logic for throwCantUnpack("cmdsize") [simple]
https://github.com/upx/upx/issues/161
	modified:   p_mach.cpp
2017-12-19 17:36:22 -08:00
John Reiser e8aa80f904 stash work-in-progress
modified:   linker.cpp
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/arm64-darwin.macho-main.c
2017-12-19 17:32:15 -08:00
John Reiser 990988f920 More checking of input Phdr and Shdr
https://github.com/upx/upx/issues/157
	modified:   p_lx_elf.cpp
2017-12-18 10:36:43 -08:00
John Reiser 576d9a4e7e stash work-in-progress
modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/arm.v5a-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-entry.S
2017-12-17 15:02:57 -08:00
John Reiser 1d462ee424 MIPS shlib --lzma stub coding error: wrong register
https://github.com/upx/upx/issues/139 (part2)
	modified:   stub/src/mipsel.r3000-linux.shlib-init.S
2017-12-14 11:17:01 -08:00
John Reiser c9b09555c4 MH_PIE ASLR (Address-Space Layout Randomization)
modified:   stub/src/amd64-darwin.macho-main.c
2017-12-13 11:15:10 -08:00
John Reiser 860b5bf967 MH_EXECUTE diagnose syscall failure
modified:   stub/src/amd64-darwin.macho-fold.S
2017-12-13 10:53:22 -08:00
John Reiser 5063480a38 MH_EXECUTE runs under lldb, fails under shell
mmap  addr=0x100000000  len=0x3003  prot=0x3  flags=0x1012  fd=-1  off=0x0  reloc=0x0
maddr=0xffffffffffffffff  addr=0x100000000
	modified:   p_mach.cpp
	modified:   p_mach_enum.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-fold.S
	modified:   stub/src/amd64-darwin.macho-main.c
2017-12-13 09:54:44 -08:00
John Reiser 3400ae9dbe MH_EXECUTE leave space for thread state command
modified:   p_mach.cpp
2017-12-12 10:53:19 -08:00
John Reiser 3385264eb2 new DPRINTF
modified:   stub/src/amd64-darwin.macho-main.c
2017-12-12 10:52:47 -08:00
John Reiser 34646f1c6a fix braces in comment after #elif
modified:   stub/src/amd64-linux.elf-main.c
2017-12-12 10:51:38 -08:00
John Reiser 50aa63a5a0 declare write()
modified:   stub/src/include/darwin.h
2017-12-12 10:50:50 -08:00
John Reiser 64557bee43 Mach-o MH_EXECUTE rewrite; work-in-progress
The stub for amd64 gets to upx_main()
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-fold.S
	plus .h .bin.dump .map
2017-12-09 20:18:39 -08:00
John Reiser 7c21c4513e Android 64-bit ARM shared library stub: use 4Ki page size until more is known
https://github.com/upx/upx/issues/124
	modified:   p_lx_elf.cpp
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/src/arm64-linux.shlib-init.S
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-12-08 20:05:21 -08:00
John Reiser c6d6378005 Mach-o MH_EXECUTE rewrite; work-in-progress
The stub for amd64 gets into the de-compressed folded code.
	modified:   p_mach.cpp
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-upxmain.c
	modified:   stub/tmp/amd64-darwin.macho-entry.bin.dump
2017-12-06 17:04:47 -08:00
John Reiser 4f6979967d Mach-o MH_EXECUTE rewrite; work-in-progress
On amd64, otool and lldb accept the results.
The entry point points to the unfilter and uncompress routines.
Somehow _start has been lost.

	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_mach_enum.h
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-darwin.macho-upxmain.c
	modified:   stub/src/i386-darwin.macho-upxmain.c
	modified:   stub/src/powerpc-darwin.macho-upxmain.c
	modified:   stub/tmp/amd64-darwin.macho-entry.bin.dump
2017-12-03 23:17:55 -08:00
John Reiser e633c51b50 off_t_upx_stub typedef enables easier use of native #include
... but requires  #define __WORDSIZE
	modified:   p_mach.h
	modified:   stub/amd64-darwin.macho-fold.h
	modified:   stub/src/amd64-darwin.macho-main.c
	modified:   stub/src/arm.v5a-darwin.macho-main.c
	modified:   stub/src/arm64-darwin.macho-main.c
	modified:   stub/src/i386-darwin.macho-main.c
	modified:   stub/src/include/darwin.h
	modified:   stub/src/powerpc-darwin.macho-main.c
	modified:   stub/src/powerpc64le-darwin.macho-main.c
	modified:   stub/tmp/amd64-darwin.macho-fold.map
2017-11-28 14:49:46 -08:00
John Reiser 143f0accef PeFile check MZ offset to PE header
modified:   pefile.cpp
2017-11-21 13:07:42 -08:00
John Reiser b413f3da26 ELF shared library: PT_NOTE can prevent packing
Android build environment post-processing is adding a PT_NOTE
("Android", 21, "r16-beta1") at the high end of PT_LOAD[0],
above the stub; the runtime linker looks there before de-compression.
https://github.com/upx/upx/issues/124
	modified:   p_lx_elf.cpp
2017-11-20 10:08:24 -08:00
John Reiser 6eafa552bb Mach-o defend against bad crafted input
https://github.com/upx/upx/issues/146
	modified:   p_mach.cpp
2017-11-15 13:38:54 -08:00
John Reiser 7a0514d9b4 PeFile more checks for Section table
modified:   pefile.cpp
2017-11-12 21:47:47 -08:00
John Reiser 7e7565299e PeFile check Section table
https://github.com/upx/upx/issues/132
	modified:   pefile.cpp
2017-11-12 21:02:52 -08:00
László Molnár ed34a089c6 minor update for a memory derefencing check 2017-11-12 16:19:40 +01:00
John Reiser d14a2c5282 PeFile fix the recently-added interval checking.
https://github.com/upx/upx/issues/143
	modified:   pefile.cpp
2017-11-09 21:58:25 -08:00
John Reiser f014406b65 MemBuffer.subref(errfmt, skip, take) checks that a subinterval is inside
modified:   mem.cpp
	modified:   mem.h
2017-11-09 21:55:41 -08:00
John Reiser 58771ecca6 PeFile: better checking for import descriptors
modified:   pefile.cpp
2017-11-08 12:38:54 -08:00
John Reiser 5d9dcb634b PeFile: Defend against bad crafted import descriptors
https://github.com/upx/upx/issues/143
	modified:   pefile.cpp
	modified:   pefile.h
2017-11-08 11:07:46 -08:00
John Reiser 19c2c1edcf Android 8.0 (Oreo) wants 0!=.e_shstrndx in a shared library
https://github.com/upx/upx/issues/142
It should not matter what the .sh_name is; only the .sh_type matters.
	modified:   p_lx_elf.cpp
2017-11-07 11:12:23 -08:00
John Reiser 0430e7931e PowerPC64 stub: on syscall, real Linux trashes r13 and below
(except r1, r2, and input args!) So, r12 .e_entry for musl
must copy from a saved register.  [qemu-ppc64 doesn't trash registers!]
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	also .h  .fold.map
2017-10-27 20:07:32 -07:00
John Reiser bb8e607442 PowerPC64 musl 1.1.16 wants r12= .e_entry
modified:   stub/src/powerpc64le-linux.elf-fold.S
	also .h  .fold.map
2017-10-27 13:19:03 -07:00
John Reiser e61ada944d debug info for shared library on stderr under "-D"
modified:   p_lx_elf.cpp
2017-10-25 21:32:17 -07:00
John Reiser 46730315e3 stub arm64-linux.shlib-init.S saves 1 instr and checks for assembly errors
modified:   arm64-linux.shlib-init.S
	also .h .bin.dump
2017-10-24 12:50:29 -07:00
John Reiser 4869142034 arm64 stub for shared library uses AT_PAGESZ
modified:   stub/src/arm64-linux.shlib-init.S
	also .h .bin.dump
2017-10-23 18:55:28 -07:00
John Reiser 8e42e17bbf typo
modified:   stub/src/amd64-linux.elf-entry.S
2017-10-23 18:53:42 -07:00
John Reiser 38c8b84a26 Align hatch_off.
modified:   p_lx_elf.cpp
2017-10-20 17:23:55 -07:00
John Reiser c652626a37 32-bit shared libs reduce Phdr[1].p_align to 4096, like 64-bit.
This saves space when PAGE_SIZE is larger than 4096: MIPS, etc.
	modified:   p_lx_elf.cpp
2017-10-20 16:35:27 -07:00
John Reiser 06f6e47ebf Fix stub for MIPS shared libraries
https://github.com/upx/upx/issues/135
	modified:   p_lx_elf.cpp
	modified:   stub/src/mipsel.r3000-linux.shlib-init.S
	also .h .bin.dump
2017-10-20 16:16:35 -07:00
John Reiser 403b180b1d Compress shared libraries for mips and mipsel in ELF on Linux
modified:   p_lx_elf.cpp
	modified:   stub/Makefile
	new file:   stub/mips.r3000-linux.shlib-init.h
	new file:   stub/mipsel.r3000-linux.shlib-init.h
	new file:   stub/src/mips.r3000-linux.shlib-init.S
	new file:   stub/src/mipsel.r3000-linux.shlib-init.S
	new file:   stub/tmp/mips.r3000-linux.shlib-init.bin.dump
	new file:   stub/tmp/mipsel.r3000-linux.shlib-init.bin.dump
2017-10-19 13:47:36 -07:00
John Reiser ee008acfbd amd64 implements --is_ptinterp
https://github.com/upx/upx/issues/121
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-main.c
	also .h, .map, .bin.dump
2017-10-18 13:10:49 -07:00
John Reiser d149092ac0 Reference to external documentation only.
modified:   stub/src/arch/mips/r3000/macros.ash
2017-10-17 14:11:06 -07:00
John Reiser eafa136c69 Appease error C4146 unary minus operator applied to unsigned type, result still unsigned
Microsoft Optimizing Compiler 16.00.40219.01, 19.00.24215.1, 19.11.25507.1; others
	modified:   p_lx_elf.cpp
2017-10-17 08:44:08 -07:00
John Reiser 402c885987 Merge branch 'jreiser-elfstub' into devel
New stub strategy on Linux:  Linux adds too many other segments
to the address space: [vdso], [sigpage], ...; and qemu might
arrange them differently.  Thus the only reliable mappings
are the PT_LOAD of the compressed file itself; all other
address space is unknown!  First, the compressed file uses
.bss to occupy all unused pages up to the original brk(0).
Then at run time, the stub gets another mapping of /proc/self/exe,
and uncompresses the user program on top of the original pages.
[*BSD unchanged for now?]

	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   p_unix.cpp
	modified:   p_mach.cpp
	modified:   p_lx_sh.cpp
	modified:   p_lx_interp.cpp
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_lx_interp.h
	modified:   p_lx_sh.h
	modified:   p_mach.h
	modified:   p_unix.h
	modified:   stub/src/arch/mips/r3000/macros.ash
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/include/linux.h
	modified:   stub/Makefile
	modified:   ../.github/travis_testsuite_1.sh
	also .h .map .bin.dump
2017-10-14 14:26:11 -07:00
John Reiser 5e7e0508b9 sync stubs for "make run-testsuite"
modified:   ../.github/travis_testsuite_1.sh
2017-10-14 14:19:24 -07:00
John Reiser ff1d5fb794 stub for 64-bit little-endian PowerPC also uses TOC
modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/powerpc64le-linux.elf-fold.S
2017-10-14 13:54:43 -07:00
John Reiser ad3f63b5c4 stubs *.elf-main.c: tighten input to first decompress of ELF headers
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-main.c
	also .h, .map
2017-10-14 06:21:44 -07:00
John Reiser a3e51e6dee stub for PowerPC 64-bit big endian: accommodate musl bare .func as .e_entry
modified:   stub/src/powerpc64le-linux.elf-fold.S
2017-10-14 06:18:00 -07:00
John Reiser c1b9c79f54 arm,armeb stubs need endian-neutral code to set mflg_subr
modified:   stub/src/arm.v4a-linux.elf-entry.S
	also .h, .bin.dump
2017-10-13 12:27:07 -07:00
John Reiser e0bc040b0a mips stub uses new strategy
modified:   p_lx_elf.cpp
	modified:   stub/src/arch/mips/r3000/macros.ash
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	also .h, .bin.dump, .map
2017-10-12 21:04:10 -07:00
John Reiser 85eb4c7537 powerpc stub: used wrong register
modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
2017-10-11 17:17:45 -07:00
John Reiser 1f929d47d0 x86_64 stub also needs make_hatch()
https://github.com/upx/upx/issues/133
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   ../.github/travis_testsuite_1.sh
	also .h and .map
2017-10-11 09:06:50 -07:00
John Reiser 608662d73b x86_64 stub also needs make_hatch()
https://github.com/upx/upx/issues/133
	modified:   stub/src/amd64-linux.elf-main.c
2017-10-11 08:45:21 -07:00
John Reiser 7841d23e77 arm64: folded stub uses 64-bit TRACEing under DEBUG
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
2017-10-10 21:39:50 -07:00
John Reiser b72dda4ada arm64 spills a few registers because syscall can trash x18
modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
2017-10-10 20:31:11 -07:00
John Reiser c59c8a1ea2 readability; no functional change
modified:   stub/src/powerpc64le-linux.elf-entry.S
2017-10-10 20:30:41 -07:00
John Reiser 1522293be0 arm64: stub uses new strategy
modified:   p_lx_elf.cpp
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-main.c
	also .h, .map, .bin.dump
2017-10-10 14:51:03 -07:00
John Reiser b37bc99330 PowerPC64: stub uses new strategy
Needed: expert on TOC for big-endian.  glibc, musl, gcc disagree
on layout (is the .func first?) and usage for .e_entry.
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/Makefile
	also .h, .bin.dump, .map
2017-10-07 13:43:12 -07:00
John Reiser 7f905724b1 amd64: stub uses new strategy
modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   p_lx_elf.cpp
	also .h, .bin.dump, .map
2017-10-06 11:15:34 -07:00
John Reiser 2bf5bb1625 arm: stub uses new strategy
modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   p_lx_elf.cpp
	plus .h, .bin.dump, .map
2017-10-05 17:07:30 -07:00
John Reiser 08d3376740 Elf i386 stub: get enough space when unfolded code requires another page
modified:   src/i386-linux.elf-entry.S
2017-10-03 11:48:27 -07:00
John Reiser 7bace76176 Protect against bad crafted input.
https://github.com/upx/upx/issues/129
	modified:   p_lx_elf.cpp
2017-10-03 09:55:34 -07:00
John Reiser ef336dbcc6 Protect against bad crafted input.
https://github.com/upx/upx/issues/128
	modified:   p_lx_elf.cpp
2017-10-02 21:47:40 -07:00
John Reiser ca7217e717 powerpc: stub uses new strategy
First mmap must reserve enough space to decompress folded stub.
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	also .h, .map, .dump
2017-10-02 20:03:47 -07:00
John Reiser 3931cb7871 off_t is signed and long; keep the long when discarding the signed.
https://github.com/upx/upx/issues/127
	modified:   p_vmlinx.cpp
2017-10-01 16:14:09 -07:00
John Reiser 9e8de4abe5 i386: new stub strategy to avoid problems with early mmap layout
The stub occupies the same region that execve() would create
for the original progam.  The stub copies everything to a new area,
erases the original region, replaces it with the de-compressed
program, and erases the copy of itself via the escape hatch.
The copy is inexpensive via mmap() of /proc/self/exe.

	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-main.c

	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   p_lx_interp.cpp
	modified:   p_lx_interp.h
	modified:   p_lx_sh.cpp
	modified:   p_lx_sh.h
	modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_unix.cpp
	modified:   p_unix.h
	modified:   p_vmlinx.cpp

	plus .h, .map, .dump
2017-10-01 15:56:34 -07:00
John Reiser 26be845563 mips stubs: implement ET_DYN (-pie).
modified:   stub/src/mipsel.r3000-linux.elf-entry.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	plus associated *.h, *.bin.dump, and ../.github/travis_testsuite_1.sh
2017-09-26 10:05:22 -07:00
John Reiser 2f11a629fa Fix flub: "git --amend" after "git push" is not a good idea.
https://github.com/upx/upx/issues/126# Please enter the commit message for your changes. Lines starting
	modified:   arm64-linux.shlib-init.S
2017-09-25 11:43:38 -07:00
John Reiser a295437e11 Merge branch 'devel' of https://github.com/upx/upx into devel 2017-09-25 11:39:13 -07:00
John Reiser 04597fb804 Fix bug in unfilter for shlib on arm64.
https://github.com/upx/upx/issues/126
	modified:   stub/src/arm64-linux.shlib-init.S
	and associated *.h, *.bin.dump
2017-09-25 11:38:33 -07:00
John Reiser f2f002409b Fix bug in unfilter for shlib on arm64.
https://github.com/upx/upx/issues/126
	modified:   stub/src/arm64-linux.shlib-init.S
	and associated *.h, *.bin.dump
2017-09-25 11:31:44 -07:00
John Reiser 509de877ca Cleanup powerpc64 aux stub files.
modified:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/tmp/powerpc64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-09-24 20:30:07 -07:00
John Reiser 63aea4a7dc 64-bit Power PC linux uses 64KiB page size, but qemu-ppc64{,le} uses 4KiB.
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/include/linux.h
	modified:   stub/src/powerpc64le-linux.elf-fold.S
2017-09-24 20:24:46 -07:00
John Reiser 6470c748db Flush ACC_UNUSED(adrc); and its predecessors from stub for MIPS.
modified:   p_lx_elf.cpp
2017-09-24 20:07:31 -07:00
John Reiser 25a6429e6a Merge branch 'devel' of https://github.com/upx/upx into devel 2017-09-23 10:43:14 -07:00
John Reiser 4fa1c2a97e Avoid the stack in stub for PowerPC, especially under qemu-ppc.
modified:   stub/src/powerpc-linux.elf-entry.S

	also travis_testsuite_1.sh, -entry.h, -entry.bin.dump
2017-09-23 10:41:40 -07:00
Markus F.X.J. Oberhumer 9ad39d77cc Update Travis. 2017-09-21 10:15:01 +02:00
John Reiser 92527126a8 Adapt around qemu-arm placement of ET_DYN and stack.
modified:   stub/src/arm.v4a-linux.elf-entry.S

	modified:   ../.github/travis_testsuite_1.sh
	plus arm*.elf-entry.h, arm*.elf-entry.bin.dump
2017-09-20 15:23:12 -07:00
John Reiser 02b4a4c974 Sync testsuite checksums.
modified:   ../.github/travis_testsuite_1.sh
2017-09-20 13:37:38 -07:00
John Reiser ede570be21 Spend 8 instructions to avoid modifying [0xf7000000, +) under qemu-arm.
modified:   src/arm.v4a-linux.elf-entry.S
	modified:   src/arm.v4a-linux.elf-fold.S

	plus arm*.h and tmp/arm*.{dump,map}
2017-09-20 13:31:38 -07:00
John Reiser 08627e9df5 Fix some AT_PHDR problems, at least on x86*.
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-main.c

	modified:   ../.github/travis_testsuite_1.sh
	plus many *.elf-fold.h and *.elf-fold.map
2017-09-18 19:54:27 -07:00
John Reiser 6d9f3adc86 Escape hatch for Thumb-mode shared library must reside at even address.
https://github.com/upx/upx/issues/122
	modified:   stub/src/arm.v4t-linux.shlib-init.S

	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/tmp/arm.v5t-linux.shlib-init.bin.dump
2017-09-13 22:38:24 -07:00
John Reiser 96433b4e39 FILTER_ID was wrong for arm64-linux.shlib and arm64-darwin.macho.
https://github.com/upx/upx/issues/100  (partial)
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/arm64-linux.shlib-init.S
	modified:   p_mach.cpp

	modified:   stub/arm64-darwin.macho-fold.h
	modified:   stub/arm64-linux.shlib-init.h
2017-08-25 12:51:33 -07:00
John Reiser f4947cc2ae Work-around Ubuntu runtime bug loading shlib on ARM.
Use --android-shlib to activate the work-around.
https://bugs.launchpad.net/bugs/1712938
https://github.com/upx/upx/issues/116
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2017-08-24 19:52:30 -07:00
John Reiser 7b554d4f72 ucl-1.03 needs help for recent gcc and for native on aarch64.
modified:   README.SRC
2017-08-23 05:47:16 -07:00
John Reiser 5b54544438 Fix powerpc64 (BIG_ENDIAN and comments)
modified:   stub/src/arch/powerpc/64/lzma_d.S
	modified:   stub/src/arch/powerpc/64le/lzma_d-common.S
	modified:   stub/src/powerpc64-linux.elf-main.c
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.kernel.vmlinux.S

	plus stub/powerpc64*entry.h and .dump
2017-07-26 11:16:02 -07:00
Markus F.X.J. Oberhumer ef78d23494 Update Travis and check_whitespace.sh. 2017-07-23 02:59:51 +02:00
Markus F.X.J. Oberhumer ef8a7f330d Silence some compiler warnings. 2017-07-23 02:59:51 +02:00
Markus F.X.J. Oberhumer b72e0f3060 Disable debugging section. 2017-07-23 02:59:51 +02:00
Markus F.X.J. Oberhumer 2a0bab938b Rebuild stubs. 2017-07-23 02:20:05 +02:00
Markus F.X.J. Oberhumer cd637629c4 Update stub/src/arch/powerpc Makefiles. 2017-07-23 02:18:39 +02:00
John Reiser b9adfd801d Compile powerpc64 using powerpc64-linux-gcc-4.9.2 from stubtools
modified:   src/arch/powerpc/64/Makefile.extra
2017-07-22 16:14:12 -07:00
Markus F.X.J. Oberhumer 69355514c9 Fix some misspellings. 2017-07-22 12:54:37 +02:00
Markus F.X.J. Oberhumer 33dc947c21 clang-format files. 2017-07-22 12:47:45 +02:00
John Reiser 6de021d8d8 Fix MIPS, at least ET_EXEC.
ET_DYN not tested.  Also /proc/self/exe is not proected [use getenv("   ")]
	modified:   p_lx_elf.cpp
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   ../.github/travis_testsuite_1.sh

	also .h .dump .map for mips
2017-06-27 20:53:44 -07:00
John Reiser 9be86621bf PowerPC64 unifies into amd64-linux.elf-main.c
Also reconcile ppc32 and ppc64, especially *.S
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   ../.github/travis_testsuite_1.sh

	also corresponding *.h *.map *.dump
2017-06-27 14:58:13 -07:00
John Reiser a7a0876298 /proc/self/exe in powerpc64*.S stub; unify with powerpc*.S.
modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   .github/travis_testsuite_1.sh

	also corresponding *.h *.dump *.map files
2017-06-26 21:40:12 -07:00
John Reiser 31b42345c3 Fix nesting brace in comment on #endif.
modified:   i386-linux.elf-main.c
2017-06-26 21:31:36 -07:00
John Reiser 1b172e729e Fix stub for powerpc64, powerpc64le
modified:   src/powerpc64le-linux.elf-fold.S
2017-06-25 16:03:43 -07:00
John Reiser 3bf387a2d4 PowerPC stub unified with i386; including escape hatch [munmap all extras]
modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c
	modified:   ../.github/travis_testsuite_1.sh

	{arm.*,i386,mips*.r3000,powerpc}-linux.elf-fold.{h,map}
	powerpc-*-entry.*
2017-06-24 18:37:16 -07:00
John Reiser 9f20bbb046 Fix merge 2017-06-19 16:01:35 -07:00
John Reiser 82af555974 Merge branch 'i386-VDSO' into devel 2017-06-19 15:58:22 -07:00
John Reiser 50638b5213 i386 VDSO may conflict on low side of -pie ET_DYN
https://github.com/upx/upx/issues/105
	modified:   stub/src/i386-linux.elf-entry.S

	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
2017-06-19 15:49:28 -07:00
John Reiser 650df95b72 Fix thinko in PackMachBase<T>::canUnpack(). Also detect more bad input values.
https://github.com/upx/upx/issues/109
	modified:   p_mach.cpp
2017-06-18 14:24:44 -07:00
John Reiser b2115a4162 i386: clear the stack when leaving (for buggy programs); align esp to 0 mod 8
modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-fold.map
2017-06-16 21:36:21 -07:00
John Reiser d67bf16a08 i386: Separate PROT_EXEC and PROT_WRITE
Also affects some arm and mips (via sharing i386-linux.elf-main.c)
	modified:   i386-linux.elf-entry.S
	modified:   i386-linux.elf-main.c

	also .h, .map, .dump
2017-06-16 08:17:44 -07:00
John Reiser a4c9b64224 PowerPC: fix ET_EXEC [merge problems?] Next: -pie
modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c

	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
2017-06-14 20:00:30 -07:00
John Reiser 8f572e5fe6 Rewrite stubs for 32-bit arm and i386 for -pie (Position-Independent Executable)
Coming next: MIPS and PowerPC.
	modified:   p_lx_elf.cpp
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   ../.github/travis_testsuite_1.sh

	also associated *.h *.map *.dump files
2017-06-14 09:57:19 -07:00
John Reiser e58873044b Remove unused and obsolete macros do_dcache_flush and do_icache_invalidate
modified:   stub/src/arch/arm64/v8/macros.S
2017-06-14 09:35:05 -07:00
John Reiser 8ada92a69f "Drive-by" typo fix
modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/arm64-darwin.macho-entry.h
2017-06-14 09:33:41 -07:00
John Reiser 3c8ed5c000 Fix typo under "#if 0"
modified:   packer.cpp
2017-06-10 22:11:04 -07:00
John Reiser c127d5b64a o_binfo got in the way
modified:   stub/src/i386-linux.elf-entry.S
2017-06-10 14:03:05 -07:00
John Reiser 2d3bd0809a i386-linux.elf-fold.S avoids mmap() into stack
modified:   stub/src/i386-linux.elf-fold.S
	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-fold.map
2017-06-09 14:38:08 -07:00
John Reiser eef955a9dd Fix arm.v4a-linux.elf-entry.S
modified:   stub/src/arm.v4a-linux.elf-entry.S

	modified:   stub/arm.v4a-linux.elf-entry.h
	modified:   stub/arm.v5a-linux.elf-entry.h
	modified:   stub/armeb.v4a-linux.elf-entry.h
	modified:   stub/tmp/arm.v4a-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm.v5a-linux.elf-entry.bin.dump
	modified:   stub/tmp/armeb.v4a-linux.elf-entry.bin.dump
	modified:   ../.github/travis_testsuite_1.sh
2017-06-08 20:50:57 -07:00
John Reiser e59ce39dc6 Fix arm64-linux.elf-*
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-main.c

	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
2017-06-08 17:23:19 -07:00
John Reiser 62815f5c3c Fix AT_PHDR and AT_ENTRY for amd64-linux.elf (-pie, libmusl)
modified:   stub/src/amd64-linux.elf-main.c

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
2017-06-07 09:04:02 -07:00
John Reiser f496010273 Fix reloc of stub for amd64-linux.elf
modified:   stub/src/arm64-linux.elf-main.c

	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/tmp/arm64-linux.elf-fold.map
2017-06-07 09:01:37 -07:00
John Reiser 143c4e3322 Fix MH_EXECUTE for amd64-darwin.macho
modified:   p_mach.cpp
	modified:   stub/src/amd64-darwin.macho-entry.S

	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/tmp/amd64-darwin.macho-entry.bin.dump
2017-06-07 08:58:20 -07:00
John Reiser e7f1e99a5e Merge branch 'jreiser' into devel
O_BINFO simplifies stubs on linux Elf;
PowerPC64 (big endian: Apple Macintosh G5) and PowerPC* cleanup;
-fpie simplification; shlib for arm64, amd64.

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

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

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

	and most stub/*.h and stub/tmp/*.dump
2017-06-05 11:32:25 -07:00
John Reiser 140a031515 arm64-linux.shlib-init
modified:   p_lx_elf.cpp
	modified:   stub/src/arm64-linux.shlib-init.S

	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-06-04 16:52:43 -07:00
John Reiser b7c91941b8 --android-shlib fix Elf64_Shdr.sh_offset
https://github.com/upx/upx/issues/100
	modified:   ../p_lx_elf.cpp
	modified:   ../p_lx_elf.h
2017-05-31 11:04:56 -07:00
John Reiser 33f0b6da67 Merge branch 'devel' of https://github.com/upx/upx into devel 2017-05-31 10:57:19 -07:00
John Reiser ee18fe9bba DF_1_PIE and calls_crt1() to handle part of -pie,-fPIE
https://github.com/upx/upx/issues/106  [partial]
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-05-31 10:53:55 -07:00
John Reiser a51330cf07 DF_1_PIE and calls_crt1() to handle part of -pie,-fPIE
https://github.com/upx/upx/issues/106  [partial]
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-05-30 13:43:06 -07:00
John Reiser a67aed2744 Merge branch 'devel' of https://github.com/upx/upx into devel 2017-05-30 11:33:39 -07:00
John Reiser d979e19315 fpad8() for --android-shlib in PackLinuxElf64::pack4()
https://github.com/upx/upx/issues/100
	modified:   p_lx_elf.cpp
2017-05-30 11:32:05 -07:00
Markus F.X.J. Oberhumer 4c74d16795 Avoid a compilation warning. clang-format files. 2017-05-28 11:32:12 +02:00
John Reiser 6e541a432f amd64-linux: DF_1_PIE marks a main program; stub juggles AT_PHDR for same
https://github.com/upx/upx/issues/105
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
2017-05-27 19:54:12 -07:00
John Reiser d8f47e248a Handle old style 8-byte headers for version <= 11
https://github.com/upx/upx/issues/102
	modified:   p_unix.cpp
2017-05-26 13:05:12 -07:00
John Reiser d1a869496b More visibility for PackHeader when debug(-D)
modified:   packhead.cpp
	modified:   packmast.cpp
	modified:   pefile.h
2017-05-26 13:02:32 -07:00
John Reiser f42a37555d Merge branch 'devel' of https://github.com/upx/upx into devel 2017-05-21 20:48:05 -07:00
John Reiser d9e019bd87 amd64-darwin.dylib hacking
modified:   stub/src/amd64-darwin.dylib-entry.S

	modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/tmp/amd64-darwin.dylib-entry.bin.dump
2017-05-17 21:36:40 -07:00
John Reiser ce194fa5d8 amd64-darwin.dylib hacking
modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   p_mach_enum.h
	modified:   stub/src/amd64-darwin.dylib-entry.S

	modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/tmp/amd64-darwin.dylib-entry.bin.dump
2017-05-17 15:50:34 -07:00
Markus F.X.J. Oberhumer b5bdf57636 Minor cleanups. 2017-05-14 19:21:04 +02:00
Markus F.X.J. Oberhumer a3a81ce7c6 Update NEWS. 2017-05-13 20:44:02 +02:00
Markus F.X.J. Oberhumer 61f347401c Update testsuite checksums caused by version bump. 2017-05-12 15:35:24 +02:00
Markus F.X.J. Oberhumer d985a4c250 Post-release version bump. 2017-05-12 15:28:47 +02:00
Markus F.X.J. Oberhumer d31947e1f0 Update NEWS. 2017-05-12 13:01:20 +02:00
Markus F.X.J. Oberhumer e4659b7d7c Bump release date. 2017-05-12 12:47:14 +02:00
Markus F.X.J. Oberhumer 8827a534db Update Travis. 2017-05-12 12:45:43 +02:00
Markus F.X.J. Oberhumer ddf48b45a5 Update Travis. 2017-05-09 22:50:18 +02:00
John Reiser 8eabb9b02f i386 recover from merge
modified:   p_lx_elf.cpp
2017-05-08 18:54:41 -07:00
John Reiser 8a195a0b35 amd64 recover from merge
modified:   stub/src/amd64-linux.elf-fold.S

	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
2017-05-08 16:06:02 -07:00
John Reiser 955206aaf0 Merge branch 'devel' into jreiser
Conflicts:
	src/p_lx_elf.cpp
	src/stub/src/amd64-linux.elf-entry.S
	src/stub/src/amd64-linux.elf-main.c
	src/stub/src/arm.v4a-linux.elf-entry.S
	src/stub/src/arm.v4a-linux.elf-fold.S
	src/stub/src/arm64-linux.elf-entry.S
	src/stub/src/arm64-linux.elf-fold.S
	src/stub/src/i386-linux.elf-fold.S
	src/stub/src/powerpc-darwin.macho-entry.S
	src/stub/src/powerpc-linux.elf-fold.S
	src/stub/src/powerpc64le-darwin.macho-entry.S
	src/stub/src/powerpc64le-linux.elf-entry.S
	src/stub/src/powerpc64le-linux.elf-fold.S
	src/stub/src/powerpc64le-linux.elf-main.c

 Changes to be committed:
	modified:   ../.github/ISSUE_TEMPLATE.md
	modified:   ../.github/travis_build.sh
	modified:   ../.github/travis_deploy.sh
	modified:   ../.github/travis_init.sh
	modified:   ../.github/travis_testsuite_1.sh
	modified:   ../.gitignore
	modified:   ../.travis.yml
	modified:   ../NEWS
	modified:   c_screen.cpp
	modified:   file.cpp
	modified:   help.cpp
	modified:   linker.cpp
	modified:   main.cpp
	modified:   p_lx_elf.cpp
	modified:   packer.cpp
	modified:   s_djgpp2.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc-darwin.dylib-entry.S
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.macho-fold.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   ui.cpp
	modified:   util.cpp
	modified:   work.cpp
	[plus *.h, *.dump, *.map]
2017-05-08 14:21:31 -07:00
John Reiser 082dd7d5ee arm64 TRACE improvement
modified:   stub/src/arm64-linux.elf-entry.S

	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
2017-05-07 12:07:51 -07:00
John Reiser 90714cf624 arm64 tracing in stub
modified:   ../../linker.cpp
	modified:   ../../p_lx_elf.cpp
	modified:   arm64-linux.elf-entry.S
2017-05-06 19:37:37 -07:00
John Reiser 61798d33f0 Revamp stub on arm, arm64; mmap into stack defeats auto-expansion [kernel bug?]
modified:   stub/src/arm.v4a-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/arm.v4a-linux.elf-fold.h
	modified:   stub/arm.v5a-linux.elf-fold.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/armeb.v4a-linux.elf-fold.h
	modified:   stub/tmp/arm.v4a-linux.elf-fold.map
	modified:   stub/tmp/arm.v5a-linux.elf-fold.map
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/armeb.v4a-linux.elf-fold.map
2017-05-05 18:36:44 -07:00
John Reiser 6e2a41cb26 DPRINTF for amd64
modified:   Makefile
	modified:   src/amd64-linux.elf-fold.S
	modified:   src/amd64-linux.elf-main.c

	modified:   amd64-linux.elf-fold.h
	modified:   tmp/amd64-linux.elf-fold.map
2017-05-05 13:32:42 -07:00
John Reiser 515897e180 Allow Elf64_Ehdr::ELFOSABI_NONE on Linux; cater to EM_PPC64.e_flags quirk
modified:   p_lx_elf.cpp
2017-05-04 08:28:03 -07:00
John Reiser fe4a8f33b1 Start on darwin.macho-dylib
modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   packmast.cpp
2017-05-03 08:30:21 -07:00
Markus F.X.J. Oberhumer 304d848f53 Bump version date. 2017-05-03 13:49:22 +02:00
Markus F.X.J. Oberhumer b5f738abf3 Move xxx_le26 from miniacc.h to bele.h. 2017-05-03 13:25:10 +02:00
Markus F.X.J. Oberhumer 7ebed06393 Fix building with recent djgpp2 gcc-6 version. 2017-05-03 13:21:08 +02:00
Markus F.X.J. Oberhumer 2e56fe82bb Update Travis. 2017-05-01 10:37:07 +02:00
John Reiser 32019c61aa dynamic e_phnum for arm
modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/arm.v4a-linux.elf-entry.h
	modified:   stub/arm.v4a-linux.elf-fold.h
	modified:   stub/arm.v5a-linux.elf-entry.h
	modified:   stub/arm.v5a-linux.elf-fold.h
	modified:   stub/armeb.v4a-linux.elf-entry.h
	modified:   stub/armeb.v4a-linux.elf-fold.h
	modified:   stub/tmp/arm.v4a-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm.v4a-linux.elf-fold.map
	modified:   stub/tmp/arm.v5a-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm.v5a-linux.elf-fold.map
	modified:   stub/tmp/armeb.v4a-linux.elf-entry.bin.dump
	modified:   stub/tmp/armeb.v4a-linux.elf-fold.map
2017-04-30 19:15:17 -07:00
John Reiser f7ffae565c dynamic e_phnum for arm64
modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S

	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
2017-04-30 13:13:53 -07:00
John Reiser cd11bb1606 Update AT_BASE for musl-libc
https://github.com/upx/upx/issues/93
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/i386-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-main.c

	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
	modified:   ../.github/travis_testsuite_1.sh
2017-04-27 20:55:02 -07:00
John Reiser 24c924d668 Fix size of 'imul'
modified:   src/stub/src/i386-linux.elf-fold.S
	modified:   src/p_lx_elf.cpp

	modified:   .github/travis_testsuite_1.sh
	modified:   src/stub/i386-linux.elf-fold.h
	modified:   src/stub/tmp/i386-linux.elf-fold.map
2017-04-26 15:24:19 -07:00
John Reiser 9be94e4b58 Fix size of 'imul'
modified:   stub/src/amd64-linux.elf-entry.S

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
2017-04-24 17:12:55 -07:00
John Reiser 15e9d8c99d Recognize __libc_init for Android -pie (PositionIndependentExecutable)
based on https://github.com/upx/upx/pull/92/commits/d34887ef60304cb28990c4b99c17b1f91acbbef1
	modified:   p_lx_elf.cpp
2017-04-24 11:04:48 -07:00
John Reiser 391f511094 powerpc-linux.elf-fold.S and -main.c handle /proc/self/exe
modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c

	modified:   stub/tmp/amd64-linux.elf-fold.map
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
2017-04-22 20:18:00 -07:00
John Reiser 5b53c11a6b Sync powerpc-linux.elf testsuite
modified:   travis_testsuite_1.sh
2017-04-21 11:30:12 -07:00
John Reiser 9df4b6ea24 Sync SZ_FRAME with devel branch
modified:   src/arch/powerpc/32/ppc_regs.h
	modified:   src/arch/powerpc/64le/ppc_regs.h
	modified:   src/powerpc64le-linux.elf-entry.S
	modified:   src/powerpc64le-linux.elf-fold.S
2017-04-21 10:54:04 -07:00
John Reiser a440564ba4 Fix powerpc64le ABI stack frame omitting spill area for a0-a7
Also use new symbol SZ_FRAME in */ppc_regs.h
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/powerpc-darwin.dylib-entry.S
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.macho-fold.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S

	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-darwin.macho-fold.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-darwin.macho-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/tmp/powerpc64le-darwin.macho-fold.map
2017-04-21 08:58:13 -07:00
John Reiser 9583cfcc93 Update NEWS 2017-04-19 19:55:39 -07:00
John Reiser c4a921283a Revamp powerpc{,64le,64}.
Fix 64-bit stack frame (8*8 bytes for spilling a0-a7).  Avoid using r2 (t0).
Prepare for -pie executables.  Prepare for unified strategy in stubs.

	modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-main.c
	modified:   stub/src/arch/powerpc/32/bxx.S
	modified:   stub/src/arch/powerpc/32/lzma_d.S
	modified:   stub/src/arch/powerpc/32/nrv2b_d.S
	modified:   stub/src/arch/powerpc/32/nrv2d_d.S
	modified:   stub/src/arch/powerpc/32/nrv2e_d.S
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	new file:   stub/src/arch/powerpc/64/Makefile
	new file:   stub/src/arch/powerpc/64/Makefile.extra
	new file:   stub/src/arch/powerpc/64/lzma_d.S
	new file:   stub/src/arch/powerpc/64/lzma_d_cf.S
	new file:   stub/src/arch/powerpc/64/lzma_d_cs.S
	modified:   stub/src/arch/powerpc/64le/bxx.S
	copied:     stub/src/arch/powerpc/64le/lzma_d.S -> stub/src/arch/powerpc/64le/lzma_d-common.S
	modified:   stub/src/arch/powerpc/64le/lzma_d.S
	modified:   stub/src/arch/powerpc/64le/lzma_d_cs.S
	modified:   stub/src/arch/powerpc/64le/nrv2b_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2d_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2e_d.S
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/i386-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.dylib-entry.S
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.macho-fold.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c
	modified:   stub/src/powerpc64-darwin.dylib-entry.S
	modified:   stub/src/powerpc64-darwin.macho-entry.S
	modified:   stub/src/powerpc64-darwin.macho-fold.S
	modified:   stub/src/powerpc64-darwin.macho-main.c
	modified:   stub/src/powerpc64-linux.elf-main.c
	modified:   stub/src/powerpc64-savegpr0.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S

	modified:   stub/i386-darwin.macho-entry.h
	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-darwin.macho-fold.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc-linux.kernel.vmlinux.h
	modified:   stub/powerpc64-linux.elf-entry.h
	modified:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-darwin.macho-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
	modified:   stub/tmp/i386-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc-darwin.dylib-entry.bin.dump
	modified:   stub/tmp/powerpc-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-darwin.dylib-entry.bin.dump
	modified:   stub/tmp/powerpc64le-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.kernel.vmlinux.bin.dump
2017-04-19 19:25:05 -07:00
John Reiser 4e05f087f9 PowerPC 64-bit big-endian
modified:   conf.h
	modified:   linker.cpp
	modified:   linker.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/powerpc-linux.elf-entry.h
	new file:   stub/powerpc64-linux.elf-entry.h
	new file:   stub/powerpc64-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/scripts/xstrip.py
	modified:   stub/src/arch/powerpc/64le/nrv2b_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2d_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2e_d.S
	new file:   stub/src/powerpc64-darwin.dylib-entry.S
	new file:   stub/src/powerpc64-darwin.macho-entry.S
	new file:   stub/src/powerpc64-darwin.macho-fold.S
	new file:   stub/src/powerpc64-darwin.macho-main.c
	new file:   stub/src/powerpc64-linux.elf-entry.S
	new file:   stub/src/powerpc64-linux.elf-fold.S
	new file:   stub/src/powerpc64-linux.elf-fold.lds
	new file:   stub/src/powerpc64-linux.elf-main.c
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-04-11 19:15:43 -07:00
John Reiser 40b506d2e0 Sync arm* stubs
modified:   ../arm.v4a-linux.elf-entry.h
	modified:   ../arm.v4a-linux.elf-fold.h
	modified:   ../arm.v5a-linux.elf-entry.h
	modified:   ../arm.v5a-linux.elf-fold.h
	modified:   ../arm64-darwin.macho-entry.h
	modified:   ../arm64-linux.elf-entry.h
	modified:   ../arm64-linux.elf-fold.h
	modified:   ../armeb.v4a-linux.elf-entry.h
	modified:   ../armeb.v4a-linux.elf-fold.h
	modified:   ../tmp/arm.v4a-linux.elf-entry.bin.dump
	modified:   ../tmp/arm.v4a-linux.elf-fold.map
	modified:   ../tmp/arm.v5a-linux.elf-entry.bin.dump
	modified:   ../tmp/arm.v5a-linux.elf-fold.map
	modified:   ../tmp/arm64-darwin.macho-entry.bin.dump
	modified:   ../tmp/arm64-linux.elf-entry.bin.dump
	modified:   ../tmp/armeb.v4a-linux.elf-entry.bin.dump
	modified:   ../tmp/armeb.v4a-linux.elf-fold.map
2017-04-11 19:13:11 -07:00
John Reiser 263f384810 o_binfo
modified:   arm64-darwin.macho-entry.S
2017-04-11 19:07:38 -07:00
John Reiser d80c145a18 PROT_EXEC for decompressed 'fold'
modified:   powerpc-linux.elf-entry.S
2017-04-10 15:36:43 -07:00
Markus F.X.J. Oberhumer 8848fe35f6 Update Travis. 2017-04-10 16:15:03 +02:00
John Reiser 7a681bd20d Use saved registers for parameters to 'fold'; lzma can clobber others
modified:   arm64-linux.elf-entry.S
	modified:   arm64-linux.elf-fold.S
2017-04-09 21:33:29 -07:00
John Reiser ed31fb184b Replace crumb with b_info
modified:   stub/src/arm.v4a-linux.elf-entry.S
	modified:   stub/src/arm.v4a-linux.elf-fold.S
2017-04-09 18:06:16 -07:00
John Reiser 360b94dd6c i386-linux ET_EXEC working
modified:   stub/src/i386-linux.elf-fold.S

	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-fold.map
2017-04-07 16:08:13 -07:00
John Reiser 8524e73f59 Always a 1-page crumb for i386
modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S

	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
2017-04-07 11:17:01 -07:00
John Reiser 940514e5ca Sync stubs
modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-04-07 10:09:01 -07:00
John Reiser a4e47625ac Sync stubs
modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-04-07 08:23:30 -07:00
John Reiser 7c16872a6e Merge branch 'devel' into jreiser 2017-04-07 08:22:08 -07:00
John Reiser 994c3c3552 Use arm64-linux-objdump-2.25 and arm64-linux-objcopy-2.25
modified:   Makefile.extra

	modified:   lzma_d_cf.S
	modified:   lzma_d_cs.S
2017-04-07 07:20:47 -07:00
John Reiser c34f496600 Avoid incorrect C4319 by Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24215.1 for x64
modified:   p_lx_elf.cpp
2017-04-07 05:36:40 -07:00
John Reiser 8bca8629be Preserve symlink /proc/self/exe by mapping one page into the stack.
modified:   stub/src/amd64-linux.elf-fold.S

	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-fold.map
2017-04-06 23:08:35 -07:00
John Reiser 85fdd579d6 Cleanup PackLinuxElf64amd::defineSymbols(): use is_pie; reduce symbols
modified:   p_lx_elf.cpp
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S

	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
	modified:   stub/tmp/amd64-linux.elf-fold.map
2017-04-06 17:22:30 -07:00
John Reiser e88d2ff88c Merge branch 'devel' into jreiser
modified:   ../.appveyor.yml
	modified:   ../.github/travis_build.sh
	modified:   Makefile
	modified:   linker.cpp
	modified:   p_lx_elf.cpp
	modified:   packmast.cpp
2017-04-06 14:25:14 -07:00
John Reiser bdf08baebd O_BINFO
modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/i386-bsd.elf-entry.h
	modified:   stub/i386-darwin.macho-entry.h
	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/i386-netbsd.elf-entry.h
	modified:   stub/mips.r3000-linux.elf-fold.h
	modified:   stub/mipsel.r3000-linux.elf-fold.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-darwin.macho-entry.S
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/amd64-linux.elf-fold.S
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/i386-bsd.elf-entry.S
	modified:   stub/src/i386-darwin.macho-entry.S
	modified:   stub/src/i386-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/mipsel.r3000-linux.elf-fold.S
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-main.c
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   stub/tmp/amd64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
	modified:   stub/tmp/amd64-linux.elf-fold.map
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-bsd.elf-entry.bin.dump
	modified:   stub/tmp/i386-darwin.macho-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-fold.map
	modified:   stub/tmp/i386-netbsd.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-04-06 14:22:47 -07:00
John Reiser 3dcdd25177 re-work -fpie for amd64
modified:   stub/src/amd64-linux.elf-main.c
2017-04-06 14:22:05 -07:00
John Reiser 491e8640b2 is_pie; O_BINFO; remove LUNMP000, LUNMP001
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-04-06 14:15:07 -07:00
John Reiser b23b7ef85e DT_FLAGS_1, DF_1_PIE
modified:   p_elf_enum.h
2017-04-06 14:13:02 -07:00
John Reiser b167374f13 R_PPC64_ADDR32
modified:   linker.cpp
2017-04-06 14:12:29 -07:00
John Reiser cd1f6e733f Merge branch 'devel' of https://github.com/upx/upx into devel 2017-04-06 09:05:46 -07:00
John Reiser d3fc7687b8 Fix valgrind error
https://travis-ci.org/upx/upx/jobs/218929378
	modified:   p_lx_elf.cpp
2017-04-06 09:04:13 -07:00
Markus F.X.J. Oberhumer 17a83d58da clang-format files. 2017-04-05 17:15:29 +02:00
Markus F.X.J. Oberhumer 18a8e1b6d6 Update Travis. 2017-04-05 17:02:46 +02:00
Markus F.X.J. Oberhumer 2c23cbb359 Silence some compiler warnings. 2017-04-05 17:02:42 +02:00
Markus F.X.J. Oberhumer cdd58cf757 Use proper UPX types. 2017-04-05 16:31:36 +02:00
John Reiser a0df325659 Merge branch 'devel' of https://github.com/upx/upx into devel 2017-04-03 20:26:23 -07:00
John Reiser a59005e836 Elf propagates NX via PT_GNU_STACK (except MIPS stub is too difficult for now)
https://github.com/upx/upx/issues/81
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-fold.map
	modified:   stub/tmp/powerpc-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-04-03 20:25:57 -07:00
John Reiser 5da6a27e6b Elf propates NX via PT_GNU_STACK (except MIPS stub is too difficult for now)
https://github.com/upx/upx/issues/81
	modified:   ../.github/travis_testsuite_1.sh
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/i386-linux.elf-fold.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/src/amd64-linux.elf-entry.S
	modified:   stub/src/i386-linux.elf-fold.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/tmp/amd64-linux.elf-entry.bin.dump
	modified:   stub/tmp/i386-linux.elf-fold.map
	modified:   stub/tmp/powerpc-linux.elf-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-04-03 20:11:08 -07:00
John Reiser ef97af71e3 Merge branch 'jreiser' into devel 2017-04-03 12:57:57 -07:00
John Reiser 6ed67f4532 Unpack prefix with appended data; give message, keep backup
https://github.com/upx/upx/issues/4
	modified:   p_mach.cpp
2017-04-03 12:53:27 -07:00
John Reiser 1278d663b4 Merge branch 'jreiser' into devel 2017-04-02 14:56:26 -07:00
John Reiser 0395c7b407 Use stubtools for arm64.
modified:   stub/Makefile
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-04-02 14:55:39 -07:00
John Reiser df3d15ffb3 Enable stub for arm64 shlib. Stub is broken, but at least it packs.
modified:   p_lx_elf.cpp
2017-03-31 20:01:14 -07:00
John Reiser 6f673310d2 powerpc64le: lzma compression support
https://github.com/upx/upx/pull/79

Integration based on:
commit c4bde4369f
Author: Thierry Fauck <tfauck@free.fr>
Date:   Fri Mar 24 17:39:30 2017 +0100

    powerpc64le: lzma compression support

    Signed-off-by: Thierry Fauck <tfauck@free.fr>

    	modified:   powerpc64le-darwin.dylib-entry.h
    	modified:   powerpc64le-darwin.macho-entry.h
    	modified:   powerpc64le-linux.elf-entry.h
    	modified:   powerpc64le-linux.kernel.vmlinux.h
    	modified:   src/arch/powerpc/64le/lzma_d.S
    	modified:   tmp/powerpc64le-darwin.dylib-entry.bin.dump
    	modified:   tmp/powerpc64le-darwin.macho-entry.bin.dump
    	modified:   tmp/powerpc64le-linux.elf-entry.bin.dump
    	modified:   tmp/powerpc64le-linux.kernel.vmlinux.bin.dump
2017-03-31 13:42:43 -07:00
John Reiser 978c3eca23 --android-shlib preserves selected Elf64_Shdr
https://github.com/upx/upx/issues/65
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-03-31 13:26:27 -07:00
John Reiser 20bc848bd6 --android-shlib preserves selected Elf64_Shdr
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-03-31 13:24:36 -07:00
John Reiser ce7f1292dc Merge branch 'devel' into jreiser 2017-03-31 13:10:08 -07:00
John Reiser d97ff8bb40 More cleanup
modified:   p_lx_elf.cpp
2017-03-31 12:57:11 -07:00
John Reiser 8a9b46d82f Cleanup minor bug in unpack ET_EXE
modified:   p_lx_elf.cpp
2017-03-31 12:42:14 -07:00
John Reiser 12e5703541 Stronger test and better message for PT_LOAD[0].p_offset != 0
https://github.com/upx/upx/issues/80
	modified:   p_lx_elf.cpp
2017-03-31 12:20:02 -07:00
John Reiser 1b87fc2ee6 DT_INIT restored for -d on --android-shlib
modified:   p_lx_elf.cpp
2017-03-30 15:55:35 -07:00
John Reiser ebd0c780a1 Unpacking --android-shlib works except for restoring DT_INIT
modified:   p_lx_elf.cpp
2017-03-30 11:05:49 -07:00
John Reiser bd976cd562 Merge branch 'devel' into jreiser
modified:   packmast.cpp
2017-03-30 10:27:54 -07:00
John Reiser 0e511c3e07 visitAllPackers() lists class names when -D
modified:   packmast.cpp
2017-03-30 10:23:27 -07:00
John Reiser 300d489408 --android-shlib preserves selected Elf32_Shdr
32-bit only for now; also in wrong place for unpacking (-d)
	modified:   main.cpp
	modified:   options.h
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-03-29 18:31:39 -07:00
John Reiser 024d081167 Fix unpack of ET_DYN
https://github.com/upx/upx/issues/73

	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-03-27 16:49:46 -07:00
John Reiser 348173d3f1 Fix editing glitch
modified:   p_lx_elf.cpp
2017-03-27 16:42:26 -07:00
John Reiser 23e3814f8a Fix unpacking of ET_DYN
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2017-03-27 16:10:12 -07:00
John Reiser b818e2c4b8 arm64 (aarch64)
Tested and working: nrv2b and nrv2e for ET_EXE on linux.
NOT TESTED: lzma, ET_DYN on linux; any Mach-O

	modified:   bele.h
	modified:   conf.h
	modified:   filter/ct.h
	modified:   filteri.cpp
	modified:   linker.cpp
	modified:   linker.h
	modified:   miniacc.h
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-darwin.macho-fold.h
	new file:   stub/arm64-linux.elf-entry.h
	new file:   stub/arm64-linux.elf-fold.h
	new file:   stub/arm64-linux.shlib-init.h
	new file:   stub/src/arch/arm64/v8/Makefile.extra
	modified:   stub/src/arch/arm64/v8/lzma_d-arm.S
	modified:   stub/src/arch/arm64/v8/lzma_d.S
	modified:   stub/src/arch/arm64/v8/lzma_d_cf.S
	new file:   stub/src/arch/arm64/v8/lzma_d_cs.S
	modified:   stub/src/arch/arm64/v8/macros.S
	renamed:    stub/src/arch/arm64/v8/nrv2b_d8.S -> stub/src/arch/arm64/v8/nrv2b_d32.S
	renamed:    stub/src/arch/arm64/v8/nrv2d_d8.S -> stub/src/arch/arm64/v8/nrv2d_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2e_d32.S
	deleted:    stub/src/arch/arm64/v8/nrv2e_d8.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	new file:   stub/src/arm64-linux.elf-entry.S
	new file:   stub/src/arm64-linux.elf-fold.S
	new file:   stub/src/arm64-linux.elf-fold.lds
	new file:   stub/src/arm64-linux.elf-main.c
	new file:   stub/src/arm64-linux.shlib-init.S
	modified:   stub/src/include/linux.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-darwin.macho-fold.map
	new file:   stub/tmp/arm64-linux.elf-entry.bin.dump
	new file:   stub/tmp/arm64-linux.elf-fold.map
	new file:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-03-26 13:10:26 -07:00
John Reiser 6adb3dc142 BUILD_TYPE_DEBUG ?= 0 2017-03-26 13:03:49 -07:00
John Reiser 0e154cc759 Hint when need DT_INIT for shared library
https://github.com/upx/upx/issues/74
	modified:   p_lx_elf.cpp
2017-03-25 20:22:04 -07:00
John Reiser 9dce8d9bce Separate from amd64/bxx.S
modified:   stub/src/arch/amd64/bxx.S
2017-03-25 20:14:48 -07:00
John Reiser 0aa3b9c487 Revise comment
modified:   stub/src/arch/amd64/bxx.S
2017-03-25 20:10:50 -07:00
John Reiser dc7ab3ed30 sync git branch
modified:   stub/amd64-win64.pep.h
	modified:   stub/tmp/amd64-win64.pep.bin.dump
2017-03-25 20:08:29 -07:00
John Reiser 254259b354 Fix comment
modified:   stub/src/arch/amd64/bxx.S
2017-03-25 20:05:32 -07:00
John Reiser 9651c70efd Revert powerpc-linux.elf-fold.S
modified:   stub/src/powerpc-linux.elf-fold.S
2017-03-25 17:51:32 -07:00
John Reiser 5840190ed5 Revert xstrip.py
modified:   stub/scripts/xstrip.py
2017-03-25 17:50:06 -07:00
John Reiser a807b88694 BUILD_TYPE_DEBUG ?= 1
modified:   Makefile
2017-03-25 17:40:24 -07:00
John Reiser 0db82e09e9 Suggest fix for missing DT_INIT in shared library.
modified:   p_lx_elf.cpp
2017-03-25 17:39:47 -07:00
John Reiser e5865f171a xstrip.py: *.bindump was unused; clear e_shnum, e_shstrndx
Also allow other compilers for powerpc64le and arm64: loosen checking.
	modified:   stub/Makefile
	modified:   stub/scripts/xstrip.py

	modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/amd64-linux.kernel.vmlinux.h
	modified:   stub/amd64-linux.shlib-init.h
	modified:   stub/amd64-win64.pep.h
	modified:   stub/arm.v4a-linux.elf-entry.h
	modified:   stub/arm.v4a-wince.pe.h
	modified:   stub/arm.v4t-wince.pe.h
	modified:   stub/arm.v5a-darwin.macho-entry.h
	modified:   stub/arm.v5a-linux.elf-entry.h
	modified:   stub/arm.v5a-linux.kernel.vmlinux.h
	modified:   stub/arm.v5a-linux.kernel.vmlinuz.h
	modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/armeb.v4a-linux.elf-entry.h
	modified:   stub/armeb.v5a-linux.kernel.vmlinux.h
	modified:   stub/i086-dos16.com.h
	modified:   stub/i086-dos16.exe.h
	modified:   stub/i086-dos16.sys.h
	modified:   stub/i386-bsd.elf-entry.h
	modified:   stub/i386-bsd.elf.execve-entry.h
	modified:   stub/i386-darwin.dylib-entry.h
	modified:   stub/i386-darwin.macho-entry.h
	modified:   stub/i386-dos32.djgpp2.h
	modified:   stub/i386-dos32.tmt.h
	modified:   stub/i386-dos32.watcom.le.h
	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf.execve-entry.h
	modified:   stub/i386-linux.elf.interp-entry.h
	modified:   stub/i386-linux.elf.shell-entry.h
	modified:   stub/i386-linux.kernel.vmlinux.h
	modified:   stub/i386-linux.kernel.vmlinuz.h
	modified:   stub/i386-linux.shlib-init.h
	modified:   stub/i386-netbsd.elf-entry.h
	modified:   stub/i386-win32.pe.h
	modified:   stub/m68k-atari.tos.h
	modified:   stub/mips.r3000-linux.elf-entry.h
	modified:   stub/mipsel.r3000-linux.elf-entry.h
	modified:   stub/mipsel.r3000-ps1.h
	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.kernel.vmlinux.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
2017-03-25 17:09:16 -07:00
John Reiser 166d198dcb Default BUILD_TYPE_DEBUG
modified:   Makefile
2017-03-25 16:54:26 -07:00
John Reiser 445795f2ec Sync testsuite for 32-bit powerpc lzma
modified:   ../.github/travis_testsuite_1.sh
2017-03-25 16:50:38 -07:00
John Reiser 6be4a87dac Revert "testsuite "set -x""
This reverts commit fbe4d287c7.

	modified:   .github/travis_testsuite_1.sh
2017-03-25 16:38:30 -07:00
John Reiser 17c47053d6 Revert amd64/bxx.S to reduce churn of testsuite
modified:   stub/src/arch/amd64/bxx.S

	modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/amd64-darwin.macho-fold.h
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/amd64-linux.shlib-init.h
	modified:   stub/amd64-win64.pep.h
2017-03-25 16:34:01 -07:00
John Reiser b4e18f7521 Remove debugging straggler.
modified:   src/powerpc-linux.elf-fold.S

	modified:   powerpc-linux.elf-fold.h
	modified:   tmp/powerpc-linux.elf-fold.map
2017-03-25 15:48:18 -07:00
John Reiser fbe4d287c7 testsuite "set -x"
modified:   ../.github/travis_testsuite_1.sh
2017-03-25 14:52:08 -07:00
John Reiser 543fa3ae79 Revert PackLinuxElf32::unpack() for decompression of armeb-linux.elf/upx-3.91
Conflicting with https://github.com/upx/upx/issues/73
	modified:   p_lx_elf.cpp
2017-03-25 12:52:20 -07:00
John Reiser 7cf855413c Sync testuite checksums (powerpc)
modified:   ../.github/travis_testsuite_1.sh
2017-03-25 09:12:56 -07:00
John Reiser f5d65dc0bc arm64 unfilter
modified:   stub/src/arm64-linux.elf-fold.S

	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/tmp/arm64-linux.elf-fold.map
2017-03-24 13:55:54 -07:00
John Reiser 2f6211a1d9 xstrip.py slight improvement for powerpc64le and arm64
modified:   stub/scripts/xstrip.py
2017-03-24 10:54:56 -07:00
John Reiser 513a57330a xstrip.py: *.bindump was unused; clear e_shnum, e_shstrndx
modified:   stub/scripts/xstrip.py
	modified:   stub/Makefile

	modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/amd64-linux.elf-entry.h
	modified:   stub/amd64-linux.kernel.vmlinux.h
	modified:   stub/amd64-linux.shlib-init.h
	modified:   stub/amd64-win64.pep.h
	modified:   stub/arm.v4a-linux.elf-entry.h
	modified:   stub/arm.v4a-wince.pe.h
	modified:   stub/arm.v4t-wince.pe.h
	modified:   stub/arm.v5a-darwin.macho-entry.h
	modified:   stub/arm.v5a-linux.elf-entry.h
	modified:   stub/arm.v5a-linux.kernel.vmlinux.h
	modified:   stub/arm.v5a-linux.kernel.vmlinuz.h
	modified:   stub/arm.v5a-linux.shlib-init.h
	modified:   stub/arm.v5t-linux.shlib-init.h
	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/armeb.v4a-linux.elf-entry.h
	modified:   stub/armeb.v5a-linux.kernel.vmlinux.h
	modified:   stub/i086-dos16.com.h
	modified:   stub/i086-dos16.exe.h
	modified:   stub/i086-dos16.sys.h
	modified:   stub/i386-bsd.elf-entry.h
	modified:   stub/i386-bsd.elf.execve-entry.h
	modified:   stub/i386-darwin.dylib-entry.h
	modified:   stub/i386-darwin.macho-entry.h
	modified:   stub/i386-dos32.djgpp2.h
	modified:   stub/i386-dos32.tmt.h
	modified:   stub/i386-dos32.watcom.le.h
	modified:   stub/i386-linux.elf-entry.h
	modified:   stub/i386-linux.elf.execve-entry.h
	modified:   stub/i386-linux.elf.interp-entry.h
	modified:   stub/i386-linux.elf.shell-entry.h
	modified:   stub/i386-linux.kernel.vmlinux.h
	modified:   stub/i386-linux.kernel.vmlinuz.h
	modified:   stub/i386-linux.shlib-init.h
	modified:   stub/i386-netbsd.elf-entry.h
	modified:   stub/i386-win32.pe.h
	modified:   stub/m68k-atari.tos.h
	modified:   stub/mips.r3000-linux.elf-entry.h
	modified:   stub/mipsel.r3000-linux.elf-entry.h
	modified:   stub/mipsel.r3000-ps1.h
	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.kernel.vmlinux.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
2017-03-24 09:26:40 -07:00
John Reiser 715ddf0620 arm64 hacking
modified:   stub/src/arch/arm64/v8/macros.S
	new file:   stub/src/arch/arm64/v8/Makefile.extra
	modified:   stub/src/arch/arm64/v8/lzma_d-arm.S
	modified:   stub/src/arch/arm64/v8/lzma_d.S
	modified:   stub/src/arch/arm64/v8/lzma_d_cf.S
	new file:   stub/src/arch/arm64/v8/lzma_d_cs.S
	modified:   stub/src/arm64-darwin.macho-entry.S

	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-03-23 20:32:41 -07:00
John Reiser 6bb31e276e Merge branch 'devel' into jreiser 2017-03-23 13:27:09 -07:00
John Reiser b10f1df49f Merge branch 'devel' of https://github.com/upx/upx into devel 2017-03-23 13:09:59 -07:00
John Reiser f999519b13 Sync stubs for 32-bit powerpc
modified:   stub/src/arch/powerpc/32/Makefile.extra
	modified:   stub/src/arch/powerpc/32/lzma_d_cf.S
	modified:   stub/src/arch/powerpc/32/lzma_d_cs.S

	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.kernel.vmlinux.h
2017-03-23 13:08:36 -07:00
Markus F.X.J. Oberhumer aedbf02830 p_lx_elf.cpp: silence a clang-4.0 compilation warning. 2017-03-23 17:43:23 +01:00
John Reiser bd5479b250 arm64 omit "dc zva," while valgrind complains
modified:   src/arm64-linux.elf-entry.S
	modified:   src/arm64-linux.elf-fold.S

	modified:   arm64-linux.elf-entry.h
	modified:   arm64-linux.elf-fold.h
	modified:   tmp/arm64-linux.elf-entry.bin.dump
	modified:   tmp/arm64-linux.elf-fold.map
2017-03-23 09:12:35 -07:00
Markus F.X.J. Oberhumer 9d14715652 Update Travis. 2017-03-23 13:00:42 +01:00
Thierry Fauck 72156fcf1b powerpc64le: support for -fpie compiled binaries
Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   powerpc64le-linux.elf-fold.h
	modified:   src/powerpc64le-linux.elf-fold.S
	modified:   src/powerpc64le-linux.elf-main.c
	modified:   tmp/powerpc64le-linux.elf-fold.map
2017-03-23 11:21:50 +01:00
Markus F.X.J. Oberhumer 1c6eab00d1 Update Travis. 2017-03-23 04:20:29 +01:00
Markus F.X.J. Oberhumer f9738c5b55 New ACC version. 2017-03-23 01:17:33 +01:00
John Reiser 3b63083619 Cleanup powerpc64 stubs
modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S

	modified:   stub/powerpc64le-darwin.macho-fold.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/tmp/powerpc64le-darwin.macho-fold.map
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
2017-03-22 16:50:52 -07:00
John Reiser d5d7d8bc84 arm64 hacking
modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-main.c

	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/tmp/arm64-linux.elf-fold.map
2017-03-22 16:45:09 -07:00
John Reiser f26118cf5a lzma for powerpc64le: -Os needs _restgpr0_*
modified:   stub/src/arch/powerpc/64le/Makefile.extra
	modified:   stub/src/arch/powerpc/64le/ppc_regs.h
	modified:   stub/src/powerpc64-savegpr0.S

	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
	modified:   stub/src/arch/powerpc/64le/lzma_d_cf.S
	modified:   stub/src/arch/powerpc/64le/lzma_d_cs.S
	modified:   stub/tmp/powerpc64le-darwin.dylib-entry.bin.dump
	modified:   stub/tmp/powerpc64le-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc64le-linux.kernel.vmlinux.bin.dump
2017-03-22 14:17:40 -07:00
John Reiser 5d6c4b475c preloc
modified:   stub/src/arm64-linux.elf-main.c
2017-03-22 09:03:13 -07:00
John Reiser 2c4ef392f6 arm64-linux hacking; returns from upx_main(), only launch remains!
modified:   stub/src/arch/arm64/v8/lzma_d.S
	modified:   stub/src/arch/arm64/v8/nrv2b_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2d_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2e_d32.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.elf-main.c

	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-03-21 21:54:49 -07:00
John Reiser 2a128fe772 Work on arm64 decompression
renamed:    stub/src/arch/arm64/v8/nrv2b_d8.S -> stub/src/arch/arm64/v8/nrv2b_d32.S
	renamed:    stub/src/arch/arm64/v8/nrv2d_d8.S -> stub/src/arch/arm64/v8/nrv2d_d32.S
	modified:   stub/src/arch/arm64/v8/nrv2e_d32.S
	deleted:    stub/src/arch/arm64/v8/nrv2e_d8.S
	modified:   stub/src/arm64-darwin.macho-entry.S
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/src/arm64-linux.elf-fold.S
	modified:   stub/src/arm64-linux.shlib-init.S

	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/arm64-linux.shlib-init.h
	modified:   stub/tmp/arm64-darwin.macho-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
	modified:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-03-20 21:23:15 -07:00
John Reiser bb7d3ca3a1 Fix PackLinuxElf32::unpack() for shared library?
modified:   p_lx_elf.cpp
2017-03-20 21:21:46 -07:00
John Reiser a2bdba7eda arm64 cache flogging at initial move
modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/src/arm64-linux.elf-entry.S
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
2017-03-14 21:36:18 -07:00
John Reiser e8aabc9980 R_AARCH64_CONDBR19
modified:   linker.cpp
2017-03-14 21:35:01 -07:00
John Reiser 9f554a14fd ARM64 hacking
modified:   p_lx_elf.cpp
	modified:   stub/src/arch/arm64/v8/macros.S
	modified:   stub/src/arm64-darwin.macho-fold.S
	modified:   stub/src/arm64-linux.elf-entry.S

	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-darwin.macho-fold.h
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/arm64-linux.elf-fold.h
	modified:   stub/tmp/arm64-darwin.macho-fold.map
	modified:   stub/tmp/arm64-linux.elf-entry.bin.dump
	modified:   stub/tmp/arm64-linux.elf-fold.map
2017-03-14 20:08:28 -07:00
John Reiser 68a2b91ccb arm64 filter, relocation, defineSymbols
modified:   Makefile
	modified:   bele.h
	modified:   filter/ct.h
	modified:   filteri.cpp
	modified:   linker.cpp
	modified:   miniacc.h
	modified:   p_lx_elf.cpp
	modified:   stub/arm64-linux.elf-entry.h
	modified:   stub/src/arm64-linux.elf-entry.S
2017-03-05 21:05:13 -08:00
John Reiser 4089cc6e6f arm64-linux compiles
modified:   conf.h
	modified:   linker.cpp
	modified:   linker.h
	modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
	modified:   packmast.cpp
	modified:   stub/Makefile
	new file:   stub/arm64-linux.shlib-init.h
	new file:   stub/src/arm64-linux.shlib-init.S
	new file:   stub/tmp/arm64-linux.elf-entry.bin.dump
	new file:   stub/tmp/arm64-linux.elf-fold.map
	new file:   stub/tmp/arm64-linux.shlib-init.bin.dump
2017-03-05 18:07:29 -08:00
John Reiser 4e8848eeca Merge branch 'devel' into jreiser
Conflicts:
	src/stub/amd64-win64.pep.h
	src/stub/powerpc-linux.elf-entry.h
	src/stub/powerpc-linux.elf-fold.h
	src/stub/src/amd64-win64.pep.S
	src/stub/src/arch/powerpc/32/ppc_regs.h
	src/stub/src/arch/powerpc/64le/lzma_d.S
	src/stub/src/powerpc-linux.elf-entry.S
	src/stub/src/powerpc64le-darwin.dylib-entry.S
	src/stub/src/powerpc64le-darwin.macho-entry.S
	src/stub/src/powerpc64le-linux.elf-entry.S
	src/stub/src/powerpc64le-linux.kernel.vmlinux.S
	src/stub/tmp/amd64-win64.pep.bin.dump
	src/stub/tmp/powerpc-linux.elf-entry.bin.dump
	src/stub/tmp/powerpc-linux.elf-fold.map

	modified:   ../../.github/travis_testsuite_1.sh
	modified:   ../p_lx_elf.cpp
	modified:   ../p_unix.cpp
	modified:   ../p_unix.h
	modified:   amd64-win64.pep.h
	modified:   arm.v4a-linux.elf-fold.h
	modified:   arm.v5a-linux.elf-fold.h
	modified:   armeb.v4a-linux.elf-fold.h
	modified:   powerpc-darwin.dylib-entry.h
	modified:   powerpc-darwin.macho-entry.h
	copied:     powerpc-darwin.dylib-entry.h -> powerpc-linux.elf-entry.h
	modified:   powerpc-linux.elf-fold.h
	modified:   powerpc-linux.kernel.vmlinux.h
	modified:   powerpc64le-linux.elf-fold.h
	modified:   src/amd64-win64.pep.S
	modified:   src/arch/powerpc/32/bxx.S
	modified:   src/arch/powerpc/32/lzma_d.S
	modified:   src/arch/powerpc/32/nrv2d_d.S
	modified:   src/arch/powerpc/32/nrv2e_d.S
	modified:   src/arch/powerpc/32/ppc_regs.h
	modified:   src/arch/powerpc/64le/bxx.S
	modified:   src/arch/powerpc/64le/lzma_d.S
	modified:   src/arch/powerpc/64le/nrv2b_d.S
	modified:   src/arch/powerpc/64le/nrv2d_d.S
	modified:   src/arch/powerpc/64le/nrv2e_d.S
	modified:   src/arm.v4a-linux.elf-fold.S
	modified:   src/powerpc-darwin.macho-fold.S
	modified:   src/powerpc-linux.elf-entry.S
	modified:   src/powerpc-linux.elf-fold.S
	modified:   src/powerpc64le-darwin.dylib-entry.S
	modified:   src/powerpc64le-darwin.macho-entry.S
	modified:   src/powerpc64le-darwin.macho-fold.S
	modified:   src/powerpc64le-linux.elf-entry.S
	modified:   src/powerpc64le-linux.elf-fold.S
	modified:   src/powerpc64le-linux.kernel.vmlinux.S
	modified:   tmp/amd64-win64.pep.bin.dump
	modified:   tmp/arm.v4a-linux.elf-fold.map
	modified:   tmp/arm.v5a-linux.elf-fold.map
	modified:   tmp/armeb.v4a-linux.elf-fold.map
	modified:   tmp/powerpc-darwin.dylib-entry.bin.dump
	modified:   tmp/powerpc-darwin.macho-entry.bin.dump
	modified:   tmp/powerpc-linux.elf-entry.bin.dump
	modified:   tmp/powerpc-linux.elf-fold.map
	modified:   tmp/powerpc-linux.kernel.vmlinux.bin.dump
2017-03-01 08:14:13 -08:00
John Reiser 8c6133c115 Decompression stubs for arm64-linux (aarch)
modified:   stub/Makefile
	modified:   stub/arm64-darwin.macho-entry.h
	modified:   stub/arm64-darwin.macho-fold.h
	new file:   stub/arm64-linux.elf-entry.h
	new file:   stub/arm64-linux.elf-fold.h
	modified:   stub/scripts/xstrip.py
	modified:   stub/src/arch/arm64/v8/macros.S
	modified:   stub/src/arch/arm64/v8/nrv2b_d8.S
	modified:   stub/src/arch/arm64/v8/nrv2d_d8.S
	modified:   stub/src/arch/arm64/v8/nrv2e_d8.S
	new file:   stub/src/arm64-linux.elf-entry.S
	new file:   stub/src/arm64-linux.elf-fold.S
	new file:   stub/src/arm64-linux.elf-fold.lds
	new file:   stub/src/arm64-linux.elf-main.c
	modified:   stub/src/include/linux.h
2017-03-01 05:47:03 -08:00
John Reiser 483db31acd arm: Preserve 8-byte alignment of stack pointer
https://github.com/upx/upx/issues/60  (partial)
	modified:   stub/src/arm.v4a-linux.elf-fold.S

	modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/arm.v4a-linux.elf-fold.h
	modified:   stub/arm.v5a-linux.elf-fold.h
	modified:   stub/armeb.v4a-linux.elf-fold.h
	modified:   stub/tmp/arm.v4a-linux.elf-fold.map
	modified:   stub/tmp/arm.v5a-linux.elf-fold.map
	modified:   stub/tmp/armeb.v4a-linux.elf-fold.map
2017-02-14 20:36:45 -08:00
John Reiser 35dae3dab7 PowerPC 32-bit lzma stub defends against omitted linkage area.
https://github.com/upx/upx/issues/60
	modified:   stub/src/arch/powerpc/32/lzma_d.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S

	modified:   stub/powerpc-darwin.dylib-entry.h
	modified:   stub/powerpc-darwin.macho-entry.h
 [WTF?]	copied:     stub/powerpc-darwin.dylib-entry.h -> stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc-linux.kernel.vmlinux.h

	modified:   stub/tmp/powerpc-linux.elf-fold.map
	modified:   stub/tmp/powerpc-darwin.dylib-entry.bin.dump
	modified:   stub/tmp/powerpc-darwin.macho-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.kernel.vmlinux.bin.dump

	modified:   ../.github/travis_testsuite_1.sh
2017-02-12 16:23:57 -08:00
John Reiser 8232aedf78 unpackExtent() segregates rewrite() from write()
Fix the reported output file size when un-compressing.
Part of https://github.com/upx/upx/issues/60
	modified:   p_lx_elf.cpp
	modified:   p_unix.cpp
	modified:   p_unix.h
2017-02-11 15:26:27 -08:00
László Molnár d30a0a2e67 updated filter invocation in win64/pe 2017-02-06 14:31:16 +01:00
John Reiser d913fe508f Remove debugging jig
modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/tmp/powerpc-linux.elf-fold.map
2017-02-05 15:41:52 -08:00
John Reiser 4029903301 Sync testsuite
modified:   ../.github/travis_testsuite_1.sh
2017-02-05 15:14:11 -08:00
John Reiser 5db7e826d3 Find and use AT_PAGESZ; forward from -entry to -fold.
Cleanup the runtime choice of PAGE_SIZE 4K or 64K
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/src/arch/powerpc/32/ppc_regs.h
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
2017-02-05 15:02:31 -08:00
John Reiser 7f3e7da7c7 Stubs LZMA_DEC00 and LZMA_ELF00 fall through; no "+80C" alignment.
https://github.com/upx/upx/issues/60  (partial)
addStubEntrySections() and getDecompressorSections()
	modified:   p_lx_elf.cpp
	modified:   p_mach.cpp
	modified:   packer_c.cpp
2017-02-05 14:52:09 -08:00
John Reiser 93cefde8fc Allow __PAGEZERO.vmsize to be 0x1000 on x86_64, as for "go"-language.
https://github.com/upx/upx/issues/59
	modified:   p_mach.cpp
	modified:   p_mach.h
2017-02-05 14:50:08 -08:00
John Reiser 02e7981e10 Merge and fix conflics
Conflicts:
	src/stub/src/arch/powerpc/64le/lzma_d.S
	src/stub/src/powerpc64le-darwin.dylib-entry.S
	src/stub/src/powerpc64le-darwin.macho-entry.S
	src/stub/src/powerpc64le-linux.elf-entry.S
	src/stub/src/powerpc64le-linux.kernel.vmlinux.S

	modified:   stub/src/arch/powerpc/32/lzma_d.S
2017-02-05 14:41:15 -08:00
John Reiser 0ecec10af0 Sync stubs and testsuite.
modified:   ../.github/travis_testsuite_1.sh
	modified:   stub/powerpc-linux.elf-entry.h
2017-02-05 14:26:18 -08:00
John Reiser 00b8cba987 typos
modified:   stub/src/powerpc-linux.elf-entry.S
2017-02-05 14:18:05 -08:00
John Reiser 8486bff918 PowerPC compare instructions: make cr0 explicit, put width ('w' or 'd') into mnemonic.
Easier to understand, caught a couple bugs in width.
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
	modified:   stub/src/arch/powerpc/32/bxx.S
	modified:   stub/src/arch/powerpc/32/nrv2d_d.S
	modified:   stub/src/arch/powerpc/32/nrv2e_d.S
	modified:   stub/src/arch/powerpc/64le/bxx.S
	modified:   stub/src/arch/powerpc/64le/lzma_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2b_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2d_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2e_d.S
	modified:   stub/src/powerpc-darwin.macho-fold.S
	modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.kernel.vmlinux.S
2017-02-05 14:00:19 -08:00
John Reiser 5305eb5b8a Sync stubs
modified:   stub/amd64-darwin.dylib-entry.h
	modified:   stub/amd64-darwin.macho-entry.h
	modified:   stub/amd64-darwin.macho-fold.h
	modified:   stub/amd64-linux.elf-fold.h
	modified:   stub/amd64-linux.shlib-init.h
	modified:   stub/amd64-win64.pep.h
	modified:   stub/powerpc-linux.elf-entry.h
	modified:   stub/powerpc-linux.elf-fold.h
	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
	modified:   stub/src/arch/powerpc/64le/lzma_d.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.kernel.vmlinux.S
	modified:   stub/tmp/amd64-win64.pep.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-entry.bin.dump
	modified:   stub/tmp/powerpc-linux.elf-fold.map
2017-02-05 13:37:01 -08:00
John Reiser 377a3bb7de More register definitions
modified:   stub/src/arch/powerpc/32/ppc_regs.h
2017-02-05 13:32:54 -08:00
John Reiser 5a47e8d2c6 Find and use AT_PAGESZ
modified:   stub/src/powerpc-linux.elf-entry.S
	modified:   stub/src/powerpc-linux.elf-fold.S
2017-02-05 13:31:17 -08:00
John Reiser 71f4cd7c85 Fix register usage conventions for amd64 unfilter
modified:   stub/src/amd64-win64.pep.S
	modified:   stub/src/arch/amd64/bxx.S
2017-02-05 13:29:59 -08:00
John Reiser f7751684af Stubs LZMA_DEC00 and LZMA_ELF00 fall through; no "+80C" alignment.
addStubEntrySections() and getDecompressorSections()
	modified:   p_lx_elf.cpp
	modified:   p_mach.cpp
	modified:   packer_c.cpp
2017-02-05 13:26:02 -08:00
John Reiser 59df1d39b2 Merge pull request #61 from tfauck/devel-thf
Following #51 pull with rerequested changes
2017-02-04 09:10:24 -08:00
John Reiser 7e5933e6a0 Merge branch 'devel' into devel-thf 2017-02-04 08:42:10 -08:00
John Reiser 2cefd34bb7 Allow __PAGEZERO.vmsize to be 0x1000 on x86_64, as for "go"-language.
https://github.com/upx/upx/issues/59
	modified:   p_mach.cpp
	modified:   p_mach.h
2017-02-03 15:12:40 -08:00
Thierry Fauck eac891dc3a Typo in .bss bzeroing
Rebuild of powerpc64le stubs

Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   stub/powerpc64le-darwin.dylib-entry.h
	modified:   stub/powerpc64le-darwin.macho-entry.h
	modified:   stub/powerpc64le-linux.elf-entry.h
	modified:   stub/powerpc64le-linux.elf-fold.h
	modified:   stub/powerpc64le-linux.kernel.vmlinux.h
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.elf-main.c
	modified:   stub/tmp/powerpc64le-linux.elf-fold.map
2017-02-03 10:57:05 +01:00
Thierry Fauck abd3599408 Explicitely specify cmp instructions to be 32 bits or 64bits on powerpc
(Thanks to John Reiser).

Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   src/arch/powerpc/32/bxx.S
	modified:   src/arch/powerpc/32/lzma_d.S
	modified:   src/arch/powerpc/64le/bxx.S
	modified:   src/arch/powerpc/64le/lzma_d.S
	modified:   src/arch/powerpc/64le/nrv2b_d.S
	modified:   src/arch/powerpc/64le/nrv2d_d.S
	modified:   src/arch/powerpc/64le/nrv2e_d.S
	modified:   src/powerpc64le-darwin.dylib-entry.S
	modified:   src/powerpc64le-darwin.macho-entry.S
	modified:   src/powerpc64le-darwin.macho-fold.S
	modified:   src/powerpc64le-linux.elf-entry.S
	modified:   src/powerpc64le-linux.elf-fold.S
	modified:   src/powerpc64le-linux.kernel.vmlinux.S
2017-02-03 10:55:14 +01:00
John Reiser 1bcd259c00 Merge branch 'devel' of https://github.com/upx/upx into devel 2017-02-01 17:17:31 -08:00
Thierry Fauck c4e835266c Typo in .bss bzeroing
Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   src/stub/powerpc64le-linux.elf-fold.h
	modified:   src/stub/src/powerpc64le-linux.elf-fold.S
	modified:   src/stub/src/powerpc64le-linux.elf-main.c
	modified:   src/stub/tmp/powerpc64le-linux.elf-fold.map
2017-01-30 18:53:34 +01:00
Thierry Fauck 685953f6a5 Explicitely specify cmp instructions to be 32 bits or 64bits on powerpc
Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   stub/src/arch/powerpc/32/bxx.S
	modified:   stub/src/arch/powerpc/64le/bxx.S
	modified:   stub/src/arch/powerpc/64le/lzma_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2b_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2d_d.S
	modified:   stub/src/arch/powerpc/64le/nrv2e_d.S
	modified:   stub/src/powerpc64le-darwin.dylib-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-entry.S
	modified:   stub/src/powerpc64le-darwin.macho-fold.S
	modified:   stub/src/powerpc64le-linux.elf-entry.S
	modified:   stub/src/powerpc64le-linux.elf-fold.S
	modified:   stub/src/powerpc64le-linux.kernel.vmlinux.S
2017-01-30 00:34:45 +01:00
John Reiser 03fffbc724 Re-base to upx-3.93
modified:   src/stub/src/arch/amd64/bxx.S
2017-01-29 06:58:03 -08:00
Markus F.X.J. Oberhumer e1a8c932ee Cleanup snprintf.cpp. 2017-01-29 14:11:46 +01:00
Markus F.X.J. Oberhumer 1aa2a6b054 Add missing src/stub/tmp/*.map files to repo. 2017-01-29 14:10:12 +01:00
Markus F.X.J. Oberhumer 1ad96c9c81 Update testsuite checksums caused by version bump. 2017-01-29 14:08:02 +01:00
Markus F.X.J. Oberhumer f69199909f Post-release version bump. 2017-01-29 14:05:00 +01:00
John Reiser d063e77040 Update checksums for testsuite.
modified:   .github/travis_testsuite_1.sh
2017-01-29 14:01:57 +01:00
John Reiser bf3ddeb1eb Rebuild stubs.
modified:   amd64-darwin.dylib-entry.h
	modified:   amd64-darwin.macho-entry.h
	modified:   amd64-darwin.macho-fold.h
	modified:   amd64-linux.elf-fold.h
	modified:   amd64-linux.kernel.vmlinux.h
	modified:   amd64-linux.shlib-init.h
	modified:   amd64-win64.pep.h
	modified:   i386-bsd.elf-entry.h
	modified:   i386-bsd.elf.execve-entry.h
	modified:   i386-darwin.dylib-entry.h
	modified:   i386-darwin.macho-entry.h
	modified:   i386-dos32.djgpp2.h
	modified:   i386-dos32.tmt.h
	modified:   i386-dos32.watcom.le.h
	modified:   i386-linux.elf-entry.h
	modified:   i386-linux.elf.execve-entry.h
	modified:   i386-linux.elf.interp-entry.h
	modified:   i386-linux.kernel.vmlinux.h
	modified:   i386-linux.kernel.vmlinuz.h
	modified:   i386-linux.shlib-init.h
	modified:   i386-netbsd.elf-entry.h
	modified:   i386-win32.pe.h
	modified:   tmp/amd64-darwin.dylib-entry.bin.dump
	modified:   tmp/amd64-darwin.macho-entry.bin.dump
	modified:   tmp/amd64-linux.shlib-init.bin.dump
	modified:   tmp/amd64-win64.pep.bin.dump
2017-01-29 14:01:57 +01:00
John Reiser fc261ad8cd Smaller by 7 bytes; also slower.
https://github.com/upx/upx/issues/43
	modified:   bxx.S
2017-01-29 14:01:56 +01:00
John Reiser 90fc018295 Avoid sigsegv after "patchelf --set-rpath"
https://github.com/upx/upx/issues/47
Enhancement not yet implemented: non-adjacent ElfXX_Ehdr and ElfXX_Phdr.
	modified:   p_unix.cpp
2017-01-29 14:01:56 +01:00
John Reiser cdc01d9a69 linux.sh/i386 interpreter.e_machine must be EM_386; else execve()
https://github.com/upx/upx/issues/53
	modified:   stub/i386-linux.elf.shell-fold.h
	modified:   stub/src/i386-linux.elf.shell-fold.S
	modified:   stub/src/i386-linux.elf.shell-main.c
2017-01-29 14:01:56 +01:00
John Reiser da7e76c07d Document location of checksums for testsuite.
modified:   Makefile
2017-01-29 14:01:56 +01:00
John Reiser ba9118aa58 Bug in unfilter on x86* when region ends in 32-bit displacement.
https://github.com/upx/upx/issues/43
	modified:   stub/src/arch/amd64/bxx.S
	modified:   stub/src/arch/i386/macros.S
	plus all the stubs that use them
2017-01-29 14:01:56 +01:00
Markus F.X.J. Oberhumer fdce705e55 Bump release date. 2017-01-29 12:07:00 +01:00
Markus F.X.J. Oberhumer 81268e7064 Update Travis. 2017-01-28 23:29:12 +01:00
Markus F.X.J. Oberhumer f502f41359 Update conf.h. 2017-01-28 22:39:42 +01:00
Markus F.X.J. Oberhumer 34c9cfb6b0 Don't use "long". 2017-01-28 22:39:42 +01:00
Markus F.X.J. Oberhumer 6da1790c46 New ACC version. 2017-01-28 22:39:42 +01:00
Markus F.X.J. Oberhumer d333c940da Update Travis. 2017-01-17 01:59:13 +01:00
Markus F.X.J. Oberhumer c940d2906f Mention win64/pe in help usage text. 2017-01-17 01:56:58 +01:00
Markus F.X.J. Oberhumer ac4b51ba85 Update Travis. 2017-01-15 23:25:39 +01:00
Markus F.X.J. Oberhumer ea7a1ad2c7 Bump version date. 2017-01-15 15:51:33 +01:00
Markus F.X.J. Oberhumer 45ddd6a68d Enable wildcard expansion on newer mingw versions. 2017-01-15 15:47:53 +01:00
Markus F.X.J. Oberhumer acd99364e0 Update Travis. 2017-01-15 11:10:59 +01:00
Markus F.X.J. Oberhumer 14710dea55 Replace some negative enum constants with "static const unsigned" vars. 2017-01-03 12:57:10 +01:00
Markus F.X.J. Oberhumer 5d3be8da1d Silence a MSVC warning. 2017-01-03 12:37:35 +01:00
Markus F.X.J. Oberhumer 3026821f9f Update testsuite checksums caused by version bump. 2017-01-03 12:16:51 +01:00
Markus F.X.J. Oberhumer fba51dabd0 Bump UPX_VERSION_DATE. 2017-01-03 12:06:17 +01:00
Markus F.X.J. Oberhumer c4da5e81fa Welcome 2017. 2017-01-03 12:02:07 +01:00
Markus F.X.J. Oberhumer bc80d81432 Silence a bogus scan-build warning. 2016-12-30 23:59:31 +01:00
László Molnár 67797efead fixed relocation handling regression in win32/pe (issue #38) 2016-12-30 23:18:32 +01:00
László Molnár c7cb036536 fixed data corruption in import handling (issue #32,#34) 2016-12-30 21:31:50 +01:00
Markus F.X.J. Oberhumer 0ccbc5f139 Silence some bogus coverity warnings. 2016-12-21 19:03:01 +01:00
Markus F.X.J. Oberhumer 2a6bbcaf8f Fix a p_w64pep.cpp issue detected by coverity. 2016-12-21 19:01:55 +01:00
Markus F.X.J. Oberhumer d46a8438ba Remove unused option "--script=". 2016-12-19 23:44:10 +01:00
Markus F.X.J. Oberhumer cc9d19da19 Remove unused PackLinuxI386sep. 2016-12-19 23:29:42 +01:00
Markus F.X.J. Oberhumer 6e6aa6fd6d Update doc/Makefile. 2016-12-19 23:23:59 +01:00
Markus F.X.J. Oberhumer 61652a2989 Remove unused PackSolarisSparc. 2016-12-19 23:23:25 +01:00
Markus F.X.J. Oberhumer edd7503607 Update executable format constants. 2016-12-19 23:18:38 +01:00
Markus F.X.J. Oberhumer c9d6dab401 Remove unused p_elks.cpp. 2016-12-19 23:14:08 +01:00
Markus F.X.J. Oberhumer d303038bcb Remove unused p_vxd.h. 2016-12-19 23:12:05 +01:00
Markus F.X.J. Oberhumer 0a0e7c3b7c Remove unused p_w16ne.cpp. 2016-12-19 23:11:00 +01:00
Markus F.X.J. Oberhumer 0b4ac35bc9 Tune some MSVC warnings. 2016-12-19 22:57:43 +01:00
László Molnár c51864ca39 fixed TLS callback handling for PE64 2016-12-18 23:34:27 +01:00
John Reiser a1cabd5a68 Avoid warning C4805: '|': unsafe mix of type 'bool' and type 'unsigned int' in operation
modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2016-12-18 11:32:47 -08:00
John Reiser 9c1bc99d7a Avoid warning C4146: unary minus operator applied to unsigned type, result still unsigned
modified:   p_mach.cpp
2016-12-16 10:59:51 -08:00
Markus F.X.J. Oberhumer c05fedcb76 Update Travis. 2016-12-14 16:27:51 +01:00
Markus F.X.J. Oberhumer e11beeae4b Update testsuite checksums caused by version bump. 2016-12-11 18:31:01 +01:00
Markus F.X.J. Oberhumer 4749e0d71e Post-release version bump. 2016-12-11 17:50:03 +01:00
Markus F.X.J. Oberhumer 1c01b77a71 Bump release date. 2016-12-11 16:12:06 +01:00
Markus F.X.J. Oberhumer 1dd8ad3685 Remove outdated TODO file. 2016-12-11 15:58:43 +01:00
John Reiser d6f6350b54 Remove comment about PalmPilot; add MacOS; add future AArch64; add John
modified:   README
	modified:   README.1ST
2016-12-01 21:51:04 -08:00
Markus F.X.J. Oberhumer 4f3b85e604 Update NEWS. 2016-12-01 00:45:25 +01:00
Markus F.X.J. Oberhumer efd5bc24b0 Bump tentative release date. 2016-12-01 00:40:54 +01:00
Markus F.X.J. Oberhumer a1d5dfa1ac Update Travis. 2016-12-01 00:36:49 +01:00
Markus F.X.J. Oberhumer 597c2ba180 Add .github/ISSUE_TEMPLATE.md. 2016-12-01 00:34:28 +01:00
Markus F.X.J. Oberhumer 2c2fb1b70b Update Travis. 2016-11-24 14:27:49 +01:00
John Reiser fc1287659a de-tab (comments, too?)
modified:   stub/src/powerpc-darwin.macho-upxmain.c
2016-11-21 14:02:57 -08:00
John Reiser 1a76630594 Mention support for MacOS "Sierra"
modified:   NEWS
2016-11-21 08:30:34 -08:00
John Reiser 322f682d32 re-generate stub
modified:   powerpc-darwin.macho-upxmain.h
2016-11-21 08:26:08 -08:00
John Reiser 0e329336fc Merge branch 'devel' of https://github.com/upx/upx into devel 2016-11-21 08:23:05 -08:00
John Reiser b33bdabbb6 powerpc Mach-o cleanup
modified:   stub/powerpc-darwin.macho-upxmain.exe
	new file:   stub/src/powerpc-darwin.macho-upxmain.c
2016-11-21 08:22:09 -08:00
Markus F.X.J. Oberhumer 27d30121ab Bump tentative release date. 2016-11-20 15:07:46 +01:00
Markus F.X.J. Oberhumer 345278f309 Re-enable assertion in xstrip.py. 2016-11-20 15:07:46 +01:00
Markus F.X.J. Oberhumer 4953e77161 upx-clang-format -i linker.cpp linker.h 2016-11-20 14:20:36 +01:00
Markus F.X.J. Oberhumer 8d61e037f9 Cleanups. 2016-11-20 14:17:21 +01:00
Markus F.X.J. Oberhumer 33a51e69bf Update submodules. 2016-11-20 13:56:42 +01:00
Markus F.X.J. Oberhumer d5dd9bbf24 Update Travis. 2016-11-20 13:51:53 +01:00
Markus F.X.J. Oberhumer 8772e52513 Remove old cruft. 2016-11-20 13:51:53 +01:00
John Reiser 9e1631ad4f avoid null section name and zero alignment; enforce record === line
modified:   linker.cpp
	modified:   linker.h
2016-11-19 17:38:23 -08:00
John Reiser 134b829d59 prevent warning C4319: '~': zero extending 'const unsigned int' to 'upx_uint64_t' of greater size
modified:   linker.cpp
	modified:   p_lx_elf.cpp
	modified:   pefile.cpp
2016-11-19 16:46:01 -08:00
John Reiser 3df7d26101 propagate cpusubtype
modified:   p_mach.cpp
	modified:   p_mach.h
2016-11-14 05:06:29 -08:00
John Reiser cf56086f06 powerpc-darwin.macho-: remove debugging 'trap' :-)
modified:   stub/powerpc-darwin.macho-upxmain.exe
	modified:   stub/powerpc-darwin.macho-upxmain.h
	modified:   stub/src/powerpc-darwin.macho-upxsubr.S
2016-11-12 20:13:12 -08:00
John Reiser a72aca4379 powerpc (32-bit) works on MacOS using Sierra-compatible strategy.
modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   stub/powerpc-darwin.macho-entry.h
	modified:   stub/powerpc-darwin.macho-upxmain.exe
	modified:   stub/powerpc-darwin.macho-upxmain.h
	modified:   stub/src/powerpc-darwin.macho-entry.S
	modified:   stub/src/powerpc-darwin.macho-upxsubr.S
	modified:   stub/tmp/powerpc-darwin.macho-entry.bin.dump
2016-11-12 19:48:19 -08:00
John Reiser edb0b7519a Merge branch 'devel' of https://github.com/upx/upx into devel 2016-11-09 06:08:44 -08:00
Markus F.X.J. Oberhumer 3a3248c88c Merge pull request #24 from tfauck/devel
powerpc64le -fpic dynamically linked binary support
2016-11-09 10:57:33 +01:00
John Reiser 3f14b9dab7 LC_UNIXTHREAD in ::pass4
modified:   p_mach.cpp
2016-11-08 17:53:02 -08:00
Thierry Fauck b1c07c22ce powerpc64le -fpic dynamically linked binary support
Update stub for -fpic support
 Handle 64K page in p_lx_elf.cpp

Signed-off-by: Thierry Fauck <tfauck@free.fr>
2016-11-08 18:29:10 +01:00
John Reiser 3b2c411274 Work on 32-bit PowerPC
modified:   p_mach.cpp
	modified:   p_mach.h
2016-11-06 20:39:01 -08:00
John Reiser e418af1ccd Try to fix 32-bit PowerPC.
modified:   p_mach.cpp
	modified:   p_mach.h
	modified:   stub/Makefile
	new file:   stub/powerpc-darwin.macho-upxmain.exe
	new file:   stub/powerpc-darwin.macho-upxmain.h
	new file:   stub/src/powerpc-darwin.macho-upxsubr.S
2016-11-06 17:59:16 -08:00
John Reiser 7dc004acb3 bug in other-endian ::canPack and ::canUnpack
modified:   p_mach.cpp
2016-11-05 14:02:51 -07:00
John Reiser 2635472896 more unpacking for Mach-o (pre-3.91 ?)
modified:   p_mach.cpp
	modified:   p_mach.h
2016-11-05 13:16:16 -07:00
John Reiser 5c0340f9ae Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-19 15:20:04 -07:00
John Reiser c2c970ee33 pacify c++-analyzer
modified:   p_lx_elf.cpp
2016-10-19 15:19:33 -07:00
Markus F.X.J. Oberhumer b52dabe091 Update Travis. 2016-10-19 15:21:40 +02:00
Markus F.X.J. Oberhumer 3fa2db8d6f Update testsuite checksum to match current version. UNTESTED. 2016-10-19 15:03:25 +02:00
Markus F.X.J. Oberhumer 1e7950f671 Rebuild src/stubs from current sources. UNTESTED. 2016-10-19 14:59:33 +02:00
Thierry Fauck 8fde05191a powerpc: Omit -Os flag to avoid use of savegrp*
Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   stub/Makefile
2016-10-19 14:41:18 +02:00
John Reiser 2557de6c4e amd64 changes for brk() fix. powerpc changes UNKNOWN!
Also, filename of expected checksums begins with dot.
	modified:   .github/travis_testsuite_1.sh
2016-10-16 07:31:26 -07:00
John Reiser 44328aee76 fix brk() problem when is_big: stub must munmap all_pages
https://github.com/upx/upx/issues/5
	modified:   p_lx_elf.cpp
	modified:   p_lx_elf.h
2016-10-15 14:06:56 -07:00
Markus F.X.J. Oberhumer f606b5879b Update Travis. 2016-10-11 22:33:45 +02:00
Markus F.X.J. Oberhumer 83607119df Merge pull request #14 from tfauck/powerpc-fixes
POWERPC: Allocate 4K / 64K pages depending on processor type.
2016-10-11 16:11:40 +02:00
Thierry Fauck 9b86e68268 POWERPC: Allocate 4K / 64K pages depending on processor type.
Powerpc: ppc64le processor - Fix nrv2x-d.S compression routines
xstrip - disallow assert at line 178

Signed-off-by: Thierry Fauck <tfauck@free.fr>

	modified:   powerpc-darwin.dylib-entry.h
	modified:   powerpc-darwin.macho-entry.h
	modified:   powerpc-darwin.macho-fold.h
	modified:   powerpc-linux.elf-entry.h
	modified:   powerpc-linux.elf-fold.h
	modified:   powerpc-linux.kernel.vmlinux.h
	modified:   powerpc64le-darwin.dylib-entry.h
	modified:   powerpc64le-darwin.macho-entry.h
	modified:   powerpc64le-darwin.macho-fold.h
	modified:   powerpc64le-linux.elf-entry.h
	modified:   powerpc64le-linux.elf-fold.h
	modified:   powerpc64le-linux.kernel.vmlinux.h
	modified:   scripts/xstrip.py
	modified:   src/arch/powerpc/64le/nrv2b_d.S
	modified:   src/arch/powerpc/64le/nrv2d_d.S
	modified:   src/arch/powerpc/64le/nrv2e_d.S
	modified:   src/powerpc-linux.elf-entry.S
	modified:   src/powerpc-linux.elf-fold.S
	modified:   src/powerpc-linux.elf-main.c
	modified:   tmp/powerpc-linux.elf-entry.bin.dump
	modified:   tmp/powerpc64le-darwin.dylib-entry.bin.dump
	modified:   tmp/powerpc64le-darwin.macho-entry.bin.dump
	modified:   tmp/powerpc64le-linux.elf-entry.bin.dump
	modified:   tmp/powerpc64le-linux.kernel.vmlinux.bin.dump
2016-10-11 09:52:40 -04:00
John Reiser d688a05ac7 DT_JMPREL vanished (binutils-2.26.1); check all DT_RELA.
modified:   p_elf_enum.h
	modified:   p_lx_elf.cpp
2016-10-09 21:50:45 -07:00
Markus F.X.J. Oberhumer 97e975b4f6 Update Travis so that is works with bash 3 again. 2016-10-09 19:53:04 +02:00
John Reiser 9dd0e3ce4f c++-analyzer finds the speck but misses the log.
modified:   p_mach.cpp
2016-10-09 09:34:33 -07:00
John Reiser ca2293f6d3 c++-analyzer needs improved range tracking.
modified:   p_lx_elf.cpp
2016-10-09 09:33:35 -07:00
Markus F.X.J. Oberhumer 0cd1ef0c7a Update Travis for OSX. 2016-10-09 13:56:45 +02:00
Markus F.X.J. Oberhumer b0207ce524 Some refactoring. NFC. 2016-10-09 13:23:19 +02:00
Markus F.X.J. Oberhumer fab0c3b09d testsuite: rename tests. 2016-10-09 13:00:43 +02:00
Markus F.X.J. Oberhumer 8b35dd3358 testsuite: allow easy updating of the checksums by writing .sha256sums.recreate. 2016-10-09 12:36:22 +02:00
László Molnár cadcbb27eb travis checksums updated 2016-10-09 12:13:22 +02:00
László Molnár 297d44c614 PE: fixed file data alignment problem 2016-10-09 11:29:29 +02:00
Markus F.X.J. Oberhumer 22178f2224 Minor cleanups. 2016-10-09 03:12:19 +02:00
Markus F.X.J. Oberhumer 554f8a376c Update testsuite for previous commit. 2016-10-09 03:00:49 +02:00
Markus F.X.J. Oberhumer 4157affbd7 pefile: make kernelDLL() return the same strings as in UPX 3.91. 2016-10-09 02:53:20 +02:00
Markus F.X.J. Oberhumer 4b991203df pefile.cpp: make import sorting independent from qsort() internals. 2016-10-09 00:48:40 +02:00
Markus F.X.J. Oberhumer 38a265741c Ongoing cleanups. 2016-10-08 18:49:14 +02:00
Markus F.X.J. Oberhumer 56eb02280f Update Travis. 2016-10-07 23:07:25 +02:00
Markus F.X.J. Oberhumer ed900b0476 More thorough use of O_BINARY. 2016-10-07 15:04:12 +02:00
John Reiser 42206364e5 Reduce Mach-o headers
modified:   p_mach.cpp
2016-10-06 16:06:24 -07:00
John Reiser 82d9bb8f51 Fix namespace typedefs for Mach-o structs [upx_uint32_t ==> Word]
modified:   p_mach.cpp
	modified:   p_mach.h
2016-10-06 14:00:05 -07:00
John Reiser 923a9d3f9b Template PackMackBase<T>::pack3. Use more templates for ::pack4.
modified:   p_mach.cpp
	modified:   p_mach.h
2016-10-06 08:55:09 -07:00
John Reiser ae7660068b Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-06 07:49:52 -07:00
John Reiser f466c1d764 Cosmetic
modified:   p_mach.cpp
2016-10-06 07:49:37 -07:00
Markus F.X.J. Oberhumer 6e76f8ef3a Don't use variable length arrays (VLA). 2016-10-06 13:04:46 +02:00
Markus F.X.J. Oberhumer b3a8d02caf Cosmetic cleanups. 2016-10-06 12:31:03 +02:00
Markus F.X.J. Oberhumer 022ba32c1a Improve robustness of seek() by adding some sanity checks. 2016-10-06 12:11:32 +02:00
Markus F.X.J. Oberhumer 8f5e89c900 Update testsuite. 2016-10-06 11:19:31 +02:00
Markus F.X.J. Oberhumer d335d7bafd p_mach.h: fix C++ syntax. 2016-10-06 09:51:58 +02:00
John Reiser 1f51ef7df6 Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-05 17:16:53 -07:00
Markus F.X.J. Oberhumer ec082ee023 Cosmetic cleanup. 2016-10-06 00:45:42 +02:00
Markus F.X.J. Oberhumer a6bc271e0d Update testsuite. 2016-10-06 00:43:54 +02:00
John Reiser 791fd9199e Preserve alignment in .text
modified:   p_mach.cpp
2016-10-05 12:52:52 -07:00
John Reiser 9e8baf1914 i386 for MacOS 10.12 "Sierra"
modified:   p_mach.cpp
	modified:   stub/i386-darwin.macho-entry.h
	modified:   stub/src/i386-darwin.macho-entry.S
	modified:   stub/tmp/i386-darwin.macho-entry.bin.dump
2016-10-05 11:25:16 -07:00
John Reiser 64b7080532 Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-04 21:05:44 -07:00
John Reiser 8fd5479f32 Templates for ::pack4; i386 now packs, needs work before running.
modified:   p_mach.cpp
	modified:   p_mach.h
	new file:   stub/i386-darwin.macho-upxmain.exe
	new file:   stub/i386-darwin.macho-upxmain.h
	new file:   stub/src/i386-darwin.macho-upxmain.c
2016-10-04 19:58:04 -07:00
Markus F.X.J. Oberhumer 04eb9c02c3 Update testsuite checksums to match recent changes. Sigh. 2016-10-05 01:35:45 +02:00
John Reiser 07b41b9bc3 i386-darwin.macho-upxmain.h
modified:   Makefile
2016-10-04 10:48:44 -07:00
John Reiser 8ebadfafe9 Standalone bswap, bzero, syscalls for i386-darwin.macho
new file:   i386-darwin.macho-upxsubr.S
2016-10-04 10:46:59 -07:00
John Reiser 3283896e4b Templatize ::buildLoader
modified:   p_mach.cpp
	modified:   p_mach.h
2016-10-04 08:54:55 -07:00
John Reiser b444bcf418 On the way to templates and mach-o/i386.
modified:   p_mach.cpp
	modified:   p_mach.h
2016-10-03 22:00:26 -07:00
Markus F.X.J. Oberhumer 13034577fc Fix previous commit. 2016-10-04 00:56:01 +02:00
Markus F.X.J. Oberhumer 9feefc2e7f Makefile: added run-testsuite target. 2016-10-04 00:42:24 +02:00
John Reiser a5393e985d Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-03 09:42:48 -07:00
John Reiser e3fe0dc89b Avoid bug in ld-linux to set brk(0) when .p_align is large.
modified:   p_lx_elf.cpp
2016-10-03 09:41:05 -07:00
Markus F.X.J. Oberhumer 42d49e9d50 Update Makefile and check_whitespace.sh. 2016-10-03 13:13:13 +02:00
Markus F.X.J. Oberhumer 06eb244800 Add check_whitespace_git.sh. Minor cleanups. 2016-10-03 04:47:02 +02:00
John Reiser 870cdfa51f Merge branch 'devel' of https://github.com/upx/upx into devel 2016-10-02 10:47:59 -07:00
John Reiser 93787c74ee Rewrite linfo in output file.
modified:   p_mach.cpp
2016-10-02 10:47:37 -07:00
Markus F.X.J. Oberhumer 945323fe15 Fix a compilation warning. 2016-10-02 15:54:14 +02:00
Markus F.X.J. Oberhumer 5e41e69b27 Remove trailing whitespace from p_mach.cpp. 2016-10-02 15:48:56 +02:00
Markus F.X.J. Oberhumer 9d14185f7d Add check_whitespace.sh and call it from Makefile. Update Travis. 2016-10-02 15:46:57 +02:00
John Reiser 0f74162551 Decompression works after codesign. (Still more is possible.)
modified:   p_mach.cpp
2016-10-01 20:38:25 -07:00
John Reiser 00b1ff1ff6 Apple codesign now works.
modified:   p_mach.cpp
2016-10-01 17:40:32 -07:00
John Reiser 977024ea94 Fix clang scan-build errors.
modified:   p_lx_elf.cpp
2016-10-01 17:38:16 -07:00
Markus F.X.J. Oberhumer 3534ed21d7 Update Travis and AppVeyor. 2016-10-01 20:00:48 +02:00
Markus F.X.J. Oberhumer ee093e5232 Minor cleanups. 2016-10-01 19:59:10 +02:00
Markus F.X.J. Oberhumer 807ab8d19f Update Travis and AppVeyor. 2016-09-29 09:54:07 +02:00
Markus F.X.J. Oberhumer 81f3ff098f Update download links to point to github. 2016-09-29 00:37:11 +02:00
Markus F.X.J. Oberhumer 85a5759afb Update AppVeyor to also run the testsuite. 2016-09-29 00:18:22 +02:00
Markus F.X.J. Oberhumer 490e7a56a5 Remove travis_testsuite_2.sh. 2016-09-28 23:02:06 +02:00
Markus F.X.J. Oberhumer e41c475671 Use calloc instead of malloc to pacify valgrind. 2016-09-28 21:30:38 +02:00
Markus F.X.J. Oberhumer b0841268bd Update Travis testsuite. 2016-09-28 20:18:05 +02:00
Markus F.X.J. Oberhumer b9b3b67b95 Silence some pedantic compilation warnings about unused results. 2016-09-28 13:50:50 +02:00
Markus F.X.J. Oberhumer 0d57d2cfe3 Remove old cruft. 2016-09-28 13:39:49 +02:00
Markus F.X.J. Oberhumer 32de5d0d7f Fix msvc build. 2016-09-28 13:34:39 +02:00
Markus F.X.J. Oberhumer 51eab2a4b7 Update Makefile configuration variables. 2016-09-28 13:07:39 +02:00
Markus F.X.J. Oberhumer 93cf170253 Update NEWS. 2016-09-28 12:31:44 +02:00
Markus F.X.J. Oberhumer f7554374ab Update email address. 2016-09-28 12:25:01 +02:00
Markus F.X.J. Oberhumer b4870f62c9 Add option --prefer-ucl. 2016-09-28 11:57:15 +02:00
Markus F.X.J. Oberhumer f1d713ebf6 Silence some pedantic warnings. 2016-09-28 11:29:20 +02:00
Markus F.X.J. Oberhumer 4134a512b9 Update Travis. 2016-09-28 11:13:46 +02:00
Markus F.X.J. Oberhumer cf998f945c Add support for AppVeyor CI. 2016-09-27 20:30:54 +02:00
Markus F.X.J. Oberhumer a7386238dd Update Travis. 2016-09-27 20:29:04 +02:00
Markus F.X.J. Oberhumer 6b39d122a6 Support MSVC. 2016-09-27 20:23:23 +02:00
Markus F.X.J. Oberhumer a0582c5380 pefile.cpp: don't use VLA. 2016-09-27 20:19:43 +02:00
Markus F.X.J. Oberhumer 1f37112969 Moving to github. 2016-09-27 08:41:11 +02:00
Markus F.X.J. Oberhumer 361958db76 Check endian in assertPacker(). 2016-09-26 15:38:04 +02:00
Markus F.X.J. Oberhumer 8bc7880b19 Improve gitrev handling. 2016-09-26 15:32:01 +02:00
Markus F.X.J. Oberhumer ceddf29586 Update Travis. 2016-09-26 15:32:01 +02:00
Markus F.X.J. Oberhumer 3fc78e21bc Stop using Circle CI. 2016-09-26 15:31:49 +02:00
John Reiser 48e00b371c Move UPX_F_MACH_PPC64LE and friends to 38 et seq, the little-endian side.
modified:   conf.h
2016-09-26 05:53:11 -07:00
Markus F.X.J. Oberhumer aee52d3880 Improve gitrev handling. 2016-09-26 10:35:29 +02:00
Markus F.X.J. Oberhumer bd54499537 Update Travis. 2016-09-26 10:07:48 +02:00
Markus F.X.J. Oberhumer e6da9e8d1a Small snprintf.cpp update. 2016-09-26 09:12:53 +02:00
Markus F.X.J. Oberhumer 156ca03b67 Silence some pedantic compiler warnings. 2016-09-26 09:12:53 +02:00
Markus F.X.J. Oberhumer 3f4419b177 Update stub/src for recent changes. 2016-09-26 09:12:53 +02:00
Markus F.X.J. Oberhumer 676f860d7d Normalize whitespace. 2016-09-26 09:12:53 +02:00
Markus F.X.J. Oberhumer 5ce93ae0c7 Update submodules. 2016-09-26 09:12:53 +02:00
László Molnár 43231826b9 fixed address sanitizer problem (untested) 2016-09-26 08:56:23 +02:00
Markus F.X.J. Oberhumer 899b393fcc Add support for Circle CI. 2016-09-25 17:18:29 +02:00
Markus F.X.J. Oberhumer 5c3e02d2f0 Update Travis CI. 2016-09-25 17:17:14 +02:00
Markus F.X.J. Oberhumer a29064107e Bump version date. 2016-09-25 14:01:40 +02:00
Markus F.X.J. Oberhumer 4cdc969801 Update Travis. 2016-09-25 14:00:49 +02:00
Markus F.X.J. Oberhumer 68159d457e Update Travis. 2016-09-25 09:43:30 +02:00
Markus F.X.J. Oberhumer daafc29d2b Add support for UPX_VERSION_GITREV. Some cleanups. 2016-09-25 09:41:26 +02:00
John Reiser 3c786acf2b Fix bug in Mach-O stub.
modified:   amd64-darwin.macho-upxmain.exe
	modified:   amd64-darwin.macho-upxmain.h
	modified:   src/amd64-darwin.macho-upxmain.c
2016-09-24 19:44:00 -07:00
John Reiser 53c3817d4d Allow longer Mach-O headers.
modified:   amd64-darwin.macho-upxmain.exe
2016-09-24 17:26:00 -07:00
John Reiser 9109254488 Allow longer Mach-O headers.
modified:   src/amd64-darwin.macho-upxmain.c
2016-09-24 17:21:07 -07:00
John Reiser df19f0d5ec Try harder to decompress Mach-O I386, too.
modified:   p_mach.cpp
	modified:   p_mach.h
2016-09-24 09:15:10 -07:00
John Reiser 093362e479 Merge branch 'devel' of https://github.com/upx/upx into devel 2016-09-24 06:44:19 -07:00
John Reiser 7826a3652b Try harder to decompress Mach-O, because pirates.
modified:   p_mach.cpp
	modified:   p_mach.h
2016-09-24 06:43:16 -07:00
Markus F.X.J. Oberhumer c27b7e52e1 Small Makefile update. 2016-09-24 13:49:07 +02:00
Markus F.X.J. Oberhumer 6f79cbb2a6 Update Travis. 2016-09-24 12:53:01 +02:00
Markus F.X.J. Oberhumer 6f33929f91 Cleanups. 2016-09-24 12:10:46 +02:00
Markus F.X.J. Oberhumer 2e8b649195 Update Travis. 2016-09-24 11:19:12 +02:00
Markus F.X.J. Oberhumer 3841be7e20 Remove *.bin files. 2016-09-24 11:18:18 +02:00
John Reiser 2c28521283 NetBSDElf32x86 should not impersonate [i386-linux.elf, linux/i386] 2016-09-23 19:31:26 -07:00
László Molnár 1c735cc204 fixed too strict checks in resource handling 2016-09-22 22:17:08 +02:00
Markus F.X.J. Oberhumer f0b13ae8e4 Add .editorconfig. 2016-09-22 18:29:02 +02:00
Markus F.X.J. Oberhumer b1a2f8fec0 Update vim modelines. 2016-09-22 18:17:37 +02:00
Markus F.X.J. Oberhumer 83828aa8a3 Update vim modelines. 2016-09-22 17:29:43 +02:00
Markus F.X.J. Oberhumer 4eb81b4d66 Update stub/scripts. 2016-09-22 14:27:57 +02:00
Markus F.X.J. Oberhumer 96d9968db5 Welcome 2016. 2016-09-22 14:07:14 +02:00
Markus F.X.J. Oberhumer 2781e37ec0 Mark version as "BETA". 2016-09-22 14:05:08 +02:00
Markus F.X.J. Oberhumer 6d61e773b5 Bump version year. 2016-09-22 14:02:44 +02:00
Markus F.X.J. Oberhumer c5171114d1 Clean up stub/Makefile. NFC. 2016-09-22 13:11:14 +02:00
Markus F.X.J. Oberhumer 0ca0a832de stub: arm renaming. 2016-09-22 12:36:00 +02:00
Markus F.X.J. Oberhumer aef54a4bfd Update source for previous rename. 2016-09-22 12:12:43 +02:00
Markus F.X.J. Oberhumer 4c473acfec stub: arm renaming. 2016-09-22 12:05:53 +02:00
Markus F.X.J. Oberhumer 0de41e97ac Update source for previous rename. 2016-09-22 11:54:44 +02:00
Markus F.X.J. Oberhumer 0e52ab3f90 stub: arm renaming. 2016-09-22 11:52:50 +02:00
Markus F.X.J. Oberhumer 797679b42c stub: arm renaming. 2016-09-22 11:43:23 +02:00
Markus F.X.J. Oberhumer 1bc8b6f46e Update source for previous rename. 2016-09-22 11:29:12 +02:00
Markus F.X.J. Oberhumer f322b580ff stub: arm renaming. 2016-09-22 11:28:00 +02:00
Markus F.X.J. Oberhumer 2b2f33e3f5 Update source for previous rename. 2016-09-22 11:22:18 +02:00
Markus F.X.J. Oberhumer ce29cd2fad stub: arm renaming. 2016-09-22 11:20:53 +02:00
Markus F.X.J. Oberhumer 0d5843f44e Update source for previous rename. 2016-09-22 11:17:53 +02:00
Markus F.X.J. Oberhumer e36e8e3b33 stub: arm renaming. 2016-09-22 11:15:49 +02:00
Markus F.X.J. Oberhumer e251a1ca19 Update source for previous rename. 2016-09-22 11:11:03 +02:00
Markus F.X.J. Oberhumer 4aedb00e43 stub: arm renaming. 2016-09-22 11:06:53 +02:00
Markus F.X.J. Oberhumer 10a0469221 Update source for previous rename. 2016-09-22 10:56:33 +02:00
Markus F.X.J. Oberhumer d3419acada stub: start arm renaming. 2016-09-22 10:52:26 +02:00
Markus F.X.J. Oberhumer 65ea4117ca Add some comments to stub/Makefile in prepartion of renames. 2016-09-22 10:44:40 +02:00
Markus F.X.J. Oberhumer 8b0101dcab Update source for previous rename. 2016-09-22 10:25:45 +02:00
Markus F.X.J. Oberhumer 188f67cfca stub: rename ppc64le to powerpc64le. 2016-09-22 10:20:54 +02:00
Markus F.X.J. Oberhumer a89f4bd4b8 Update .gitignore. 2016-09-22 09:56:30 +02:00
Markus F.X.J. Oberhumer 053c9dc0e1 stub: arm64: rename some files, remove unused files. 2016-09-22 09:55:13 +02:00
Markus F.X.J. Oberhumer 493d9f1b9d Ongoing cleanups. 2016-09-22 03:23:55 +02:00
Markus F.X.J. Oberhumer e28793f128 upx-clang-format -i packhead.cpp 2016-09-22 00:59:48 +02:00
Markus F.X.J. Oberhumer ea2bddf245 Fix one more file_image usage. 2016-09-22 00:58:43 +02:00
Markus F.X.J. Oberhumer 763b3c05af Don't use "long". Cleanups. 2016-09-22 00:47:35 +02:00
Markus F.X.J. Oberhumer 473cfb54be Normalize whitespace. 2016-09-22 00:02:58 +02:00
Markus F.X.J. Oberhumer a7fd742c17 Canonicalize the names of our executable formats. 2016-09-21 23:58:08 +02:00
Markus F.X.J. Oberhumer b66ba140cb More cleanups. 2016-09-21 23:18:19 +02:00
Markus F.X.J. Oberhumer 242f606a29 p_lx_elf.h: turn file_image into a MemBuffer. 2016-09-21 22:22:41 +02:00
Markus F.X.J. Oberhumer 60a1214d7e upx-clang-format -i ui.cpp 2016-09-21 21:38:56 +02:00
Markus F.X.J. Oberhumer 189ab8c8e8 upx-clang-format -i ui.h 2016-09-21 21:35:13 +02:00
Markus F.X.J. Oberhumer 3765ca4e92 Cleanups and cruft removal. 2016-09-21 21:33:53 +02:00
Markus F.X.J. Oberhumer df87d76070 p_mach.cpp: use proper types for variable "zero". 2016-09-21 20:39:00 +02:00
Markus F.X.J. Oberhumer 8fbf0b406b p_vmlinx.cpp: remove unused code fragment. 2016-09-21 17:56:43 +02:00
Markus F.X.J. Oberhumer 633073803f upx-clang-format -i s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h 2016-09-21 17:46:42 +02:00
Markus F.X.J. Oberhumer 104da198d3 Minor screen cleanup. 2016-09-21 17:43:32 +02:00
Markus F.X.J. Oberhumer b3121e4534 Use upx_uint16_t instead of unsigned short. 2016-09-21 17:40:11 +02:00
Markus F.X.J. Oberhumer 3bb654cc85 Ongoing cleanups and cruft removal. 2016-09-21 16:42:25 +02:00
John Reiser d2830db94d Fix memory leak
modified:   p_lx_elf.cpp
2016-09-20 20:43:48 -07:00
John Reiser ad6914b938 PackMachBase<T>::canUnpack() finds overlay_offset for decompression
modified:   p_mach.cpp
	modified:   p_mach.h
2016-09-20 20:07:42 -07:00
Markus F.X.J. Oberhumer 57ba965b93 Add support for Travis CI. 2016-09-21 03:54:49 +02:00
Markus F.X.J. Oberhumer 544ec21fc2 Fix building with clang. 2016-09-21 01:09:07 +02:00
Markus F.X.J. Oberhumer 1bb0fa1809 Fix a few things spotted by the gcc-6 sanitizer. Needs review. 2016-09-21 00:35:51 +02:00
Markus F.X.J. Oberhumer ffa0efc898 Makefile: add support for USE_SANITIZE. 2016-09-21 00:34:52 +02:00
Markus F.X.J. Oberhumer af6b4b8c27 Fix previous commit. 2016-09-21 00:34:20 +02:00
Markus F.X.J. Oberhumer 3f7c1f966b Minor cleanups. 2016-09-20 22:14:25 +02:00
Markus F.X.J. Oberhumer 535515f296 Update submodules. 2016-09-20 22:13:07 +02:00
Markus F.X.J. Oberhumer 7af6c4b10e Use new style casts. Cleanups. 2016-09-20 20:59:34 +02:00
Markus F.X.J. Oberhumer 2076bef95b upx-clang-format -i stdcxx.cpp stdcxx.h ; remove old cruft. 2016-09-20 20:40:08 +02:00
John Reiser 48ce1f1814 Merge branch 'master' of https://github.com/upx/upx 2016-09-20 10:56:00 -07:00
John Reiser 5151c8a505 Indentation error detected by g++-6
modified:   p_lx_elf.cpp
2016-09-20 10:55:14 -07:00
Markus F.X.J. Oberhumer 44248f19b5 Introduce mem_size() and New() and start using it. 2016-09-20 15:24:07 +02:00
Markus F.X.J. Oberhumer 8d433f2580 Update submodules. 2016-09-20 15:09:50 +02:00
Markus F.X.J. Oberhumer 272fe5488c Remove Makefile fragment from p_vmlinx.cpp. 2016-09-20 13:06:24 +02:00
Markus F.X.J. Oberhumer c97765de14 upx-clang-format -i snprintf.cpp 2016-09-20 13:03:48 +02:00
Markus F.X.J. Oberhumer 7acf150ac5 Update README.SRC. 2016-09-20 12:51:06 +02:00
Markus F.X.J. Oberhumer 077bbdfc78 conf.h: check for proper WITH_LZMA. 2016-09-20 12:45:28 +02:00
Markus F.X.J. Oberhumer 2fb38ce13a Update Makefile for upx-lzma-sdk. 2016-09-20 12:37:00 +02:00
Markus F.X.J. Oberhumer 22dc183f25 Add upx-lzma-sdk submodule. 2016-09-20 12:35:15 +02:00
Markus F.X.J. Oberhumer 3c492c3fc7 Update Makefile so that my build scripts work again. 2016-09-20 11:29:28 +02:00
Markus F.X.J. Oberhumer d71db2978e Remove some old cruft. 2016-09-20 11:24:18 +02:00
Markus F.X.J. Oberhumer e4723e0bad Avoid some compiler warnings. 2016-09-20 10:54:27 +02:00
Markus F.X.J. Oberhumer dc56c4e530 bptr.h: size optimizations. 2016-09-20 10:30:09 +02:00
Markus F.X.J. Oberhumer 9579a51a8b pefile.cpp: always use BoundedPtr. 2016-09-20 10:20:42 +02:00
Markus F.X.J. Oberhumer 71f897ebf5 Avoid a -Wsign-compare warning. 2016-09-20 10:08:32 +02:00
Markus F.X.J. Oberhumer 09d9f71ae9 p_mach.h: use proper upx types. 2016-09-20 10:05:08 +02:00
John Reiser c678ccdfb1 stub/ppc64le-darwin.macho-fold.h is flapping (works one time, not the next.) 2016-09-19 21:25:30 -07:00
John Reiser bbbebe343b Try to recover powerpc64le. Still not successful [TOC space?]
modified:   Makefile
	new file:   ppc64-savegpr0.S
	modified:   ppc64le-darwin.macho-fold.h
2016-09-19 20:05:52 -07:00
John Reiser 033cb4f0c2 Fix merge
modified:   p_mach.cpp
2016-09-19 18:49:40 -07:00
John Reiser d750034b79 amd64-darwin.macho-upxmain.exe and .h 2016-09-19 18:32:26 -07:00
Markus F.X.J. Oberhumer a2063f0628 Normalize whitespace. 2016-09-20 02:06:58 +02:00
Markus F.X.J. Oberhumer acf2f2ffc4 Merge branch 'sierra' 2016-09-20 01:54:33 +02:00
Markus F.X.J. Oberhumer d14f484c4b Moving to github. 2016-09-19 22:41:32 +02:00
Markus F.X.J. Oberhumer 695e515a65 stub: update powerpc64le settings. 2016-09-19 22:22:21 +02:00
upstream 61089feee7 New ACC version. 2016-09-19 12:44:29 +00:00
Markus F.X.J. Oberhumer ddc9b10cd3 Add scripts/upx-clang-format. 2016-09-19 11:04:25 +02:00
Markus F.X.J. Oberhumer f95c92b431 Create a dummy stub/ppc64le-darwin.macho-fold.h so that upx builds again. 2016-09-19 10:54:23 +02:00
Markus F.X.J. Oberhumer eba65a94e6 Add missing *.dump files to repo. 2016-09-19 10:44:22 +02:00
John Reiser c28a0c6bb8 Synchronize stubs
modified:   src/stub/arm64-darwin.macho-entry.h
	modified:   src/stub/arm64-darwin.macho-fold.h
	modified:   src/stub/ppc64le-linux.elf-fold.h
	modified:   src/stub/tmp/arm64-darwin.macho-entry.bin.dump
2016-09-18 12:45:11 -07:00
Markus F.X.J. Oberhumer d6bacd9b47 Remove src/stub/scripts/UNUSED. 2016-09-18 16:07:47 +02:00
Markus F.X.J. Oberhumer 70b1657323 Update for upx-stubtools v20160918. 2016-09-18 16:00:29 +02:00
Markus F.X.J. Oberhumer 1ef08bd169 Add .gitignore. 2016-09-18 15:29:03 +02:00
Markus F.X.J. Oberhumer da68cc6a78 Remove .hgignore and .hgtags. 2016-09-18 15:00:53 +02:00
John Reiser 45c75d42ad Catch up to upxtools 20160902; add dangling arm/v8a/lzma_d.S 2016-09-17 19:51:32 -07:00
jreiser@BitWagon.com d4e55af2c2 Propagate LC_VERSION_MIN_MACOSX and LC_SOURCE_VERSION
changed src/p_mach.cpp
2016-09-17 16:40:07 -07:00
jreiser@BitWagon.com 48791a329d overlay_offset for decompress
changed src/p_mach.cpp
2016-09-17 16:16:41 -07:00
jreiser@BitWagon.com 9b26ebed75 LINKEDIT has unfilter and decompressor
changed src/p_mach.cpp
 changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-17 15:24:23 -07:00
jreiser@BitWagon.com e2160fb6c9 segLINK.initprot |= VM_PROT_EXECUTE
changed src/p_mach.cpp
2016-09-17 10:41:38 -07:00
jreiser@BitWagon.com 345a1c64f9 Omit Mach_command from stub where allowed.
changed src/p_mach.cpp
2016-09-17 09:36:58 -07:00
jreiser@BitWagon.com 7ad1e7756b Cleanup for checkin
changed src/p_mach.cpp
2016-09-17 06:49:41 -07:00
jreiser@BitWagon.com 90caf19e9e Cleanup amd64-darwin.macho-upxmain.c
changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
 changed src/stub/src/amd64-darwin.macho-upxsubr.S
2016-09-16 21:29:37 -07:00
jreiser@BitWagon.com 8d0b3b7d44 Fix segXHDR, but assume no __DATA in stub for now.
changed src/p_mach.cpp
2016-09-15 21:44:17 -07:00
jreiser@BitWagon.com 4c253d68d4 new start address 0xfe000000
changed src/stub/amd64-darwin.macho-upxmain.h
2016-09-15 21:38:39 -07:00
jreiser@BitWagon.com 73d1b331f1 trim Mach_command from stub. [Dirty, needs cleanup!]
changed src/p_mach.cpp
2016-09-13 20:20:41 -07:00
jreiser@BitWagon.com af2fddfd6d rebuild stub
changed src/stub/amd64-darwin.macho-upxmain.h
2016-09-13 20:18:54 -07:00
jreiser@BitWagon.com 3e065ead65 fix .bss in floating dyld
changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-13 20:17:51 -07:00
jreiser@BitWagon.com 3774704326 forgotten file; 3 FIXME !
added src/stub/src/arch/arm/v8a/lzma_d-arm.S
2016-09-13 20:14:44 -07:00
jreiser@BitWagon.com 4a1100b6a4 Unexport all symbols in compressed output.
added src/stub/src/amd64-darwin.macho-upxhide.txt
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-11 15:28:42 -07:00
jreiser@BitWagon.com 63dec77ed6 Try auto-relocate for /usr/lib/dyld
changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-11 15:08:56 -07:00
jreiser@BitWagon.com 1d3a66f890 bswap(), bzero(), fat_find(), assembly-language system calls
added src/stub/src/amd64-darwin.macho-upxsubr.S
 changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-11 14:22:19 -07:00
jreiser@BitWagon.com c1da92ca22 reduce asm()
changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-11 06:03:06 -07:00
jreiser@BitWagon.com 13475002d7 segXHDR reserves address space; actual launch!
changed src/p_mach.cpp
 changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-10 20:13:44 -07:00
jreiser@BitWagon.com 5bb6f246ed Mach-O dyld: __LINKEDIT must have highest .vmaddr and .fileoff 2016-09-10 15:46:36 -07:00
jreiser@BitWagon.com 89df7451ef Rebuild stubs
changed src/stub/amd64-darwin.macho-entry.h
 changed src/stub/amd64-darwin.macho-upxmain.h
 changed src/stub/tmp/amd64-darwin.macho-entry.bin.dump
2016-09-10 15:03:55 -07:00
jreiser@BitWagon.com 1334d544f7 stubtools 20160902 2016-09-10 15:03:04 -07:00
jreiser@BitWagon.com 3fefaa7362 revamp MH_EXECUTE: try to meet expectations of MacOSX 10.12 Sierra
changed src/p_mach.cpp
 changed src/stub/src/amd64-darwin.macho-upxmain.c
2016-09-10 15:02:13 -07:00
jreiser@BitWagon.com 15d62f7b96 Mach_main_command LC_MAIN 2016-09-10 15:00:28 -07:00
jreiser@BitWagon.com 83e0aaa511 sections AMD64BXX, MACH_UNC for MacOSX 10.12 2016-09-10 14:59:23 -07:00
jreiser@BitWagon.com ee06ce1148 generic Mach_command 2016-09-10 14:57:27 -07:00
jreiser@BitWagon.com 16d6124bb4 amd64-darwin.macho-upxmain for stub on Mac OS X 10.12 "Sierra" 2016-09-05 20:37:23 -07:00
jreiser@BitWagon.com 1197beaa13 ElfLinker::init() zero length implies 0x4000 blank bytes 2016-09-05 20:36:07 -07:00
jreiser@BitWagon.com 98b428a8be Fix compiler warning 2016-09-05 20:32:52 -07:00
jreiser@BitWagon.com 17f47d3c0a p_mach*: Try for MacOSX 10.12 "Sierra" with UUID, XHDR. 2016-09-04 19:05:31 -07:00
John Reiser a9cc3b2a89 Use gcc-ppc64-linux-gnu-5.3.1-2.fc22.x86_64
But bin-upx-20130920/multiarch-ld-2.17 gets SIGSEGV for fold.h

  src/stub/Makefile
  src/stub/ppc64le-darwin.dylib-entry.h
  src/stub/ppc64le-darwin.macho-entry.h
  src/stub/ppc64le-linux.elf-entry.h
  src/stub/ppc64le-linux.kernel.vmlinux.h
2016-07-27 08:57:54 -07:00
John Reiser 199102c106 stub/src/arch/arm/v8a/lzma_d_cf.S and follow-ons
src/stub/arm64-darwin.macho-entry.h
  src/stub/src/arch/arm/v8a/lzma_d_cf.S
  src/stub/tmp/arm64-darwin.macho-entry.bin.dump
2016-07-27 08:27:06 -07:00
John Reiser c7d76fb7ab Change copyright year 2013 ==> 2016 in ppc64le files.
src/stub/ppc64le-darwin.macho-fold.h
  src/stub/src/arch/ppc64le/64/bxx.S
  src/stub/src/arch/ppc64le/64/lzma_d.S
  src/stub/src/arch/ppc64le/64/macros.S
  src/stub/src/arch/ppc64le/64/nrv2b_d.S
  src/stub/src/arch/ppc64le/64/nrv2d_d.S
  src/stub/src/arch/ppc64le/64/nrv2e_d.S
  src/stub/src/ppc64le-darwin.dylib-entry.S
  src/stub/src/ppc64le-darwin.macho-entry.S
  src/stub/src/ppc64le-darwin.macho-fold.S
  src/stub/src/ppc64le-darwin.macho-main.c
  src/stub/src/ppc64le-linux.elf-entry.S
  src/stub/src/ppc64le-linux.elf-fold.S
  src/stub/src/ppc64le-linux.elf-fold.lds
  src/stub/src/ppc64le-linux.elf-main.c
  src/stub/src/ppc64le-linux.kernel.vmlinux-head.S
  src/stub/src/ppc64le-linux.kernel.vmlinux.S
2016-07-26 21:42:07 -07:00
John Reiser ba9b86c0dc added src/stub/src/arch/arm/v8a/lzma_d_cf.S 2016-07-26 21:32:43 -07:00
John Reiser 5de83a606e Cleanup after Thierry Fauck changes for ppc64le.
We need a "UPX standard" compiler in order to re-compile the stubs for ppc64le;
meanwhile use Thierry's "pre-compiled" stubs.
Revert powerpc stubs to those produced by UPX standard powerpc.405-linux-gcc-3.4.5.
Cleanup the workarounds that Thierry used because he lacked upx-stubtools 20130920.
ARMv8 (64-bit) compiles but is incomplete and does not run yet.

 changed src/Makefile
 changed src/linker.cpp
 changed src/stub/Makefile
 changed src/stub/amd64-linux.elf-entry.h
 changed src/stub/arm64-darwin.macho-entry.h
 changed src/stub/arm64-darwin.macho-fold.h
 changed src/stub/powerpc-darwin.dylib-entry.h
 changed src/stub/powerpc-darwin.macho-entry.h
 changed src/stub/powerpc-darwin.macho-fold.h
 changed src/stub/powerpc-linux.elf-entry.h
 changed src/stub/powerpc-linux.elf-fold.h
 changed src/stub/powerpc-linux.kernel.vmlinux.h
 changed src/stub/scripts/xstrip.py
 changed src/stub/src/arch/arm/v8a/lzma_d.S
 changed src/stub/src/arch/arm/v8a/macros.S
 changed src/stub/src/arm64-darwin.macho-entry.S
 changed src/stub/tmp/arm64-darwin.macho-entry.bin.dump
2016-07-26 21:29:29 -07:00
John Reiser 01a0c8672d changeset: 2451:4e2a6c33d5fb
tag: ppc64le
user: Thierry Fauck <tfauck@free.fr>
date: Wed Jun 22 08:25:13 2016 -0400
summary: Add support for ppc64le statically linked binaries
2016-07-26 17:00:25 -07:00
John Reiser fa522c0ffc Hacking convert v4a/lzma_d-arm.S from 32-bit to 64-bit 2016-02-14 21:26:37 -08:00
John Reiser 16241d010f PUSH+POP now in macros.S 2016-02-14 21:25:28 -08:00
John Reiser 9cb8fbf178 branch merge
branch 'default'
   changed src/pefile.cpp
   changed src/pefile.h
2016-01-31 20:11:42 -08:00
John Reiser bd7ef27628 ARM64LE begins implementation
added src/stub/arm64-darwin.macho-entry.h
   added src/stub/arm64-darwin.macho-fold.h
   added src/stub/src/arch/arm/v8a/lzma_d.S
   added src/stub/src/arch/arm/v8a/macros.S
   added src/stub/src/arch/arm/v8a/nrv2b_d8.S
   added src/stub/src/arch/arm/v8a/nrv2d_d8.S
   added src/stub/src/arch/arm/v8a/nrv2e_d32.S
   added src/stub/src/arch/arm/v8a/nrv2e_d8.S
   added src/stub/src/arm64-darwin.macho-entry.S
   added src/stub/src/arm64-darwin.macho-fold.S
   added src/stub/src/arm64-darwin.macho-main.c
   added src/stub/src/arm64-linux.elf-entry.S
   added src/stub/src/arm64-linux.elf-fold.S
   added src/stub/tmp/arm64-darwin.macho-entry.bin.dump
   changed src/p_mach.cpp
   changed src/p_mach.h
   changed src/stub/Makefile
2016-01-31 20:09:38 -08:00
John Reiser 42e520e841 ElfLinkerArm64LE 2016-01-31 19:59:00 -08:00
John Reiser d8f9cd237f UPX_F_MACH_ARM64EL 2016-01-31 19:58:17 -08:00
László Molnár 33065ecf04 fixed resource bounds checking when compressing; let --force override throwing an exception 2015-08-11 13:05:10 +02:00
John Reiser 718a1da262 Bounds check shstrtab in PackVmlinuxBase<T>::canPack() 2015-08-10 05:45:52 -07:00
John Reiser b89c3ebb42 LZMA version 15.05 2015-08-03 22:36:16 -07:00
John Reiser 9d7e44feff GNU Make 4.0 does not assign to MAKEFLAGS sequentially 2015-08-03 22:35:00 -07:00
John Reiser e48a60a4f0 Add link to goupx for Go-language workaround and UI. 2015-07-28 13:40:44 -07:00
John Reiser 163e1907a4 0==.vmsize in Go-language LC_SEGMENT_64; also g++ 5.1.1 nit 2015-07-25 12:54:25 -07:00
John Reiser ac1ccaa246 Go-language PT_LOAD 2015-07-25 07:21:28 -07:00
John Reiser 53b45279ad Better diagnosis of Go-language PT_LOAD; https://sourceforge.net/p/upx/bugs/195/ 2015-07-25 07:11:57 -07:00
John Reiser f80daf5de1 CERT-FI Case 829767 UPX command line tools segfaults
The vulnerabilities were discovered by Joonas Kuorilehto and Antti Häyrynen from Codenomicon.
2015-05-16 15:33:31 -07:00
John Reiser 298ea1f0d3 ::unpack(): another check on b_info; uncompressed ElfXX_Ehdr must match input 2015-05-16 15:23:01 -07:00
John Reiser 1d13d8c4a0 PackMachBase::unpack() process lc_seg in same order as ::pack() 2015-05-16 15:20:03 -07:00
John Reiser 2238c99b61 another check on b_info in ::unpackExtent() 2015-05-16 15:18:28 -07:00
John Reiser 7d4dfbef2b cleanup IPTR_I_D 2015-05-15 20:56:34 -07:00
John Reiser 759827b404 EI_OSABI for EM_ARM is a real mess 2015-05-15 20:47:35 -07:00
John Reiser fca627d1b0 ::seek() returns resulting off_t; InputFile::seek() restricts to actual _length 2015-05-15 20:44:09 -07:00
John Reiser 404da18aed IPTR_I_D: 'import' buffer is a subset of ibuf 2015-05-15 20:42:18 -07:00
John Reiser 330fca722a too large: blocksize > 1024*1024*1024 [corrupted] 2015-05-15 05:36:21 -07:00
John Reiser 8939cd120b too small: (st.st_size < 512) 2015-05-15 05:32:52 -07:00
László Molnár 63afeb7373 added a check for corrupted packheader 2015-05-14 21:48:16 +02:00
László Molnár 6ba68a6455 PE related fixes for CERT-FI 829767 2015-05-14 21:46:52 +02:00
John Reiser 1579c74302 canPack() requires 0 < nfat 2015-05-10 14:01:48 -07:00
John Reiser 373ca15c71 size < 1024 is too short 2015-05-10 14:01:08 -07:00
John Reiser a8a3caed1c Check blocksize 2015-05-09 20:29:56 -07:00
John Reiser cb35ba4543 At ::unpack much of decompressed Mach_header must match outer Mach_header 2015-05-09 20:14:32 -07:00
John Reiser cdd152d015 Detect (int)blocksize < 0 2015-05-09 20:13:30 -07:00
John Reiser 83ce7dc62f Must not compare orig_file_size with fi->st_size() during ::unpack 2015-05-09 17:47:17 -07:00
John Reiser b182b50f24 Distinguish corruption of p_info, b_info 2015-05-09 10:13:13 -07:00
John Reiser 71a9941b84 Check getImageSize(). CERT-FI 829767
id:000058,sig:06,src:000001,op:havoc,rep:64
2015-05-09 07:29:26 -07:00
John Reiser c777da263e Check blocksize. CERT-FI 829767
id:000053,sig:06,src:000000,op:arith8,pos:10440,val:+20
2015-05-09 07:25:25 -07:00
John Reiser 2cb7b56a41 Check ph.c_len; CERT-FI 829767
id:000023,sig:06,src:000000,op:flip2,pos:10440
2015-05-09 07:18:54 -07:00
John Reiser 52f9ef14b9 Check ph.c_len; CERT-FI 829767
id:000010,sig:06,src:000000,op:flip1,pos:11584
2015-05-09 07:13:47 -07:00
John Reiser 8d6c594240 Check ph.c_len; CERT-FI 829767
id:000008,sig:06,src:000000,op:flip1,pos:205
2015-05-09 07:05:17 -07:00
John Reiser 7ad77ff540 Check blocksize. CERT-FI 829767
id:000005,sig:06,src:000000,op:havoc,rep:16
2015-05-09 06:56:32 -07:00
John Reiser acede72e9b Check ph.c_len. CERT-FI 829767
id:000002,sig:06,src:000000,op:havoc,rep:1
2015-05-09 06:49:45 -07:00
John Reiser 771fd732d1 Check e_phentsize; CERT-FI 829767
id:000064,sig:06,sync:upx-macho-crash-2,src:000096
2015-05-09 05:31:36 -07:00
John Reiser 2a79a69f59 PackUnix::unpack() is non-Elf. CERT-FI 829767
id:000057,sig:11,sync:upx-macho-crash-2,src:000108
id:000058,sig:11,sync:upx-macho-crash-2,src:000107
id:000059,sig:06,sync:upx-macho-crash-2,src:000106
id:000060,sig:06,sync:upx-macho-crash-2,src:000103
2015-05-09 05:14:12 -07:00
John Reiser 8c0321697f Check PackHeader before decompress; CERT-FI id:000002,sig:06,src:000000,op:flip1,pos:4629 2015-05-08 20:13:44 -07:00
John Reiser 0151b3f9b3 Validate Mach_segment_command.cmdsize; CERT-FI id:000000,sig:11,src:000000,op:havoc,rep:2 2015-05-08 19:45:05 -07:00
John Reiser 82a51f35ea Validate header CERT_FI id:000000,sig:11,src:000000,op:flip1,pos:1 2015-05-08 19:22:24 -07:00
John Reiser 35944cbfc1 Validate fat_head; CERT-FI id:000000,sig:06,src:000000,op:flip1,pos:7 2015-05-08 18:32:42 -07:00
John Reiser f0aef9b28b Check input data; CERT-FI upx-crashes-elf id:000000,sig:11,src:000000,op:flip1,pos:0 2015-05-08 17:04:16 -07:00
John Reiser ae37c3902c Apple codesign requires a different secTEXT.size 2015-03-27 20:41:00 -07:00
John Reiser d612585582 C/7zTypes.h #if (WITH_LZMA >= 0x938) 2015-03-15 10:30:55 -07:00
John Reiser 7ca14d209c Use upx_uint64_t instead of "unsigned long". 2015-01-10 12:26:35 -08:00
Markus F.X.J. Oberhumer c37f582c10 Merge. 2015-01-04 11:11:05 +01:00
John Reiser 6272fb3822 ARM --lzma && is_big: stub mmap must allow for cpr0.sz_unc [How did this ever work before?] 2015-01-02 17:36:26 -08:00
Markus F.X.J. Oberhumer 2582fbac59 Update src/Makefile to use more conservative gcc optimization settings. 2015-01-03 01:55:51 +01:00
Markus F.X.J. Oberhumer 5abb578e47 p_djgpp2.{cpp,h}: remove usage of "long". 2015-01-03 01:12:46 +01:00
Markus F.X.J. Oberhumer 015ebf89a5 lefile.h: remove usage of "long". 2015-01-03 01:04:41 +01:00
Markus F.X.J. Oberhumer c6724968f1 pefile.cpp: work around a gcc-3.4 limitation. 2015-01-03 00:40:28 +01:00
Markus F.X.J. Oberhumer 9fa1772ae4 Merge. 2015-01-03 00:34:42 +01:00
Markus F.X.J. Oberhumer 4551937812 Bump version year. 2015-01-03 00:26:48 +01:00
John Reiser 51ee664cae PackLinuxElf32help1 refuses if e_ident[EI_DATA] mismatches bele policy 2015-01-02 15:25:29 -08:00
Markus F.X.J. Oberhumer fb611a98f9 Welcome 2015. 2015-01-03 00:24:07 +01:00
Markus F.X.J. Oberhumer a3d5face38 Fix a comment. 2015-01-03 00:21:51 +01:00
László Molnár 424cd497d3 pe64: saved a few bytes in the nrv decompressors 2014-03-18 23:35:30 +01:00
László Molnár d46eeffaaf NEWS updated 2014-03-10 21:53:46 +01:00
László Molnár 6520f2061e arm/pe: thumb mode stub hopefully fixed 2014-03-10 21:44:23 +01:00
László Molnár 5d93f86b4b armpe_tester: better import handling 2014-03-10 21:42:11 +01:00
László Molnár b3f63ce7ae pe: fix a bug in pack0() for arm 2014-03-09 23:55:28 +01:00
László Molnár 56de770682 armpe_tester now works on android 2014-03-09 23:42:41 +01:00
László Molnár 940341bc9d arm/pe: import handling updates (untested) 2014-03-08 18:59:26 +01:00
László Molnár 804a0ce601 merge 2014-03-06 22:38:15 +01:00
László Molnár 41054a4c56 handle duplicates in ImportLinker 2014-03-06 22:26:41 +01:00
László Molnár 7b8e5d4180 pe: remove some dead code 2014-03-05 23:59:53 +01:00
László Molnár ca2369f1c1 pe: win32/win64 pack/unpack seems to work again 2014-03-05 23:40:24 +01:00
László Molnár 129cb0b3cd pe: packing of pe64 starts to work again 2014-03-04 23:51:59 +01:00
László Molnár 632b2ae1ba pe: pack() logic moved to PeFile 2014-03-02 22:34:52 +01:00
László Molnár 18e55061e1 pepfile.* disabled; PeFile64 class introduced 2014-02-20 00:10:18 +01:00
László Molnár e49b65723f pe: canUnpack moved to PeFile 2014-02-19 23:27:41 +01:00
László Molnár 8e52894763 pe: loadconf handling moved to PeFile 2014-02-19 21:45:24 +01:00
László Molnár 07cba6c774 pe32: tls refactoring 2014-02-18 00:23:42 +01:00
László Molnár 9cb639b505 pe32: refactoring of import handling and unpacking continues 2014-02-16 23:04:39 +01:00
Markus F.X.J. Oberhumer 4cf6eeeee2 README.SRC: update an URL. 2014-01-27 20:59:47 +01:00
John Reiser c0f692792f 2014 2014-01-10 19:23:41 -08:00
John Reiser bd77e0945b more LC_* constants 2014-01-10 19:22:30 -08:00
Markus F.X.J. Oberhumer f0eb171b2a Strip trailing whitespace. 2014-01-07 23:09:11 +01:00
Markus F.X.J. Oberhumer fb93662b5c Bump version for next release. 2014-01-07 23:08:00 +01:00
Markus F.X.J. Oberhumer a26c982e93 Welcome 2014. 2014-01-07 23:05:10 +01:00
Markus F.X.J. Oberhumer 7db3e98944 Small cleanups. 2014-01-07 23:03:16 +01:00
Markus F.X.J. Oberhumer 4a87834e04 New ACC version. 2014-01-07 19:15:57 +00:00
Markus F.X.J. Oberhumer bf6ecaeeb9 stub: minor cosmetic cleanups. 2013-12-02 19:37:28 +01:00
Markus F.X.J. Oberhumer f70ef86dfa help.cpp: add a missing con_fg() call. 2013-12-02 19:23:06 +01:00
John Reiser cd3132667a ARM shlib escape hatch moves to just beyond .text.
https://sourceforge.net/p/upx/bugs/223/
2013-11-22 19:26:19 -08:00
John Reiser 1c459a7bea Sync stubs. 2013-11-16 14:29:52 -08:00
John Reiser 4f0bfeab4c Round down unfilter length to a multiple of 4.
https://sourceforge.net/p/upx/bugs/223
2013-11-16 14:28:59 -08:00
John Reiser c5c9921b59 Unpack detects is_shlib more robustly. Dispute .e_shoff. 2013-11-16 14:25:53 -08:00
John Reiser 6b63aba1fc Disable jni_onload_* 2013-11-09 16:06:41 -08:00
John Reiser 382331fb11 e_phoff and e_shoff are 32/64 specific 2013-10-28 07:11:40 -07:00
John Reiser caf9af7ae4 JNI_OnLoad is a pre-DT_INIT in a shared library. 2013-10-26 09:51:25 -07:00
John Reiser 45d2adeb9c Android < 4.1 (kernel < 3.0.31) often has PT_INTERP of /system/bin/linker
with bad PT_LOAD[0].  https://sourceforge.net/p/upx/bugs/221
2013-10-21 07:27:53 -07:00
László Molnár 96708d7592 ImportLinker copied into PeFile 2013-10-12 16:48:56 +02:00
John Reiser 13090d1219 ARM close /proc/self/exe after mmap 2013-10-06 19:56:14 -07:00
László Molnár 8ab229cca9 pe: refactoring started 2013-10-06 22:57:20 +02:00
John Reiser 583cd078dc ARM elf-fold: preserve /proc/self/exe by mmap of one page into stack 2013-10-06 13:22:05 -07:00
László Molnár aa2ac1bbb8 pe: ImportLinker introduced 2013-10-04 22:48:21 +02:00
Markus F.X.J. Oberhumer 928b426672 Add tag for RELEASE_391. 2013-09-30 15:51:00 +00:00
Markus F.X.J. Oberhumer 6766b14415 Prepare release. 2013-09-30 14:21:37 +02:00
John Reiser 9d0f9e967f Avoid stmdb with write-back register in stored list,
even when stored value is don't care.
2013-09-21 09:52:21 -07:00
John Reiser d7609088e5 Silence "warning: cannot find entry symbol _start" 2013-09-21 08:39:15 -07:00
Markus F.X.J. Oberhumer b2643b6926 Start using the new intergral type names. 2013-09-20 08:19:18 +02:00
Markus F.X.J. Oberhumer 07b65ca069 Introduce integral type names using <stdint.h> terminology like "upx_uint64_t". 2013-09-20 08:16:37 +02:00
Markus F.X.J. Oberhumer 25727f7f99 Minor portability fixes. 2013-09-20 07:48:29 +02:00
Markus F.X.J. Oberhumer 880ae89307 Bump version and tentative release date. 2013-09-20 07:19:06 +02:00
Markus F.X.J. Oberhumer 1496df1989 New ACC version. 2013-09-20 07:09:35 +02:00
Markus F.X.J. Oberhumer 7d8ae6b4b1 Make amd64-win64.pep.S compile with current upx stubtools. 2013-09-20 07:08:09 +02:00
Markus F.X.J. Oberhumer 312d4cccaf stub: start using stubtools bin-upx-20130920. 2013-09-20 06:59:27 +02:00
Markus F.X.J. Oberhumer ce5f9f95ea stub: fix i386 syntax for current gas versions, and add some explicit
alignments at the end of the file so that we do not depend on gas defaults.
2013-09-20 06:15:46 +02:00
Markus F.X.J. Oberhumer d9bf8a76d9 Protect against changes from future gas versions in amd64-linux.elf-entry.S. 2013-09-20 05:22:05 +02:00
Markus F.X.J. Oberhumer f7a35fb9fe stub: save 1 byte in amd64-darwin.{dylib,macho}-entry.S. 2013-09-20 04:20:23 +02:00
Markus F.X.J. Oberhumer 3ba691ded5 Remove trailing whitespace. 2013-09-20 03:25:59 +02:00
Markus F.X.J. Oberhumer 7a7277d56f Use correct "movzwl" opcode in src/stub/src/arch/i386/macros.S. 2013-09-20 03:18:19 +02:00
László Molnár 76be5dd1d3 linker: Section::offset should be u64 2013-09-01 21:38:44 +02:00
László Molnár 53dc63f3bc linker: a small 64-bit relocation support related fix 2013-09-01 11:15:30 +02:00
László Molnár 80da0bc9d5 pepfile: infoWarning about unsupported relocation types fixed 2013-08-28 22:33:39 +02:00
László Molnár bce7af4e11 fixed 8 bit range checking in ElfLinkerAMD64::relocate1 2013-08-28 22:31:40 +02:00
László Molnár 9da09b51ed win64/pe: tls callback assembly improvements + misc cleanups 2013-08-28 21:53:23 +02:00
László Molnár 86392f197f win64/pe: lzma support added 2013-08-28 00:24:54 +02:00
László Molnár 1c13046297 win64/pe: added nrv2b and nrv2d support 2013-08-27 22:06:52 +02:00
László Molnár fbc756b531 win64/pe: filter support added 2013-08-27 21:22:21 +02:00
László Molnár 6c64b06453 win64/pe: uncompression seems to work; tls handling improvement 2013-08-26 22:07:55 +02:00
László Molnár 241834029a 64 relocation handling added; basic DLL support works 2013-08-25 23:54:13 +02:00
László Molnár 5b8a9c0b47 basic win64 PE support added 2013-08-22 22:01:09 +02:00
László Molnár 037c29d24a added full support for 64-bit relocations 2013-08-22 21:43:11 +02:00
László Molnár 893f26ac9a fix wcle fixup unpacking segfault (sf.net bug 220) 2013-08-19 13:39:44 +02:00
John Reiser d43f8e3100 Alignment bug in test or decompress of shared library;
sourceforge.net/p/upx/bugs/218/
2013-07-06 13:50:15 -07:00
John Reiser 2b42acf7b8 ARM heuristic dcache flush by sweeping 1/2 MB 2013-06-10 14:20:59 -07:00
John Reiser f65b80ed42 ARM remember readlink("/proc/self/exe",) as environment variable " =" (3 spaces) 2013-06-09 20:33:59 -07:00
John Reiser e84abbdc82 ARM __clear_cache() has bugs
Linux hostname 3.0.8-482645-user #1 SMP PREEMPT Mon Apr 30 19:43:45 KST 2012 armv7l GNU/Linux
  Processor	: ARMv7 Processor rev 3 (v7l)

  processor	: 0
  BogoMIPS	: 597.12

  processor	: 1
  BogoMIPS	: 597.12

  CPU implementer	: 0x41
  CPU architecture: 7
  CPU variant	: 0x1
  CPU part	: 0xc09
  CPU revision	: 3

  Hardware	: Espresso10
  Revision	: 000a
2013-06-09 13:03:06 -07:00
John Reiser 66269eabe9 ARM Try a hole so that kernel does not extend brk(0) 2013-06-08 08:39:08 -07:00
John Reiser 36c0928483 ARM __clear_cache() on escape hatch; http://sourceforge.net/p/upx/bugs/214/ 2013-06-07 07:08:03 -07:00
John Reiser 9237e15adc Fix ARM compress shared library. 2013-05-10 16:20:52 -07:00
Markus F.X.J. Oberhumer 0d3a2072b2 Add some more sanity checks in pefile.cpp. 2013-04-04 14:30:52 +02:00
Markus F.X.J. Oberhumer aa2ee5dfc2 New ACC version. 2013-03-20 16:48:27 +00:00
John Reiser b515fa39ec Apple codesign follies: need more flags 2013-03-07 19:47:44 -08:00
Markus F.X.J. Oberhumer 76e3f4eb92 Post-release version bump. 2013-02-20 13:50:12 +01:00
Markus F.X.J. Oberhumer 4959e5c6c2 Add tag for RELEASE_309. 2013-02-18 16:09:00 +00:00
Markus F.X.J. Oberhumer 7082594bbc Prepare release. 2013-02-18 11:03:33 +01:00
Markus F.X.J. Oberhumer 36dd35f238 Silence some compilation warnings. 2013-02-18 11:01:30 +01:00
John Reiser 9c9fb6a485 DEBUG-only bug in decimal() 2013-02-15 16:35:45 -08:00
John Reiser 5438a4837b more AT_PHDR trouble 2013-02-15 16:32:51 -08:00
Markus F.X.J. Oberhumer 84996e8cb6 Bump tentative release date. 2013-02-12 10:32:11 +01:00
Markus F.X.J. Oberhumer 87a368a857 Welcome 2013. 2013-02-12 10:14:03 +01:00
Markus F.X.J. Oberhumer 21412d93dd New ACC version. 2013-02-12 08:16:44 +00:00
John Reiser 0b11ff22b4 internal documentation: pointer to source for Apple codesign 2013-02-03 11:27:02 -08:00
John Reiser 8fafa78796 sync stubs 2013-01-31 12:33:16 -08:00
John Reiser c43158f8a2 find PT_LOAD in case ARM PT_EXIDX is first 2013-01-31 12:21:51 -08:00
John Reiser 92ad524947 clear registers at user entry (paranoia) 2013-01-31 12:20:42 -08:00
John Reiser b362a61863 fix for user brk() on ARM with static linking 2013-01-31 12:19:35 -08:00
John Reiser 468fec38d7 Fix .e_ident[EI_OSABI] for Debian armhf. 2013-01-30 13:31:35 -08:00
John Reiser 89830a5ae0 Mac OS X codesign disallows overhang of vmsize. 2013-01-25 15:58:25 -08:00
John Reiser 5977c296bd Fix codesign for Mac OS X. 2013-01-24 15:28:21 -08:00
John Reiser 47d5792d97 Updates to prepare for next release. 2012-11-14 09:07:10 -08:00
Markus F.X.J. Oberhumer 25d706a913 Whitespace cleanup. 2012-10-31 15:50:52 +01:00
John Reiser 048236aaaa Isolate change to p_mach.cpp of previous revision
(p_lx_elf.cpp and p_lx_elf.h were included by mistake.)
2012-10-10 08:58:15 -07:00
John Reiser d442c58fd1 MachO no longer needs contiguous LC_SEGMENT (SourceForge bug 3308161) 2012-10-10 08:51:52 -07:00
John Reiser f890f6bb09 ignore another .vmsize==0; fix unfold which needs another page 2012-08-23 14:26:42 -07:00
John Reiser 036d466790 allow 3-byte decompressor overrun; fix DEBUG decimal(); unify with i386 2012-08-23 14:25:32 -07:00
John Reiser dee47ba2d8 implement DEBUG 2012-08-23 14:22:55 -07:00
John Reiser be96c28b77 fix DEBUG decimal() of negative number 2012-08-23 12:37:44 -07:00
John Reiser ad1c0f578e fix DEBUG decimal() of negative number 2012-08-23 07:31:30 -07:00
John Reiser c8f7b1b72c MacOSX launcher gets SIGBUS when it cannot find mapped Mach_header.
Add segZERO, segMHDR, secMHDR.
2012-08-22 20:46:35 -07:00
John Reiser c89702ae84 skip 0==.vmsize; also DEBUG, DPRINTF 2012-08-22 20:43:00 -07:00
John Reiser 2d29a82250 PackMachBase<T>::pack1() segTEXT.vmaddr must ignore zero-length segments 2012-08-20 20:02:26 -07:00
John Reiser b36c65e654 fix Mac OS X code signing; also leave room for LC_UUID 2012-08-04 16:44:21 -07:00
John Reiser 09b072b908 Leave space for code signing on Mac OS X. 2012-08-03 13:28:33 -07:00
John Reiser 0ae9fee350 Mach_linkedit_data_command 2012-08-03 13:20:00 -07:00
John Reiser 1579182ed9 PackUnix::canUnpack() allows zero-filled last page 2012-08-03 13:19:28 -07:00
John Reiser 074671aa71 ::unpack "if (fo)"; also "delete []" (SourceForge bug 3545609) 2012-07-19 20:11:44 -07:00
John Reiser 36b7c47247 __DWARF LC_SEGMENT_64 with .vmsize==0 (SourceForge bug 3308161) 2012-07-18 15:37:41 -07:00
John Reiser 424d5b3025 UPX_LZMA_VERSION, zlib, zlib-devel, URL for lzma SDK 2012-07-16 15:22:22 -07:00
John Reiser 8a5d352733 Portability: fix "EOFException: premature end of file" doing ELF on Windows.
OutputFile::read() was bad news; fsync() should work, but was missing.
2012-07-12 14:25:28 -07:00
John Reiser f383629282 compressWithFilters(..., inhibit_compression_check=0) // SourceForge bug 3541020
Not good to check compression ratio on every block when blocksize < file_size,
as when --force_execve of Elf > 0x80000 bytes.
2012-07-12 07:04:56 -07:00
John Reiser a6d717cb04 big endian, too: ARM Linux EABI version 4 and 5 is a mess 2012-07-07 07:45:51 -07:00
Markus F.X.J. Oberhumer 84a5753301 New ACC version. 2012-05-31 16:08:14 +00:00
Markus F.X.J. Oberhumer 5d2d9c7e81 Update .hgignore. Update valgrind macros. 2012-04-26 09:05:35 +02:00
Markus F.X.J. Oberhumer 82801d1411 Fix some typos in documentation and comments. 2012-03-27 02:14:03 +02:00
John Reiser 340c3963d8 MIPS mmap_privanon in .S in case gcc learns how to 'bal'. 2012-03-14 08:24:04 -07:00
John Reiser ef15cf9847 merge 2012-03-13 19:56:30 -07:00
John Reiser 4d613ccfa7 MIPS mmap_privanon() forgot to set syscall number; also gcc __asm__() problems.
[Sourceforge upx-Bugs-3503753]
2012-03-13 19:54:47 -07:00
Markus F.X.J. Oberhumer 43ce34d547 Welcome 2012. 2012-01-01 22:35:11 +01:00
Markus F.X.J. Oberhumer eda074cd80 New ACC version. 2012-01-01 21:18:43 +00:00
Markus F.X.J. Oberhumer a2396d82f6 NEWS: spelling fixes. 2011-12-14 18:06:39 +01:00
Markus F.X.J. Oberhumer a38721db93 Remove meaningless "const" from casts. 2011-12-14 06:05:41 +01:00
Markus F.X.J. Oberhumer a06e811717 Remove extra semicolons. 2011-12-14 06:05:08 +01:00
Markus F.X.J. Oberhumer 86e534ff75 Remove trailing whitespace. Remove hard tabs. 2011-12-14 06:03:08 +01:00
John Reiser 640d5b2dec Option --preserve-build-id for Gnu ELF; contributed by Nicholas Twerdochlib
(SourceForge [ upx-Patches-3413335 ])
2011-12-13 17:26:03 -08:00
John Reiser 57e9b27085 merge 2011-12-13 10:54:55 -08:00
John Reiser c56eefc739 Document /proc/self/exe problems on arm*-linux-elf. 2011-12-13 10:53:26 -08:00
Markus F.X.J. Oberhumer cf28306997 Post-release version bump. 2011-12-13 01:30:00 +01:00
Markus F.X.J. Oberhumer 10acf3ddd1 Add tag for RELEASE_308. 2011-12-12 16:08:00 +00:00
Markus F.X.J. Oberhumer fed3ed9f9a Prepare release. 2011-12-12 11:55:45 +01:00
Markus F.X.J. Oberhumer 260138ba11 Silence some compilation warnings. 2011-12-12 11:30:02 +01:00
John Reiser 67f7e0089c NEWS summary in preparation for release 2011-12-06 08:22:44 -08:00
John Reiser d4a22c7851 Sync stub for amd64-darwin.macho-entry. 2011-12-06 07:03:53 -08:00
John Reiser 06cf986490 overlap unfolded stub on Mach-O amd64 [SourceForge upx-Bugs-3447184] 2011-12-02 22:01:13 -08:00
John Reiser adf9aa04ce overlap unfolded stub on Mach-O i386 [SourceForge upx-Bugs-3447184] 2011-12-02 20:51:13 -08:00
John Reiser 69f66fbe52 rebuild using broader dependencies of previous commit 2011-11-23 13:25:25 -08:00
John Reiser d061005c89 propagate dependency on i386-linux.elf-main.c by hand 2011-11-23 13:23:11 -08:00
John Reiser f6ee8b9f04 MSVC++ disallows zero-length array in struct 2011-11-23 13:05:00 -08:00
John Reiser 31af22c2ff ARM_is_QNX looks for PT_INTERP containing "ldqnx" 2011-10-16 15:04:18 -07:00
John Reiser c421e3f243 ARM stub: fix editing mistake 2011-10-16 13:40:21 -07:00
John Reiser 6e92902407 ARM_is_QNX() heuristic 2011-10-16 13:11:03 -07:00
John Reiser 6256381dc3 mmap_privanon() in stub for arm,i386,mips eases QNX 2011-10-16 11:39:46 -07:00
John Reiser b247b051ea QNX on armel (experimental) 2011-10-15 19:49:37 -07:00
Markus F.X.J. Oberhumer afbd553622 Silence some compilation warnings. 2011-08-30 03:40:53 +02:00
John Reiser 36bc14e884 fix PackMachFat::unpack for test mode ("-t"): fo==NULL 2011-07-11 14:37:40 -07:00
John Reiser 9c5d0ff2ff PeFile::processRelocs() defends itself against corrupt PE header 2011-06-08 10:06:42 -07:00
John Reiser cfa6c8ddf6 Fix ::pack3 for shared library. 2011-06-06 20:00:43 -07:00
John Reiser 21924bf022 move stub escape hatch for shared library to end of .text [glibc-2.13.90] 2011-06-02 07:18:50 -07:00
John Reiser eea33f6019 Document copy ONLY for old_dtinit, .e_shoff in compressed shared library. 2011-05-31 11:01:40 -07:00
John Reiser 66d48ae808 MH_BUNDLE enum 2011-05-30 07:22:31 -07:00
John Reiser de9b9fd0b1 more messages in PackLinuxElf32::canPack 2011-05-30 07:21:51 -07:00
John Reiser ece7384be4 fpad4 from st_size(), not from getBytesWritten() 2011-05-28 12:18:27 -07:00
John Reiser 0c052e4506 amd64 output PT_LOAD[0] ends after loader 2011-05-20 10:29:04 -07:00
John Reiser 1996a0a3d6 32-bit shared libraries on i386 only (SourceForge bug 3286178) 2011-04-14 09:39:55 -07:00
László Molnár 679ad9b8c6 fixed computing of tls data end (sf.net bug 3256788) 2011-03-29 15:49:20 +02:00
John Reiser d4983731e7 More l_info.l_lszie and .l_checksum TargetEndian. 2011-03-28 11:11:05 -07:00
John Reiser 4fec3c8f34 Merge. 2011-03-28 10:45:47 -07:00
John Reiser 836fd2565f Place loader immediately after compressed PT_LOADs, in "middle" of file.
This moves compressed gaps and debuginfo out of compressed PT_LOADs,
and fixes a bug where large debuginfo would cause first mmap
at runtime to erase the loader (SourceForge bug 3239079).
2011-03-28 10:44:23 -07:00
John Reiser 54618064a1 l_info.l_lsize and .l_checksum are TargetEndian 2011-03-28 10:14:06 -07:00
John Reiser 519e3e01ae OutputFile implements read() and readx(); beware --stdout. 2011-03-28 10:12:36 -07:00
László Molnár aec8f81358 fixed a warning (sf.net bug 3241423) 2011-03-25 12:02:22 +01:00
John Reiser c1d6bf4366 avoid .so with DT_TEXTREL; SourceForge bug 3190915 2011-02-24 09:38:17 -08:00
Markus F.X.J. Oberhumer 9bf2b79d9e Enter 2011. 2011-01-03 08:49:23 +01:00
Markus F.X.J. Oberhumer 4d98408995 Remove trailing whitespace. 2010-12-29 15:46:55 +01:00
Markus F.X.J. Oberhumer 7b466388f9 Detabify. 2010-12-29 15:46:34 +01:00
Markus F.X.J. Oberhumer b926fb3c66 Fix __cdecl syntax error. 2010-12-24 10:38:30 +01:00
László Molnár 6c8d5c0d0e replaced abort() with internal_error() (sf.net bug 3101319) 2010-12-21 10:28:36 +01:00
László Molnár 5a1d234260 merge 2010-12-21 09:40:16 +01:00
John Reiser fd6d42c297 i386-linux.shlib-init needs empty LEXECDYN (sourceforge 3101319) 2010-12-20 10:20:10 -08:00
László Molnár 7310ad6e92 align TLS callbacks to 4 byte boundary 2010-12-20 14:57:24 +01:00
László Molnár 7e47b1348d fixed a typo 2010-12-20 10:51:29 +01:00
László Molnár 1e3555a6b7 added some input validity checks (for sf.net bug 3122661) 2010-12-20 00:35:57 +01:00
László Molnár 9a67ce5968 do not skip dlls with no imports from the preprocessed import data (sf.net bug 3125753) 2010-12-19 23:22:58 +01:00
Markus F.X.J. Oberhumer 279d7955f8 Keep entries sorted in Makefiles. 2010-12-03 01:04:16 +01:00
Markus F.X.J. Oberhumer db977c0bf5 Add a .dump file to repo. 2010-11-29 15:28:35 +01:00
Markus F.X.J. Oberhumer ba6bc59818 Update .hgignore. 2010-11-29 15:28:10 +01:00
John Reiser 6e8be0578c improve PIC_STRING 2010-11-18 08:23:08 -08:00
John Reiser 92f7d16b5e more flexible labels on trace output 2010-11-18 08:22:36 -08:00
John Reiser 40bb3c2f5e better PIC_STRING for __mips__ 2010-11-17 20:45:39 -08:00
John Reiser 56a6096221 better PIC_STRING for __mips__ 2010-11-17 20:42:01 -08:00
John Reiser ee37b42a91 DEBUG for MIPS i386-linux.elf-main.c 2010-11-17 20:21:41 -08:00
John Reiser 0806e61df4 move DEBUG_STRCON adjacent to uses 2010-11-17 15:17:03 -08:00
John Reiser 279ffeeefa unify DEBUG STR_* into i386-linux.elf-main.c from *.elf-fold.S 2010-11-17 14:32:24 -08:00
John Reiser 80c5ee2479 use up4() 2010-11-17 14:28:00 -08:00
John Reiser 16208544e5 ELFOSABI_NETBSD 2010-11-17 14:27:00 -08:00
John Reiser 6afeb24fdb use brand_netbsd 2010-11-17 12:49:29 -08:00
John Reiser e6357b81eb NetBSD version 5 requires PT_NOTE for PaX. Also adjust other *BSD and PT_NOTE.
[Tested OK on FreeBSD 8.1, NetBSD 5.1, OpenBSD 4.8.  Cleanup needed.]
2010-11-16 21:13:42 -08:00
John Reiser dfc2efe8a6 make_hatch_arm() needs sys_munmap; also fix ARM div10. 2010-11-15 11:51:46 -08:00
John Reiser f28b96f431 Stand-alone tracing for ARM stub; "#define DEBUG 1" then re-compile.
https://sourceforge.net/tracker/?func=detail&atid=102331&aid=3105926&group_id=2331
2010-11-13 21:30:34 -08:00
John Reiser a10293f8f7 ARM copy .e_flags from input to output to preserve soft_FP flag, etc. 2010-11-09 11:05:55 -08:00
John Reiser b1f02f91d7 NetBSD 5.0 wants PT_NOTE and branded executables 2010-11-09 10:47:53 -08:00
Markus F.X.J. Oberhumer e76fa45d86 Small upx_sanity_check() update. 2010-11-08 23:59:34 +01:00
Markus F.X.J. Oberhumer 06f43892a5 Set sane abort() default behaviour when using msvcrt. 2010-11-08 20:48:50 +01:00
Markus F.X.J. Oberhumer a094332b0d Silence some compilation warnings. 2010-10-23 11:40:41 +02:00
Markus F.X.J. Oberhumer 7b8779f534 Portability updates. 2010-10-20 01:46:38 +02:00
Markus F.X.J. Oberhumer 371bf20d19 New ACC version. 2010-10-17 10:10:23 +02:00
Markus F.X.J. Oberhumer 0f633ddd15 Bump version for next release. 2010-09-08 18:04:39 +02:00
Markus F.X.J. Oberhumer 7886ca7f5f Add tag for RELEASE_307. 2010-09-08 15:07:00 +00:00
Markus F.X.J. Oberhumer 9b4c11954d Prepare release. 2010-09-08 16:56:49 +02:00
László Molnár a1b724f30a NEWS updated 2010-09-08 16:02:04 +02:00
László Molnár 7c3b2fb9cc relocation entry for TLS callbacks is only needed when we do have TLS callbacks 2010-09-08 15:06:56 +02:00
Markus F.X.J. Oberhumer acef68d67e Bump version for next release. 2010-09-04 20:23:02 +02:00
Markus F.X.J. Oberhumer 7e393d5f1e Add tag for RELEASE_306. 2010-09-04 15:06:00 +00:00
Markus F.X.J. Oberhumer 955c31b165 Prepare release. 2010-09-04 13:11:59 +02:00
László Molnár e307cd48ad merge 2010-09-02 12:30:16 +02:00
László Molnár 25f8b9e451 added Stefan to THANKS 2010-09-02 12:27:50 +02:00
Markus F.X.J. Oberhumer e8ba14a2c1 Silence some compilation warnings. 2010-09-01 14:49:26 +02:00
Markus F.X.J. Oberhumer 9670d3341c Makefiles: sort result from wildcard, needed for unwise GNU make 3.82 change. 2010-09-01 14:10:14 +02:00
László Molnár cec9778fd5 added a NEWS entry for the win32 TLS callback stuff 2010-08-31 14:35:59 +02:00
John Reiser 7451db4a68 merge 2010-08-17 11:32:02 -07:00
John Reiser e31777ec53 ARM ELF EABI version 5
https://sourceforge.net/tracker/?func=detail&atid=102331&aid=3040129&group_id=2331
2010-08-17 11:30:17 -07:00
László Molnár 7aa0b3dc7a merge 2010-08-16 13:49:54 +02:00
László Molnár e7b2d5dc01 coding style updates - only whitespace changes 2010-08-16 13:36:10 +02:00
László Molnár 47d728667d merge 2010-08-16 13:20:28 +02:00
László Molnár e1f8989d54 removed dosish file endings 2010-08-16 13:09:27 +02:00
Stefan Widmann 1d8cb47830 TLS handling updated to v2, ASLR fix in unpacking 2010-08-13 17:44:21 +02:00
Markus F.X.J. Oberhumer faaa7c37a9 Remove duplicate file. 2010-08-08 16:32:59 +02:00
Markus F.X.J. Oberhumer 0aff9d8df4 Use consistent syntax for boolean preprocessor expressions. 2010-08-08 16:20:16 +02:00
Markus F.X.J. Oberhumer 30c3f8c1ac New ACC version. 2010-08-08 16:10:30 +02:00
John Reiser bcd2469e01 merge 2010-08-06 13:31:54 -07:00
John Reiser 983c6ae73d amd64 stub: relocate ADRX and ADRU after copy 2010-08-06 13:29:32 -07:00
Markus F.X.J. Oberhumer 6d8e1fe776 Start using acc_getopt. 2010-08-05 15:08:06 +02:00
Markus F.X.J. Oberhumer 99b4921309 New ACC version. 2010-08-05 15:06:03 +02:00
John Reiser 3c231c3c9e FreeBSD 8.x got picky about MAP_ANONYMOUS 2010-07-21 10:19:11 -07:00
John Reiser 175c0a6236 --unmap-all-pages affects i386-*BSD, too 2010-07-20 12:47:33 -07:00
John Reiser 0031ceb06c propagate changes from auxv_find() in i386-linux.elf-main.c 2010-07-17 08:22:09 -07:00
John Reiser e3cc5a63df don't erase AT_SYSINFO* if no conflict with decompressed folded stub 2010-07-17 08:19:50 -07:00
John Reiser 3cb61402c2 merge 2010-07-16 21:01:45 -07:00
John Reiser 5336c51199 Fix conflict between VDSO and unfolded decompressor for ET_DYN
(-fPIE) with unlimited stack on Linux-2.6.34 et al.
2010-07-16 20:58:52 -07:00
Markus F.X.J. Oberhumer 52aa658aaa Silence some compilation warnings. 2010-07-14 20:03:09 +02:00
John Reiser d08a51d7e4 fix don't-care uninit from valgrind(memcheck) 2010-07-07 09:52:58 -07:00
John Reiser d97a557ac3 unpacking PackMachFat::CPU_TYPE_X86_64 2010-06-28 16:02:57 -07:00
John Reiser 8a68d9cded more MACH_SEGMENT_ENUM; no code yet 2010-06-15 09:22:59 -07:00
László Molnár b031f7e902 always initialize variable use_tls_callbacks 2010-06-15 15:04:48 +02:00
Markus F.X.J. Oberhumer 963ffecb96 Update upx-tools link in README.SRC. 2010-06-09 15:15:37 +02:00
Markus F.X.J. Oberhumer 8f8aaca818 Remove trailing whitespace. 2010-06-06 22:40:10 +02:00
László Molnár 801f92b7e7 merge 2010-06-04 17:56:52 +02:00
László Molnár 44db45700e new version of .dump file 2010-06-04 17:55:13 +02:00
Stefan Widmann 25902005f6 win32/pe TLS handling added 2010-06-01 19:21:52 +02:00
John Reiser ffec71e0d8 Fix vmlinux/ppc32 at compress time. Runtime needs work. 2010-04-28 20:43:50 -07:00
John Reiser 99a208110b Detect LC_SEGMENT beyond end-of-file in PackMachBase<T>::find_SEGMENT_gap. 2010-04-28 20:05:23 -07:00
Markus F.X.J. Oberhumer e56799c993 Bump version for next release. 2010-04-27 17:26:05 +02:00
Markus F.X.J. Oberhumer 957eb300f8 Add tag for RELEASE_305. 2010-04-27 15:05:00 +00:00
Markus F.X.J. Oberhumer 626025d539 Prepare release. 2010-04-27 16:09:41 +02:00
Markus F.X.J. Oberhumer 9e8a0a020f Remove outdated ChangeLog target. 2010-04-26 18:29:28 +02:00
Markus F.X.J. Oberhumer 40f592eade Add one .dump file. 2010-04-26 18:27:54 +02:00
Markus F.X.J. Oberhumer 5e899f0be4 Silence some annoying compiler warnings. 2010-04-19 03:15:22 +02:00
Markus F.X.J. Oberhumer f2748284b1 New ACC version. 2010-04-19 03:15:01 +02:00
Markus F.X.J. Oberhumer a15ce00934 Fix some small memory leaks. Minor cleanup. 2010-04-10 13:57:25 +02:00
John Reiser 9e3e80261b merge 2010-03-31 14:15:18 -07:00
John Reiser c72c685434 Diagnose PT_LOAD beyond end-of-file.
https://sourceforge.net/tracker/?func=detail&atid=102331&aid=2979240&group_id=2331
2010-03-31 14:09:28 -07:00
Markus F.X.J. Oberhumer 0177a8d277 Use upx_snprintf instead of snprintf. 2010-03-31 02:23:06 +02:00
Markus F.X.J. Oberhumer b6a9b0a4c9 Silence some compilation warnings. 2010-03-31 02:16:32 +02:00
John Reiser f4f8bd8d42 Fix for "upx --help" constructs with (0===f) 2010-03-17 18:33:30 -07:00
John Reiser 6e4aeffc0c Withdraw support for shared libraries (.dylib) on Darwin (Apple Mac OS X). 2010-03-12 10:20:18 -08:00
John Reiser dba256d384 Fix amd64-darwin.dylib-entry.S so it compiles. 2010-03-11 14:37:17 -08:00
John Reiser 910008e9e7 Hack on amd64-darwin.dylib-entry.S 2010-03-10 18:58:38 -08:00
John Reiser 8cb9545c41 Hack on amd64-darwin.dylib-entry.S 2010-03-10 15:19:18 -08:00
John Reiser 59c16da6fb PackMachBase::pack4dylib avoid sliding if offset or reloff is 0. 2010-03-10 13:14:52 -08:00
John Reiser 630df5bbd2 Fix structs from Apple mach-o/loader.h for 64-bit. (Apple goofed.) 2010-03-10 10:29:41 -08:00
John Reiser f550111400 PackDylibAMD64 (Mac OS X shared library on x86_64) 2010-03-09 19:02:25 -08:00
John Reiser 77377195aa Allow CPU_TYPE_X86_64 for MH_EXECUTE in fat (universal) binaries,
but no MH_DYLIB yet.  infoWarning() for unsupported cputype.
2010-03-09 13:35:06 -08:00
John Reiser 7e2e72bd40 infoWarning for shlib with no DT_INIT 2010-03-09 13:03:03 -08:00
John Reiser aa7a13bd02 Linux kernels must be ET_EXEC 2010-03-09 09:22:57 -08:00
John Reiser 5895058a17 Linux kernels must be ET_EXEC 2010-03-09 09:20:46 -08:00
John Reiser ffb60d5149 memmove instead of overlapping memcpy 2010-03-08 22:01:25 -08:00
John Reiser 1e2cb279b0 Fix memory leak in --lzma compression. 2010-03-08 22:00:35 -08:00
John Reiser e7f766f5ba i386-linux.shlib: stub commonality with non-shlib 2010-03-08 17:33:56 -08:00
John Reiser 8de5aa9409 Fix ET_DYN main program on amd64-linux.elf. 2010-03-08 16:59:53 -08:00
John Reiser bf28a4df49 MIPS stub NRV_HEAD always saves $ra on stack.
bits.ash has the only __MIPSEL__/__MIPSEB__ dependency: lwl/lwr swl/swr.
2010-03-08 10:49:11 -08:00
Markus F.X.J. Oberhumer fe1a0ab371 Bump tentative release date. 2010-03-06 16:50:17 +01:00
Markus F.X.J. Oberhumer 01daccfaf7 Avoid compiler warnings. 2010-03-06 16:35:18 +01:00
Markus F.X.J. Oberhumer 94e861e298 Rebuild stubs. 2010-03-06 16:34:05 +01:00
Jens Medoch d36af2ed5c Import 3-upx-hg_mips-r3k_base.patch. 2010-03-06 16:27:38 +01:00
Jens Medoch 7104b33214 Import 2-upx-hg_mips-r3k_makefile.patch. 2010-03-06 16:26:32 +01:00
Jens Medoch 32998e5377 Import 1-upx-hg_mips-stub_clean-up.patch. 2010-03-06 16:25:58 +01:00
Jens Medoch af0c9ef092 Import 0-upx-hg_mips-r3k_ucl.patch. 2010-03-06 16:25:29 +01:00
Markus F.X.J. Oberhumer 3bc3b3d10e Detabify. Remove trailing whitespace. 2010-03-01 01:28:03 +01:00
John Reiser f03f42ca4d Linux preserve /proc/self/exe; --unmap-all-pages option 2010-02-28 15:58:08 -08:00
John Reiser 79783abeb1 merge 2010-02-20 20:48:42 -08:00
John Reiser 895b0bd602 merge 2010-02-20 20:46:20 -08:00
John Reiser 2ee5ee92f8 merge 2010-02-20 20:44:54 -08:00
John Reiser 3e619423b1 merge 2010-02-20 20:40:32 -08:00
John Reiser b524e18bdf merge 2010-02-20 20:40:20 -08:00
John Reiser 6aa4579db8 merge 2010-02-20 20:40:04 -08:00
John Reiser 17fb86c0f1 merge 2010-02-20 20:39:52 -08:00
John Reiser 62ecfe4873 merge 2010-02-20 20:39:39 -08:00
John Reiser 04e55e6b9a merge 2010-02-20 20:39:19 -08:00
John Reiser f432aa1090 merge 2010-02-20 20:39:04 -08:00
John Reiser 7add104313 merge 2010-02-20 20:38:20 -08:00
John Reiser 36de249066 merge 2010-02-20 20:36:34 -08:00
John Reiser b7a54dcffd merge 2010-02-20 20:26:08 -08:00
John Reiser 6bb28deab2 merge 2010-02-20 20:24:55 -08:00
John Reiser 7f88d15c86 ELF ::unpack decompressing ElfXX_Ehdr changes .e_phnum 2010-02-20 19:57:34 -08:00
John Reiser 94c5014e23 merge 2010-02-15 11:09:28 -08:00
John Reiser c5a8256500 mention Elf32_auxv[AT_EXECFN] 2010-02-15 11:07:46 -08:00
Markus F.X.J. Oberhumer 5f39884bf7 Silence a compiler warning. 2010-02-07 00:10:49 +01:00
Markus F.X.J. Oberhumer d96825a242 Fix a typo. 2010-02-07 00:10:38 +01:00
Markus F.X.J. Oberhumer 443a938091 New ACC version. 2010-02-06 17:18:46 +01:00
Markus F.X.J. Oberhumer 6bc3197721 Enter 2010. 2010-02-06 17:15:49 +01:00
John Reiser 269cc91fd5 Support share libraries on i386 and amd64 under linux. 2010-01-17 19:58:58 -08:00
Markus F.X.J. Oberhumer c1ddea479d Minor portability fixes. 2009-12-03 19:58:23 +01:00
John Reiser 5f3a95962c PackLinuxElf32::unpack fix ARM (thumb) 2009-10-26 13:35:14 -07:00
John Reiser ee1a8e6a32 eabi-linux.shlib unfilter in thumb mode 2009-10-26 10:37:11 -07:00
John Reiser eeae73296e thumb-eabi-linux.shlib, and use it (for smaller size) instead of ARM.
[Consider compress-time option to choose ARM vs thumb?]
2009-10-26 09:05:12 -07:00
John Reiser 4ca8357af4 Merge 2009-10-26 08:11:37 -07:00
John Reiser 8a5b8c87fb arm.shlib-init: escape hatch is 8 bytes; speedup movsl 2009-10-25 20:40:26 -07:00
John Reiser 6ab04d7bbc ::buildLinuxLoader empty FOLDEXED for shlib 2009-10-25 13:52:41 -07:00
Markus F.X.J. Oberhumer a5a1380636 Add missing .dump files to repo. 2009-10-24 13:55:36 +02:00
John Reiser eeab1aef64 Synonyms R_ARM_THM_PC22 and R_ARM_THM_XPC22 for R_ARM_THM_CALL. 2009-10-22 21:05:05 -07:00
John Reiser 4e1c342e55 arm-linux.shlib escape hatch: munmap temporary pages 2009-10-21 09:32:42 -07:00
John Reiser d8ed259bce arm-linux.shlib allow thumb interworking for DT_INIT 2009-10-21 08:13:09 -07:00
John Reiser 9f6cb5de4c armel-eabi-linux.shlib: improve integration with system calls. 2009-10-20 09:53:45 -07:00
John Reiser ba634118d7 Shorten runtime copying for armel-eabi-linux.shlib. 2009-10-19 22:28:44 -07:00
John Reiser 63da091d36 Compress shared library for armel-eabi-linux. 2009-10-19 20:48:46 -07:00
John Reiser ad0dc88a33 Cleanup some FIXME. amd64-linux.shlib forces 4KiB page size to save space. 2009-10-18 16:03:26 -07:00
John Reiser 147acf4b57 Compress shared library for amd64-linux. 2009-10-17 21:55:03 -07:00
John Reiser 5085f3a15e Allow ET_DYN on amd64-linux.elf 2009-10-16 17:47:16 -07:00
John Reiser 22a95ad8ea fix comment 2009-10-16 17:46:41 -07:00
John Reiser df4bd6a60c move PackLinuxElf32x86::unpack up the class hierarchy to PackLinuxElf32 2009-10-16 11:00:33 -07:00
John Reiser 813e7b05e4 fix .ui_total_passes when shlib 2009-10-16 10:56:15 -07:00
John Reiser ab8b486b4a Fix -Wshadow complaints. 2009-10-16 10:01:29 -07:00
Markus F.X.J. Oberhumer 590f666ec9 Enable -Wshadow compiler option. 2009-10-16 18:06:16 +02:00
Markus F.X.J. Oberhumer 9adaee915b Detabify. 2009-10-16 16:29:09 +02:00
Markus F.X.J. Oberhumer bce0f06fe9 Rebuild stubs so that they actually match the source code! 2009-10-16 16:27:52 +02:00
John Reiser 856ecb84a0 Compress shared library for i386-linux. DT_INIT must exist. Everything
needed by ld-linux for runtime relocation must be at the beginning of the
first PT_LOAD, etc.
2009-10-15 20:35:07 -07:00
John Reiser 90ddc06c98 DT_INIT, DT_CHECKSUM, DT_VERSYM, DT_VERDEF, DT_VERNEEDED 2009-10-14 17:50:35 -07:00
John Reiser 405abc4e95 ::packExtent updates ph.u_adler to satisfy verifyOverlappingDecompression()
even when 0==hdr_u_len
2009-10-14 17:47:02 -07:00
John Reiser 549c59ecf5 fix OutputFile::seek() for SEEK_SET and SEEK_END 2009-10-14 17:44:29 -07:00
John Reiser 0a485eafcb Better detection of Position Independent main Executables (gcc -pie -FPIC). 2009-10-10 14:50:30 -07:00
John Reiser e0c11956a6 ElfXX_Rel, ElfXX_Rela 2009-10-10 14:41:01 -07:00
John Reiser da6a9bf3eb Move conditional side effect (reset .all_methods_use_lzma)
out of ::PackExe constructor, so that Visitor pattern avoids it.
2009-10-09 16:09:53 -07:00
John Reiser dacd11e1cc Fix sourceforge bug #2874848: Mach/fat needs seek() after set_extent(). 2009-10-08 12:53:02 -07:00
Markus F.X.J. Oberhumer fc854b4c77 Bump version for next release. 2009-09-27 20:08:49 +02:00
Markus F.X.J. Oberhumer 4dcc1f0374 Add tag for RELEASE_304. 2009-09-27 20:07:28 +02:00
Markus F.X.J. Oberhumer fc57390242 Bump release date. 2009-09-27 20:06:01 +02:00
Markus F.X.J. Oberhumer bd15ef0a0c Bump tentative 3.04 release date. 2009-09-21 05:44:19 +02:00
Markus F.X.J. Oberhumer 967ecafc33 Small compatibility updates. 2009-09-21 05:41:49 +02:00
John Reiser 29576da985 catch up to bugfix for arm-darwin stub 2009-09-01 07:33:08 -07:00
John Reiser 200a2556ef New format Mach/AMD64 for 64-bit x86 programs on Apple Macintosh 2009-09-01 07:30:37 -07:00
John Reiser ae0ab5025e fix debug mixup 2009-09-01 07:21:18 -07:00
John Reiser aa74276b25 gcc-4.4.1 is more strict about 'const' 2009-08-30 19:44:45 -07:00
Markus F.X.J. Oberhumer b03112a5dd Silence some compilation warnings. 2009-06-09 13:11:21 +02:00
Markus F.X.J. Oberhumer a3f49df62d Remove trailing whitespace. 2009-06-09 09:43:00 +02:00
Markus F.X.J. Oberhumer aa2af3f6dd Add missing stub to repo. 2009-06-09 09:40:25 +02:00
John Reiser 20dcbc593c PackMachFat for MH_DYLIB, too. 2009-06-01 16:23:13 -07:00
John Reiser 472ba8c1fd UPX_F_DYLIB_PPC32 is big endian, so move to >=128 2009-06-01 12:38:20 -07:00
John Reiser d8345a44a4 Dylib/ppc32 format works. 2009-05-31 12:57:10 -07:00
John Reiser a187cb6c9c work on stub for powerpc-darwin.dylib-entry.S 2009-05-29 22:08:08 -07:00
John Reiser b89c0b35d1 bugfix: PackMachBase::pack2 first extent is Mach_header plus Mach_segment_commands 2009-05-29 13:38:43 -07:00
John Reiser 7ffcc0a5e7 powerpc-darwin.dylib 2009-05-27 10:19:50 -07:00
John Reiser bde43fbdfb PackMachBase<T>::pack4dylib to prepare for more architectures 2009-05-23 21:13:44 -07:00
John Reiser 3728b2208f Cleanup declaration of PackDylibI386. 2009-05-22 08:37:44 -07:00
John Reiser dc52a756ee i386-darwin.dylib-entry.bin.dump 2009-05-21 22:06:26 -07:00
John Reiser 98dc886841 i386-darwin kernel expects 64-bit off_t; we always use 0 for top 32 bits. 2009-05-21 21:50:17 -07:00
John Reiser d0cf104e43 Announce Dylib/i386 format in NEWS. 2009-05-20 08:11:04 -07:00
John Reiser d7ed2412f6 386-darwin.dylib decompressor chains to user .init_address 2009-05-20 07:10:14 -07:00
John Reiser 7d38f0e234 i386-darwin.dylib ::unpack 2009-05-19 15:57:18 -07:00
John Reiser 3e8d072d24 i386-darwin.dylib requires existing LC_ROUINTES command;
decompressor must not overwrite Mach_headers.
2009-05-19 09:43:05 -07:00
John Reiser 84ac771893 Decompression part for Mach dylib i386. 2009-05-18 11:59:11 -07:00
John Reiser 3a9e0b5be6 Compression part for Mach dylib i386. 2009-05-13 10:40:21 -07:00
Markus F.X.J. Oberhumer 9694ff433f Fix grammar in version date. 2009-04-19 20:14:24 +02:00
Markus F.X.J. Oberhumer 2e82e78b98 Bump tentative release date. 2009-04-19 18:46:31 +02:00
Markus F.X.J. Oberhumer aaef4bee27 Prefer memcpy() over struct-copy. 2009-04-19 18:44:17 +02:00
Markus F.X.J. Oberhumer 4ca8569488 Remove trailing whitespace. 2009-04-19 18:36:42 +02:00
John Reiser 8377ada3e0 catch up stubs for arm 2009-03-01 11:19:05 -08:00
John Reiser 8a034d59ed arm linux kernel --small: hand assembly for LzmaDecode 2009-02-26 13:07:11 -08:00
John Reiser 8e492d8798 arm linux kernel: decompress_kernel() returns length, not pointer 2009-02-25 13:50:55 -08:00
John Reiser 7974ef80d7 branch merge 2009-02-12 12:42:57 -08:00
John Reiser 3664d86430 i386-linux.elf-fold fix compressed size for ET_DYN 2009-02-12 12:41:10 -08:00
Markus F.X.J. Oberhumer 9adef80d6b Replace all __attribute_packed by new __packed_struct macros. 2009-02-12 05:20:23 +01:00
Markus F.X.J. Oberhumer be57adaee7 Update tools/armpe_tester. 2009-02-12 03:33:14 +01:00
Markus F.X.J. Oberhumer d117e442a4 Silence a compiler warning. 2009-01-27 19:05:18 +01:00
Markus F.X.J. Oberhumer 8820bc0796 Add support for LZMA SDK 4.62. Compiles, but pretty much untested. 2009-01-03 23:33:25 +01:00
Markus F.X.J. Oberhumer 57a64de023 Small conf.h update. 2009-01-01 13:40:52 +01:00
Markus F.X.J. Oberhumer 5ed689ceb0 Enter 2009. 2008-12-31 17:07:18 +01:00
Markus F.X.J. Oberhumer 25f1765f36 Support building with OpenWatcom 1.8. Silence some compiler warnings. 2008-12-31 16:56:38 +01:00
Markus F.X.J. Oberhumer 063bd58802 Silence gcc's -Wstrict-aliasing=1 warnings. 2008-12-29 23:15:56 +01:00
Markus F.X.J. Oberhumer 901c6b34fa New ACC version. 2008-12-29 23:14:54 +01:00
Markus F.X.J. Oberhumer 5b2d6488a2 Silence some compilation warnings. 2008-12-29 22:22:28 +01:00
László Molnár f6f35415d1 check processor type in PackW32Pe::canUnpack 2008-12-20 14:48:13 +01:00
Markus F.X.J. Oberhumer 6c6069e963 New ACC version. 2008-12-16 23:59:37 +01:00
Markus F.X.J. Oberhumer 6219d82560 Detabified some sources. 2008-11-16 19:03:40 +01:00
John Reiser 1dcd7a16ab add missing source file 2008-11-16 08:01:40 -08:00
John Reiser b60caeb9dd source files for arm-darwin.macho-*.S 2008-11-16 07:35:53 -08:00
John Reiser 4c4768aaf3 derived .h fles for arm-darwin.macho 2008-11-15 14:46:03 -08:00
John Reiser 2f4ac0a663 format UPX_F_MACH_ARMEL, class PackMachARMEL: iPhone 2008-11-15 14:44:19 -08:00
John Reiser 23a446f852 unshare armel-linux.elf-main.o vs. arm-linux.elf-main.o (for comiler flags) 2008-11-15 14:09:06 -08:00
John Reiser ec48334a1a propagate changes into stub/amd64-linux.elf-fold.h 2008-11-15 08:52:02 -08:00
John Reiser f4c061d412 amd64-linux.elf: workaround for SIGSEGV on Centos 5.2
https://sourceforge.net/tracker/?func=detail&atid=102331&aid=2136491&group_id=2331
2008-11-15 08:49:13 -08:00
John Reiser 31a076d7b3 PackVmlinuzARMEL: only 8-bit control words for compression 2008-11-15 08:44:50 -08:00
John Reiser 6bd43d986c sync stub for armel-linux.kernel.vmlinuz.h 2008-09-15 13:51:55 -07:00
John Reiser dd32a2f15a forgot source for armel-linux.kernel.vmlinuz stubs 2008-09-15 10:35:53 -07:00
John Reiser c88c20820f new format vmlinuz/armel for Debian NSLU2 (etc.) linux kernel 2008-09-15 10:18:19 -07:00
John Reiser 86de510731 bvmlinuz boot protocol 2.08 (not yet complete?) 2008-08-04 17:30:44 -07:00
John Reiser 0b31fbf827 armel-eabi sets Elf32_Ehdr::EI_ABIVERSION = 4 2008-08-04 17:29:59 -07:00
John Reiser 34ad1450eb boot protocol 2.08 for bvmlinuz; Extended ABI version 4 for armel-eabi 2008-08-04 17:28:23 -07:00
John Reiser e6ba71390d armel-eabi choose proper decompressor 2008-07-20 15:35:19 -07:00
John Reiser f0c8dbe0ec armel-eabi-linux.elf (Debian) new protocol for system calls 2008-07-20 05:41:51 -07:00
John Reiser bf046a8ccb more checking when treating ELF as .bin 2008-07-20 05:40:00 -07:00
John Reiser b05ba7683e bvmlinuz/386 boot protocol 2.08 has gzipped ELF [needs more work] 2008-07-18 15:02:28 -07:00
John Reiser aedf8dad15 amd64 argc can be zero 2008-07-16 14:56:44 -07:00
John Reiser 74ebb7c722 more get_te32(&...) needed for endian neutrality 2008-07-16 13:49:28 -07:00
John Reiser 1307f66494 stub/i386-*.*-fold.S: allow 0==argc 2008-05-15 09:05:20 -07:00
John Reiser 448a24cb36 PackVmlinuzI386::getStrategy(), and Bvmlinuz guesses 60% .text;
stack for Bvmlinuz uses vacant Vmlinuz low memory (512 KiB)
2008-05-02 04:59:39 -07:00
Markus F.X.J. Oberhumer 7266f23450 New ACC version. 2008-04-30 02:45:13 +02:00
Markus F.X.J. Oberhumer c0ad31acfc Bump version for next release. 2008-04-27 18:46:52 +02:00
Markus F.X.J. Oberhumer 25d3a0de27 Added tag for RELEASE_303. 2008-04-27 11:38:15 +02:00
John Reiser 1e38bbfbc1 merge 2008-04-26 13:08:13 -07:00
John Reiser 1c62e95812 Bvmlinuz fix filters 2008-04-26 13:04:13 -07:00
Markus F.X.J. Oberhumer d453cc27a3 Style: start using correct IEC binary prefix (KiB, MiB, ...) - see
http://en.wikipedia.org/wiki/Binary_prefix for more details.
2008-04-26 08:48:13 +02:00
Markus F.X.J. Oberhumer 2c3e841d8a Fix comment. 2008-04-26 08:23:05 +02:00
John Reiser 50668c462f Bvmlinuz h.sys_size, and more heuristics 2008-04-25 12:07:38 -07:00
John Reiser 8d1192e832 Bvmlinuz,Vmlinuz make room for largest possible decompression stack
by moving kernel command line up, and real mode area down
2008-04-24 12:15:07 -07:00
John Reiser 4a8e2e9ed4 grub-0.97-33.fc9 does not leave enough room for lzma 2008-04-23 16:37:16 -07:00
Markus F.X.J. Oberhumer 12fc45220a Shorten --help text. 2008-04-17 14:07:03 +02:00
Markus F.X.J. Oberhumer 6bce68fbe7 Bump tentative release date. 2008-04-17 12:16:23 +02:00
Markus F.X.J. Oberhumer d54f947c98 Add Packer::hasLoaderSection() to handle missing CFLUSH sections. 2008-04-07 18:44:00 +02:00
Markus F.X.J. Oberhumer 6c8bb3a22e Rebuild all stubs with new formatting - no binary changes. 2008-04-04 17:21:24 +02:00
Markus F.X.J. Oberhumer ed29ce5183 bin2h.py: improve formatting. 2008-04-04 17:20:17 +02:00
Markus F.X.J. Oberhumer a51d269b7c Use new bin2h.py mode. 2008-04-04 16:37:12 +02:00
Markus F.X.J. Oberhumer 8283e4e6d6 bin2h.py: add support for --mode=gas-be32 and --mode=gas-le32. 2008-04-04 16:35:58 +02:00
John Reiser 23ce91eb55 MIPS big-endian lzma build rules 2008-04-03 09:01:55 -07:00
John Reiser 545ac7fcfa Merge 2008-04-02 19:10:39 -07:00
John Reiser 3926ccccad MIPS-linux.elf flush icache after moving decompressor 2008-04-02 19:09:31 -07:00
Markus F.X.J. Oberhumer f431307ef2 Silence some compilation warnings. 2008-04-02 19:24:05 +02:00
Markus F.X.J. Oberhumer ca368e0f9b Add a note about broken scanf() implementations. 2008-04-02 16:34:31 +02:00
John Reiser 8afeb56c11 Big-endian MIPS NRV nested subroutine must save+restore register ra. 2008-04-01 22:09:14 -07:00
John Reiser 2a6f90c5f3 Big-endian MIPS must fetch NRV 32-bit "control" words as little endian. 2008-04-01 20:06:27 -07:00
John Reiser 271031128e Fix ElfLinkerMipsBE::relocate1. Create CFLUSH section in
mipsel.r3000-linux.elf-entry.S and powerpc-darwin.macho-entry.S .
2008-03-31 08:55:35 -07:00
John Reiser b991f954d0 Fix "Failure with Ubuntu 7.10" SourceForge Bug tracker 1825006
when --force-execve with kernel 2.6.22-14-generic et al.
2008-03-27 15:51:19 -07:00
John Reiser f12bb3f80d bvmlinuz must preserve register esi 2008-03-04 15:41:42 -08:00
Markus F.X.J. Oberhumer 6dc978e8d8 Remove trailing whitespace. 2008-02-28 00:04:32 +01:00
John Reiser 9f05a873bc Merge 2008-02-26 12:17:21 -08:00
John Reiser 703d498772 Implement cache flush for PowerPC. 2008-02-26 12:15:09 -08:00
Markus F.X.J. Oberhumer ed3b9543bb Cosmetic Makefile update. 2008-02-26 02:59:00 +01:00
Markus F.X.J. Oberhumer fc7efba7d8 Silence some compilation warnings. 2008-02-26 02:55:39 +01:00
Markus F.X.J. Oberhumer b3178fe8f4 stub/Makefile: cosmetic updates. 2008-01-30 16:39:45 +01:00
Markus F.X.J. Oberhumer e36798a993 Remove unused stub/amd64-linux.kernel.vmlinuz. 2008-01-30 16:19:46 +01:00
Markus F.X.J. Oberhumer a143605465 Remove trailing whitespace. 2008-01-30 07:22:32 +01:00
Markus F.X.J. Oberhumer d3ad35b21e Rebuild stubs. 2008-01-30 07:20:45 +01:00
Markus F.X.J. Oberhumer 68134941bf Small Makefile update. 2008-01-30 07:20:19 +01:00
John Reiser 54d0fef559 BvmlinuzI386 runtime-relocatable kernels 2008-01-29 10:33:45 -08:00
Markus F.X.J. Oberhumer 7f9c47176a Introduce target endianness accessors get_teXX() and set_teXX() in packer.h to
replace all [gs]et_nativeXX() member functions.
2008-01-09 13:57:47 +01:00
Markus F.X.J. Oberhumer 9060ac7897 Rename template integral types from U32 to TE32 to emphasize on target
endianness.
2008-01-09 12:45:44 +01:00
John Reiser d9073e4a17 PackVmlinuzI386 detects non-relocated kernel 2008-01-08 09:03:21 -08:00
Markus F.X.J. Oberhumer de1c1d7cc2 Update help header message. 2008-01-02 11:40:16 +01:00
Markus F.X.J. Oberhumer 6ff1bd5917 Update my email address. 2008-01-02 10:12:42 +01:00
Markus F.X.J. Oberhumer a6b04f426e Bump version year. 2008-01-02 09:47:52 +01:00
Markus F.X.J. Oberhumer fa49dbe2cb Enter 2008. 2008-01-02 09:42:31 +01:00
Markus F.X.J. Oberhumer 682eb04a52 New ACC version. 2008-01-02 09:34:45 +01:00
Markus F.X.J. Oberhumer 77064fb09e Makefile update. 2008-01-02 09:32:32 +01:00
Markus F.X.J. Oberhumer be8d93563a Introduce first --mp-xxx options. 2007-12-20 06:39:31 +01:00
Markus F.X.J. Oberhumer d4a6a5216d Makefile updates. 2007-12-18 22:37:30 +01:00
Markus F.X.J. Oberhumer 1cb1427050 Detabify. 2007-12-17 06:00:33 +01:00
Markus F.X.J. Oberhumer e4f4eace1c Added support for LZMA SDK 4.57. Compiles, but pretty much untested. 2007-12-17 05:54:08 +01:00
Markus F.X.J. Oberhumer 30a98b7e8c Remove trailing whitespace. 2007-12-17 05:49:34 +01:00
Markus F.X.J. Oberhumer d36c8d95ad Bump version for next release. 2007-12-16 15:10:44 +01:00
Markus F.X.J. Oberhumer 506bd0abcf Add tag for RELEASE_302. 2007-12-16 15:08:32 +01:00
Markus F.X.J. Oberhumer 8dd810c41d Bump release date. 2007-12-16 15:07:05 +01:00
John Reiser d9d0dc5201 get_native(&Elf32_Phdr.p_align) 2007-12-15 10:07:09 -08:00
Markus F.X.J. Oberhumer 72880d9e03 Disable leftover debug printf statements. 2007-12-12 08:36:03 +01:00
Markus F.X.J. Oberhumer 6c7ec6eb1b Update brandelf.py. 2007-12-12 05:25:15 +01:00
Markus F.X.J. Oberhumer 705fc5d116 Rebuild stubs. 2007-11-27 01:12:45 +01:00
Markus F.X.J. Oberhumer d20b575b9b Merge. 2007-11-27 01:12:09 +01:00
John Reiser c949beab9c mipsel.r3000-linux.elf-entry.S syscall clobbers t8 2007-11-26 14:56:23 -08:00
Markus F.X.J. Oberhumer 3fb857c435 Cleanup brandelf.py. 2007-11-26 19:57:00 +01:00
Markus F.X.J. Oberhumer 0a4f999ade Fix missing rebuild from previous commit. 2007-11-25 08:59:52 +01:00
John Reiser f0b7147881 mips*.r3000-linux.elf clear stack to workaround suspected bug in glibc-2.3.2 2007-11-24 15:24:10 -08:00
John Reiser b36a42cd0a PackVmlinuzI386 detects relocatable kernel (cannot handle yet) 2007-11-20 12:01:50 -08:00
Markus F.X.J. Oberhumer 000309b47f stub: remove filename from dumps in order reduce diff noise when renaming files. 2007-11-20 06:34:48 +01:00
Markus F.X.J. Oberhumer 5cb12988f0 Merge. 2007-11-20 06:31:16 +01:00
John Reiser 50c4b749ec PackVmlinuxBase<T>::pack always defineFilterSymbols(), esp. for PackVmlinuxAMD64 2007-11-19 18:39:25 -08:00
Markus F.X.J. Oberhumer 5db2734e6f Small Makefile updates. 2007-11-19 09:48:27 +01:00
Markus F.X.J. Oberhumer e9e5507483 stub: rename "mipseb" to "mips". 2007-11-14 04:54:33 +01:00
Markus F.X.J. Oberhumer d63dc7adfb stub: we can reuse our existing mipsel-* tools for mips (big endian). 2007-11-14 04:40:40 +01:00
John Reiser 27db44a8db generated headers for mipseb.r3000-linux.elf 2007-11-13 17:54:05 -08:00
John Reiser 1a035e2866 PackLinuxElf32::canPack must use explicit get_native32 2007-11-13 11:11:31 -08:00
John Reiser 887aa20116 ElfLinkerMipsBE is big endian 2007-11-13 11:09:15 -08:00
John Reiser 5e03d86695 new PackLinuxElf32mipseb 2007-11-13 11:08:48 -08:00
John Reiser 95075aa28e MIPSEB implementation [still broken because no big-endian tools] 2007-11-12 09:23:45 -08:00
John Reiser 0260f0790a mipseb.r3000-linux.elf [broken because no big-endian tool chain] 2007-11-12 09:12:51 -08:00
John Reiser 34d65ba292 ET_DYN -fPIE position-independent executables 2007-11-12 09:11:16 -08:00
John Reiser 27a77a15ed prepare to deal with DT_GNU_HASH instead of DT_HASH 2007-11-12 09:05:36 -08:00
John Reiser 76025bfae1 _NR_link 2007-11-12 08:54:34 -08:00
John Reiser 4957faf482 DT_GNU_HASH, DT_JMPREL, etc. 2007-11-12 08:54:02 -08:00
Markus F.X.J. Oberhumer 0d8e16d5c8 Rename nocopy to noncopyable. 2007-11-07 23:13:20 +01:00
Markus F.X.J. Oberhumer 07baed1581 Improved IO error checking. 2007-11-06 03:21:32 +01:00
Markus F.X.J. Oberhumer eab5da075a And yet some more dos/exe size reduction. 2007-09-14 16:59:19 +02:00
Markus F.X.J. Oberhumer 0d1bbb19ce Small Makefile cleanup. 2007-09-14 16:31:17 +02:00
Markus F.X.J. Oberhumer 58d6cbc6ac More dos/exe lzma size reduction. 2007-09-14 16:03:51 +02:00
Markus F.X.J. Oberhumer 4d3b627839 Save some more bytes in dos/exe lzma stub. 2007-09-14 15:47:18 +02:00
Markus F.X.J. Oberhumer 49455c99ad Save 1 byte in dos/exe stub. 2007-09-14 13:48:00 +02:00
Markus F.X.J. Oberhumer 31bb6bedbd stub i086: use decimal constants. 2007-09-13 22:52:43 +02:00
Markus F.X.J. Oberhumer 8d54678ea1 Switch back to using binutils-multiarch-2.17. 2007-09-13 20:14:29 +02:00
Markus F.X.J. Oberhumer 590767c299 Make stub files compatible with binutils-multiarch-2.18. 2007-09-13 19:59:41 +02:00
John Reiser ec1bd342b8 fix error checking in mmap for i386-linux.elf [triggered by -fPIE] 2007-09-08 06:55:47 -07:00
John Reiser b031c9e7f6 fix unmapping on arm-linux.elf 2007-08-30 11:55:58 -07:00
John Reiser ea0dfe83b7 arm-linux.elf-entry.S clobbered ADRU with sz_unc of fold 2007-08-30 11:53:16 -07:00
Markus F.X.J. Oberhumer bdd90f2c57 Allow setting the compression method in the environment variable (popular
request from our users).
2007-08-04 12:13:09 +02:00
Markus F.X.J. Oberhumer 288dac5d70 Bump version for next release. 2007-07-31 22:50:23 +02:00
Markus F.X.J. Oberhumer 9d22e1c35e Added tag for RELEASE_301. 2007-07-31 22:42:40 +02:00
Markus F.X.J. Oberhumer ace2359e7b Bump tentative release date. 2007-07-31 15:06:53 +02:00
Markus F.X.J. Oberhumer 617e6510a5 docs: mention a workaround for --exact option. 2007-07-31 15:00:38 +02:00
Markus F.X.J. Oberhumer 26024770b8 For the moment we always throwCantPack() for arm/pe and win32/pe. 2007-07-30 17:47:42 +02:00
Markus F.X.J. Oberhumer d556f58e34 Fix screen problems by not relying on pass number in startCallback(). 2007-07-30 17:27:43 +02:00
Markus F.X.J. Oberhumer b6f302dfc0 Makefile: use /bin/echo for better portability. 2007-07-30 12:56:35 +02:00
Markus F.X.J. Oberhumer 8e9b5f14af Small Makefile updates. 2007-07-11 07:03:05 +02:00
Markus F.X.J. Oberhumer 3635c00143 Added support for LZMA SDK 4.49. Compiles, but pretty much untested. 2007-07-08 13:58:08 +02:00
Markus F.X.J. Oberhumer abc71baaa6 Avoid some warnings. 2007-07-08 11:42:45 +02:00
John Reiser 959aaebede bvmlinuz piggy.o need not be last in bzImage 2007-07-02 14:27:31 -07:00
John Reiser d17f8c5049 linux-2.6.21.5 CONFIG_PARAVIRT 2007-07-02 12:48:14 -07:00
Markus F.X.J. Oberhumer 42a7201a70 Updated README.1ST. 2007-06-19 15:26:02 +02:00
Markus F.X.J. Oberhumer 1f1744a49a Added new options --no-mode, --no-owner and --no-time. 2007-06-19 15:14:12 +02:00
Markus F.X.J. Oberhumer fd7dbe5bd9 Update docs of --exact option. 2007-06-19 14:49:53 +02:00
Markus F.X.J. Oberhumer 984549400d Clean up various names in getFullName(). 2007-06-12 14:25:00 +02:00
Markus F.X.J. Oberhumer cf0c49277e Add processing instructions to gpp_inc.py. 2007-06-12 13:40:35 +02:00
Markus F.X.J. Oberhumer 16c3f9fa9c Small Makefile updates. 2007-06-12 12:46:56 +02:00
John Reiser 2f2539cf34 workaround weak python script gpp_inc.py 2007-06-10 06:54:10 -07:00
John Reiser e66823d017 mipsel.r3000-linux: flush cache for NRV, fix stub copying when big 2007-06-09 17:13:50 -07:00
John Reiser 881c32a3df fix NRV_HEAD and NRV_TAIL in stub for mipsel.r3000-linux 2007-06-09 13:52:56 -07:00
John Reiser ea0a361c35 fix argv[0] on PowerPC with --lzma 2007-06-04 10:13:14 -07:00
László Molnár dc60f8bb7b merge 2007-05-18 16:11:11 +02:00
László Molnár 9e92c9ea12 pe: added a check for too small object alignment 2007-05-17 18:02:50 +02:00
John Reiser a503a54240 mipsel remember /proc/self/exe in environment 2007-05-16 15:37:22 -07:00
John Reiser 265957712a merge 2007-05-16 13:56:37 -07:00
John Reiser c26962bb71 fix build glitch 2007-05-16 13:53:17 -07:00
John Reiser a428eddf93 catch up automatically-generated files 2007-05-16 13:51:44 -07:00
John Reiser dc4f7eb2f9 mipsel close() 2007-05-16 13:51:00 -07:00
John Reiser d54ac1ba91 use register $25 for trampoline 2007-05-16 13:50:16 -07:00
John Reiser a3d46b18ac cacheflush 2007-05-16 13:49:54 -07:00
John Reiser e81dd05666 bug in make_hatch_*(); simplify xfind_pages() when MAP_FIXED; update AT_BASE 2007-05-16 13:48:44 -07:00
Markus F.X.J. Oberhumer 29394935e3 Use -Wstrict-prototypes CFLAGS in stub/Makefile. 2007-05-16 04:34:30 +02:00
Markus F.X.J. Oberhumer df8acc4ed7 Added .NOTPARALLEL to stub/Makefile. 2007-05-14 11:30:40 +02:00
John Reiser 81928d4ab1 mipsel stub escape hatch for munmap 2007-05-10 13:13:11 -07:00
John Reiser 3ebf93e03d mipsel syscall read+write of same register 2007-05-09 22:17:09 -07:00
John Reiser 59e4032f1f mipsel stub syscall registers 2007-05-08 13:33:00 -07:00
John Reiser 8f15777427 merge 2007-05-08 10:43:50 -07:00
John Reiser 748c4bf780 mipsel stub system calls 2007-05-08 10:41:13 -07:00
László Molnár befcf6d2b3 merge 2007-05-08 18:25:00 +02:00
László Molnár 48236ecd3c fixed an incorrect error message caused by a bug in relocation handling 2007-05-08 18:23:41 +02:00
Markus F.X.J. Oberhumer f340f84de7 Avoid warnings. 2007-05-08 16:12:42 +02:00
Markus F.X.J. Oberhumer 40e19293f9 Added throwOutOfMemoryException(). 2007-05-08 15:28:35 +02:00
John Reiser f252f824a4 mipsel conditional stub/src/i386-linux.elf-main.c 2007-05-08 05:48:15 -07:00
John Reiser 1d7e5a8130 typedef struct Extent 2007-05-08 05:18:41 -07:00
John Reiser cb2ff92c2f mipsel hack stub 2007-05-07 21:03:58 -07:00
John Reiser ef373ab54f mipsel hacking 2007-05-07 19:20:25 -07:00
John Reiser 9141a78c29 mipsel stub for mmap on Linux (not NetBSD); and subroutine arg[4..6]
in t0..t2 instead of on stack, to match LMZA_DEC20
2007-05-07 07:02:16 -07:00
John Reiser 10a6370738 hacking UPX_F_LINUX_ELF32_MIPSEL 2007-05-06 14:21:25 -07:00
John Reiser 573009eeb6 new format UPX_F_LINUX_ELF32_MIPSEL [work in progress] 2007-05-06 06:17:49 -07:00
John Reiser c3363712d9 PackVmlinuxBase<T>::pack() EM_PPC filter only contiguous instruction sections 2007-05-01 19:12:55 -07:00
John Reiser faa33d89a2 Documentation: UPX_F_VMLINUX_PPC32 changes to arch/powerpc/boot/main.c 2007-04-30 13:48:50 -07:00
John Reiser f347458c53 new format UPX_F_VMLINUX_PPC32 Linux kernel for PowerPC (32-bit) 2007-04-30 13:34:06 -07:00
Markus F.X.J. Oberhumer 530e6d9196 Bump version for next release. 2007-04-30 19:34:26 +02:00
Markus F.X.J. Oberhumer b398e18e12 Added tag for RELEASE_300. 2007-04-30 19:32:35 +02:00
Markus F.X.J. Oberhumer 747e8370e0 Remove debug leftover. 2007-04-26 16:20:01 +02:00
Markus F.X.J. Oberhumer 2c67875781 Pass and verify original data in all xxx_test_overlap() functions. 2007-04-26 16:15:49 +02:00
Markus F.X.J. Oberhumer c96e8a8c19 Better underflow and overflow handling in Packer::findOverlapOverhead(). 2007-04-26 13:59:01 +02:00
Markus F.X.J. Oberhumer 5f203fc082 Avoid warnings. 2007-04-26 13:13:26 +02:00
John Reiser b943c9b471 fix upx_zlib_test_overlap 2007-04-25 20:24:30 -07:00
John Reiser 1a90a1daa8 Implement upx_zlib_test_overlap() following upx_lzma_test_overlap() 2007-04-25 20:19:40 -07:00
John Reiser 72dfc743fd upx_lzma_test_overlap cleanup 2007-04-25 20:11:04 -07:00
John Reiser 465307655b Implement real upx_lzma_test_overlap().
Also make Packer::findOverlapOverhead() more pessimistic in worst case.
2007-04-25 16:11:33 -07:00
John Reiser 6ce71e6694 upx_lzma_test_overlap revert to 256 [FIXME] 2007-04-25 10:54:00 -07:00
John Reiser 7f01b3b92a upx_lzma_test_overlap() heuristic overlap_overhead up to 0xA00 2007-04-25 09:19:29 -07:00
John Reiser 76950d56b9 PackUnix::canPack allow incompressible extents in getPackHeader() 2007-04-25 09:18:31 -07:00
Markus F.X.J. Oberhumer c11e0d02b3 Added parm "allow_incompressible" to Packer::{get,read}PackHeader(). 2007-04-25 17:33:39 +02:00
Markus F.X.J. Oberhumer 4c798c1718 Use official name "armeb" instead of "armbe". 2007-04-25 16:50:51 +02:00
Markus F.X.J. Oberhumer 450d7e9ad4 Merge. 2007-04-25 16:42:41 +02:00
Markus F.X.J. Oberhumer b8ab79c83e Use offical name "arm" instead of "armel". 2007-04-25 16:42:08 +02:00
John Reiser 6934bdd533 allow unpack of incompressible extents, such as
http://www.equi4.com/pub/tk/8.4.13/tclkit-linux-x86.gz
2007-04-25 07:34:24 -07:00
John Reiser 84dedb73a5 propagate changes arm*-linux.elf-fold.h 2007-04-24 16:08:34 -07:00
John Reiser 8964aa5221 fix endian issue with .b_method (arm-linux.elf-entry.S) 2007-04-24 12:05:53 -07:00
Markus F.X.J. Oberhumer 3481ae236c Added missing armeb generated files. 2007-04-23 18:11:24 +02:00
John Reiser 46adc5f8a4 armeb-linux.kernel.vmlinux.S 2007-04-23 09:00:28 -07:00
John Reiser 5296df5899 add armeb-linux.kernel.vmlinux-head.S 2007-04-23 08:53:53 -07:00
John Reiser 13dad4be16 merge 2007-04-23 07:22:36 -07:00
John Reiser b5d0c343b4 sync src/Makefile with Markus bfb3d24c1fe7 2007-04-23 07:15:42 -07:00
Markus F.X.J. Oberhumer b00b945264 src/Makefile: avoid rebuilding .depend file on clean targets 2007-04-23 08:23:01 +02:00
John Reiser 3bda09e105 more cleanup armel etc 2007-04-22 20:04:13 -07:00
John Reiser 32d32c4e4a cleanup ARMEL etc. 2007-04-22 19:52:23 -07:00
John Reiser 497441b54e merge 2007-04-22 16:19:13 -07:00
John Reiser 9c564fd4c7 Add file formst UPX_F_LINUX_ELF32_ARMEB and normalize spelling
of ARMEL, ARMEB, armel, armeb.
2007-04-22 16:09:18 -07:00
John Reiser 0c2263d0e9 fix O_INP etc because cto8 is not pushed.
This change should have paralleled 1382:367eb149f29c
(Sun Aug 20 11:19:37 2006 -0700)
2007-04-22 15:50:24 -07:00
John Reiser 3d4d30766d merge 2007-04-22 15:24:17 -07:00
John Reiser 99d84d44fc propagate change to O_INP 2007-04-22 14:50:58 -07:00
John Reiser 41ba7077ad propagate change to O_INP 2007-04-22 14:50:58 -07:00
John Reiser 8a929a91c3 Fix O_INP etc because calling sequence changed to omit cto8.
This parallel change was forgotten at:
   changeset:   1382:367eb149f29c
   date:        Sun Aug 20 11:19:37 2006 -0700
   summary:     i386-linux.elf decompress does not need cto8
2007-04-22 14:47:08 -07:00
Markus F.X.J. Oberhumer 0604f06841 Backed out changeset 1b7b0715e0ab0d3b2e8afc96ac95d46d44bf3618 2007-04-23 07:36:46 +02:00
John Reiser 229924adf9 Fix O_INP etc because calling sequence changed to omit cto8.
This parallel change was forgotten at:
   changeset:   1382:367eb149f29c
   date:        Sun Aug 20 11:19:37 2006 -0700
   summary:     i386-linux.elf decompress does not need cto8
2007-04-22 14:47:08 -07:00
Markus F.X.J. Oberhumer df988b7c69 Bump tentative release date. 2007-04-22 16:55:41 +02:00
John Reiser e8106e2e34 propagate change to 'loadcon8' macro 2007-04-18 09:55:15 -07:00
John Reiser c21d3e24f8 fix 'loadcon8'; was bad for big-endian vmlinux ARM 2007-04-18 09:52:52 -07:00
Markus F.X.J. Oberhumer 2d87aa0753 Better ctok32 fix. 2007-04-02 18:57:42 +02:00
László Molnár b2ad4dc9a0 another fix for ctok32 2007-04-02 14:12:16 +02:00
László Molnár 370f2ea98f tmt/adam: fixed a ctok32 related bug 2007-04-01 17:31:48 +02:00
László Molnár a05ca565ff fixed a bug in ctok32 2007-04-01 17:07:43 +02:00
László Molnár 52255637f2 give an error for x86/wince files 2007-03-22 13:45:03 +01:00
Markus F.X.J. Oberhumer 0fcaa3a2f5 Work around broken scanf() implementations. 2007-03-22 07:30:16 +01:00
László Molnár 0e2fa6eb9d no need to warn for x86 wince files 2007-03-20 09:30:30 +01:00
Markus F.X.J. Oberhumer 1aac462c83 Remove trailing whitespace. 2007-03-15 07:36:58 +01:00
Markus F.X.J. Oberhumer 2a0edfd8f7 Small update from Jens. 2007-03-15 01:41:07 +01:00
László Molnár 1f59a9f846 more PS1 updates from Jens 2007-03-12 12:11:17 +01:00
László Molnár 80c20a90ea PS1 updates from Jens 2007-03-12 11:56:16 +01:00
Markus F.X.J. Oberhumer 56a35649fe Update Makefiles. 2007-03-09 07:59:50 +01:00
Markus F.X.J. Oberhumer f07cea0b79 Update help string. 2007-03-09 07:59:36 +01:00
Markus F.X.J. Oberhumer 4c1b08a281 Bump version for next release. 2007-03-08 08:26:28 +01:00
Markus F.X.J. Oberhumer 117f9eddcd src/Makefile: use an explicit .depend file. 2007-03-08 08:19:27 +01:00
Markus F.X.J. Oberhumer 7bbbfce482 Added tag for RELEASE_293. 2007-03-08 06:16:24 +01:00
602 changed files with 125923 additions and 63467 deletions
+101
View File
@@ -0,0 +1,101 @@
# Support for AppVeyor CI -- https://www.appveyor.com/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
os: Visual Studio 2015
environment:
global: { TRAVIS_OS_NAME: windows, CROSS: "", C: "", B: release, T: "", X: "" }
matrix:
- { C: msvc-10.0-x86, CL_VERSION: 16.00, VS_VERSION: 2010 }
### - { C: msvc-10.0-x64, CL_VERSION: 16.00, VS_VERSION: 2010 } # AppVeyor: x64 compiler is not installed
- { C: msvc-11.0-x86, CL_VERSION: 17.00, VS_VERSION: 2012 }
### - { C: msvc-11.0-x64, CL_VERSION: 17.00, VS_VERSION: 2012 } # AppVeyor: x64 compiler is not installed
- { C: msvc-12.0-x86, CL_VERSION: 18.00, VS_VERSION: 2013 }
- { C: msvc-12.0-x64, CL_VERSION: 18.00, VS_VERSION: 2013 }
- { C: msvc-14.0-x86, CL_VERSION: 19.00, VS_VERSION: 2015 }
- { C: msvc-14.0-x64, CL_VERSION: 19.00, VS_VERSION: 2015 }
- { C: msvc-14.1-x86, CL_VERSION: 19.12, VS_VERSION: 2017, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 }
- { C: msvc-14.1-x64, CL_VERSION: 19.12, VS_VERSION: 2017, APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 }
UPX_AUTOMATIC_BUILDS_SSL_KEY:
secure: PZMpVeqnEYe39kK+Zu2/fnmZ6/HG6Lvls0hh9GMVU9vCWsr8xaU7kIbHBS01puUkb4bEWPILKYvSEDuhOhguDjd/P4QdXWipvV/F2GaVax0=
UPX_AUTOMATIC_BUILDS_SSL_IV:
secure: ZshjJ/78dbY60mVJjZJv9Si7rHY9VQb1tfQvFd4lqvY=
init:
- git config --global core.autocrlf input
- where bash & where cat & where chmod & where cmp & where cp & where curl & where date & where file & where git & where gzip & where mkdir & where mv & where openssl & where readlink & where rm & where rmdir & where sed & where sha256sum & where sort & where ssh & where ssh-add & where ssh-agent & where ssh-keyscan & where tar & where touch
# - bash --version & git --version & sed --version & tar --version
- git --version & bash --version
# - dir "c:\Program Files\Git\usr\bin"
# - dir "c:\cygwin\bin"
# - dir "c:\mingw\bin"
# - dir "c:\mingw-w64\i686-5.3.0-posix-dwarf-rt_v4-rev0\mingw32\bin"
install:
- cd c:\projects
- md build build\%C% deps
- cd c:\projects\upx
- git submodule update --init --recursive
- cd c:\projects\deps
- curl -q -L --retry 5 -o ucl-1.03.tar.gz "https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.gz"
- curl -q -L --retry 5 -o zlib-1.2.8.tar.gz "https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.gz"
- git clone https://github.com/upx/upx-testsuite
- tar -xzf ucl-1.03.tar.gz
- tar -xzf zlib-1.2.8.tar.gz
# patch UCL for msvc-14.0 (vsnprintf issue)
- sed -i '/# *define.*snprintf *_v*snprintf$/d' ucl-1.03/acc/acc_auto.h
##- curl -q -L --retry 5 -o config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
##- curl -q -L --retry 5 -o config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
##- cp config.guess config.sub ucl-1.03/acconfig/
# setup compiler
- if "%C%"=="msvc-10.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86 )
- if "%C%"=="msvc-10.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 )
- if "%C%"=="msvc-11.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 )
- if "%C%"=="msvc-11.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64 )
- if "%C%"=="msvc-12.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 )
- if "%C%"=="msvc-12.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64 )
- if "%C%"=="msvc-14.0-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 )
- if "%C%"=="msvc-14.0-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 )
- if "%C%"=="msvc-14.1-x86" ( call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86 )
- if "%C%"=="msvc-14.1-x64" ( call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 )
build_script:
- cd c:\projects\upx
# setup directories following the VPATH build in travis_build.sh
- where cl & where link
- set BDIR=c:\projects\build\%C%\%B%
- md %BDIR% %BDIR%\ucl-1.03 %BDIR%\upx %BDIR%\upx-testsuite %BDIR%\zlib-1.2.8
- set DEFS=-D_CRT_SECURE_NO_WARNINGS
- git rev-parse --short=12 HEAD > %BDIR%\upx\.GITREV.txt
# build UCL
- cd %BDIR%\ucl-1.03
- set s=c:\projects\deps\ucl-1.03
- cl -MT -O2 -W4 %DEFS% -I%s%\include -I%s% -c %s%\src\*.c
- link -lib -out:ucl.lib *.obj
# build zlib
- cd %BDIR%\zlib-1.2.8
- cl -MT -O2 -W2 %DEFS% -c c:\projects\deps\zlib-1.2.8\*.c
- link -lib -out:zlib.lib *.obj
# build UPX
- cd %BDIR%\upx
- set s=c:\projects\upx\src
- cat .GITREV.txt
- set /p GITREV=<.GITREV.txt
- cl -MT -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% -DUCL_NO_ASM -I%s%\lzma-sdk -Ic:\projects\deps\ucl-1.03\include -Ic:\projects\deps\zlib-1.2.8 -Feupx.exe %s%\*.cpp %BDIR%\ucl-1.03\ucl.lib %BDIR%\zlib-1.2.8\zlib.lib
test_script:
- set UPX=--no-color --no-progress
- cd %BDIR%\upx
# basic tests
- .\upx.exe --version
- .\upx.exe upx.exe -o upx_packed.exe
- dir *.exe
- .\upx.exe -l upx_packed.exe
- .\upx.exe -t upx_packed.exe
- .\upx_packed.exe --version
# now run the UPX testsuite using bash
- cd c:\projects\upx
- bash ./.github/travis_testsuite_1.sh
- bash ./.github/travis_deploy.sh
# vim:set ts=2 sw=2 et:
+23
View File
@@ -0,0 +1,23 @@
#
# see https://editorconfig.org/
#
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
[{GNUmakefile*,MMakefile*,Makefile*,Makevars*,*.mk}]
indent_size = 8
indent_style = tab
[*.S]
indent_size = 8
[*.yml]
indent_size = 2
+33
View File
@@ -0,0 +1,33 @@
<!---
IF YOU REMOVE THIS TEMPLATE WE WILL CLOSE YOUR ISSUE WITHOUT RESPONSE.
Just read it and fill in the details we're asking, it saves so much of our time. Thanks!
-->
## What's the problem (or question)?
<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->
## What should have happened?
<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->
## Do you have an idea for a solution?
<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->
## How can we reproduce the issue?
<!--- Provide unambiguous set of steps to reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.
## Please tell us details about your environment.
<!--- Include as many relevant details about the environment you experienced the bug in -->
* UPX version used (`upx --version`):
* Host Operating System and version:
* Host CPU architecture:
* Target Operating System and version:
* Target CPU architecture:
+170
View File
@@ -0,0 +1,170 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi
source "$argv0dir/travis_init.sh" || exit 1
# create dirs
cd / || exit 1
mkbuilddirs $upx_BUILDDIR $ucl_BUILDDIR $upx_testsuite_BUILDDIR $zlib_BUILDDIR
cd / && cd $upx_SRCDIR || exit 1
echo
print_settings
echo
echo "$CC --version"; $CC --version
echo "$CXX --version"; $CXX --version
echo
# check whitespace
if [[ $TRAVIS_OS_NAME == linux ]]; then
cd / && cd $upx_SRCDIR || exit 1
echo "Checking source code for whitespace violations..."
bash ./src/stub/scripts/check_whitespace.sh || exit 1
echo " Passed."
fi # linux
set -x
#
# rebuild UPX stubs (needs upx-stubtools)
#
if [[ $BM_X =~ (^|\+)rebuild-stubs($|\+) ]]; then
if [[ -f "$HOME/local/bin/bin-upx/upx-stubtools-check-version" ]]; then
bin_upx=$(readlink -en -- "$HOME/local/bin/bin-upx")
elif [[ -f "$HOME/.local/bin/bin-upx/upx-stubtools-check-version" ]]; then
bin_upx=$(readlink -en -- "$HOME/.local/bin/bin-upx")
else
bin_upx=$(readlink -en -- "$upx_SRCDIR/../deps/bin-upx-20160918")
fi
cd / && cd $upx_SRCDIR || exit 1
extra_subdirs=()
extra_subdirs+=( src/stub/src/arch/amd64 )
extra_subdirs+=( src/stub/src/arch/arm/v4a )
extra_subdirs+=( src/stub/src/arch/arm/v4t )
extra_subdirs+=( src/stub/src/arch/arm64/v8 )
extra_subdirs+=( src/stub/src/arch/i386 )
extra_subdirs+=( src/stub/src/arch/m68k/m68000 )
extra_subdirs+=( src/stub/src/arch/m68k/m68020 )
extra_subdirs+=( src/stub/src/arch/mips/r3000 )
extra_subdirs+=( src/stub/src/arch/powerpc/32 )
extra_subdirs+=( src/stub/src/arch/powerpc/64 )
extra_subdirs+=( src/stub/src/arch/powerpc/64le )
make -C src/stub maintainer-clean
for d in ${extra_subdirs[@]}; do
make -C $d -f Makefile.extra maintainer-clean
git status $d || true
done
git status src/stub/src || true
git status || true
failed=0
for d in ${extra_subdirs[@]}; do
PATH="$bin_upx:$PATH" make -C $d -f Makefile.extra || failed=1
done
PATH="$bin_upx:$PATH" make -C src/stub all || failed=1
if [[ $failed != 0 ]]; then
echo "UPX-ERROR: FATAL: rebuild-stubs failed"
exit 1
fi
if ! git diff --quiet; then
git status || true
git diff || true
echo "UPX-ERROR: FATAL: rebuild-stubs git status mismatch. See log file."
exit 1
fi
git status
if [[ $BM_X == rebuild-stubs ]]; then
echo "X=rebuild-stubs done. Exiting."
exit 0
fi
unset bin_upx extra_subdirs d failed
fi
#
# build UCL
#
cd / && cd $ucl_BUILDDIR || exit 1
# patch UCL
sed 's/^#elif (ACC_ARCH_AMD64 || ACC_ARCH_IA64)$/& \&\& !defined(__ILP32__)/' $ucl_SRCDIR/acc/acc_chk.ch > a.tmp
if cmp -s a.tmp $ucl_SRCDIR/acc/acc_chk.ch; then rm a.tmp; else mv a.tmp $ucl_SRCDIR/acc/acc_chk.ch; fi
if [[ $BUILD_LOCAL_UCL == 1 ]]; then
# ucl-1.03/configure is too old - build manually
rm -f ./*.o libucl.a
$CC -O2 -I$ucl_SRCDIR/include -I$ucl_SRCDIR -c $ucl_SRCDIR/src/*.c
$AR rcs libucl.a *.o
mkdir -p src/.libs
cp libucl.a src/.libs
else
if [[ ! -f config.status ]]; then
$ucl_SRCDIR/configure --enable-static --disable-shared --disable-asm
fi
make
fi
#
# build zlib
#
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
cd / && cd $zlib_BUILDDIR || exit 1
# build manually
rm -f ./*.o libz.a
$CC -O2 -c $zlib_SRCDIR/*.c
$AR rcs libz.a *.o
fi
#
# build UPX
#
export UPX_UCLDIR="$ucl_SRCDIR"
cd / && cd $upx_BUILDDIR || exit 1
make="make -f $upx_SRCDIR/src/Makefile"
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DUCL_NO_ASM"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$ucl_BUILDDIR/src/.libs"
if [[ $BUILD_LOCAL_ZLIB == 1 ]]; then
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -I$zlib_SRCDIR"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$zlib_BUILDDIR"
fi
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -fprofile-arcs -ftest-coverage"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
fi
if [[ $BM_B =~ (^|\+)debug($|\+) ]]; then
make="$make BUILD_TYPE_DEBUG=1"
fi
if [[ $BM_B =~ (^|\+)sanitize($|\+) ]]; then
case $TRAVIS_OS_NAME-$CC in linux-gcc*) EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fuse-ld=gold" ;; esac
make="$make BUILD_TYPE_SANITIZE=1"
fi
if [[ $BM_B =~ (^|\+)scan-build($|\+) ]]; then
make="$SCAN_BUILD $make"
fi
if [[ $BM_B =~ (^|\+)valgrind($|\+) ]]; then
EXTRA_CPPFLAGS="$EXTRA_CPPFLAGS -DWITH_VALGRIND"
fi
if [[ $BM_B =~ (^|\+)ALLOW_FAIL($|\+) ]]; then
echo "ALLOW_FAIL"
set +e
fi
export EXTRA_CPPFLAGS EXTRA_CXXFLAGS EXTRA_LDFLAGS
[[ -z $upx_exeext ]] && upx_exeext=.out
$make exeext=$upx_exeext
pwd
ls -l upx${upx_exeext}
$SIZE upx${upx_exeext} || true
file upx${upx_exeext}
exit 0
+196
View File
@@ -0,0 +1,196 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi
source "$argv0dir/travis_init.sh" || exit 1
set -x # debug
if [[ $BM_X == rebuild-stubs ]]; then exit 0; fi
# save space and do not deploy debug builds
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then exit 0; fi
if [[ $BM_B =~ (^|\+)debug($|\+) ]]; then exit 0; fi
if [[ $BM_B =~ (^|\+)sanitize($|\+) ]]; then exit 0; fi
if [[ $BM_B =~ (^|\+)scan-build($|\+) ]]; then exit 0; fi
if [[ $BM_B =~ (^|\+)valgrind($|\+) ]]; then exit 0; fi
# prepare $subdir and $branch
subdir=
branch=
if [[ -n $APPVEYOR_JOB_ID ]]; then
branch=$APPVEYOR_REPO_BRANCH
if [[ -n $APPVEYOR_PULL_REQUEST_NUMBER ]]; then exit 0; fi
elif [[ -n $GITLAB_CI ]]; then
subdir=$CI_BUILD_NAME
branch=$CI_BUILD_REF_NAME
else
branch=$TRAVIS_BRANCH
if [[ "$TRAVIS_PULL_REQUEST" != "false" ]]; then exit 0; fi
fi
subdir=${subdir%%:*}; subdir=${subdir%%/*}; subdir=${subdir%%--*}
case $branch in
devel*) ;;
gitlab*) ;;
master*) ;;
travis*) ;;
*) exit 0;;
esac
# get $rev, $branch and $git_user
cd / && cd $upx_SRCDIR || exit 1
rev=$(git rev-parse --verify HEAD)
if [[ "$branch" == gitlab* ]]; then
if git fetch -v origin devel; then
git branch -a -v
rev=$(git merge-base origin/devel $rev || echo $rev)
fi
fi
timestamp=$(git log -n1 --format='%at' $rev)
date=$(TZ=UTC0 date -d "@$timestamp" '+%Y%m%d-%H%M%S')
#branch="$branch-$date-${rev:0:6}"
# make the branch name a little bit shorter so that it looks nice on GitHub
branch="$branch-${date:0:8}-${rev:0:7}"
if [[ -n $APPVEYOR_JOB_ID ]]; then
branch="$branch-appveyor"
git_user="AppVeyor CI"
elif [[ -n $GITLAB_CI ]]; then
branch="$branch-gitlab"
git_user="GitLab CI"
else
branch="$branch-travis"
git_user="Travis CI"
fi
unset timestamp date
# /***********************************************************************
# // prepare directory $d
# ************************************************************************/
cd / && cd $upx_BUILDDIR || exit 1
mkdir deploy || exit 1
chmod 700 deploy
cd deploy || exit 1
if [[ -n $BM_CROSS ]]; then
d=$BM_CROSS
else
cpu=unknown
case $BM_C in
clang*-m32 | gcc*-m32) cpu=i386;;
clang*-m64 | gcc*-m64) cpu=amd64;;
clang*-mx32 | gcc*-mx32) cpu=amd64;;
msvc*-x86) cpu=i386;;
msvc*-x64) cpu=amd64;;
esac
os=$TRAVIS_OS_NAME
if [[ $os == osx ]]; then
os=darwin
elif [[ $os == windows ]]; then
[[ $cpu == i386 ]] && os=win32
[[ $cpu == amd64 ]] && os=win64
fi
d=$cpu-$os
unset cpu os
fi
d=$d-$BM_C-$BM_B
if [[ -n $subdir ]]; then
print_header "DEPLOY $subdir/$d"
else
print_header "DEPLOY $d"
fi
mkdir $d || exit 1
for exeext in .exe .out; do
f=$upx_BUILDDIR/upx$exeext
if [[ -f $f ]]; then
cp -p -i $f $d/upx-git-${rev:0:12}$exeext
sha256sum -b $d/upx-git-${rev:0:12}$exeext
fi
unset f
done
# /***********************************************************************
# // clone, add files & push
# ************************************************************************/
new_branch=0
if ! git clone -b "$branch" --single-branch https://github.com/upx/upx-automatic-builds.git; then
git clone -b master --single-branch https://github.com/upx/upx-automatic-builds.git
new_branch=1
fi
cd upx-automatic-builds || exit 1
chmod 700 .git
git config user.name "$git_user"
git config user.email "none@none"
if [[ $new_branch == 1 ]]; then
git checkout --orphan "$branch"
git reset --hard || true
fi
git ls-files -v
if [[ -n $subdir ]]; then
[[ -d $subdir ]] || mkdir $subdir
mv ../$d $subdir/
git add $subdir/$d
else
mv ../$d .
git add $d
fi
if git diff --cached --exit-code --quiet >/dev/null; then
# nothing to do ???
exit 0
fi
now=$(date '+%s')
##date=$(TZ=UTC0 date -d "@$now" '+%Y-%m-%d %H:%M:%S')
git commit --date="$now" -m "Automatic build $d"
git ls-files -v
#git log --pretty=fuller
umask 077
[[ -d ~/.ssh ]] || mkdir ~/.ssh
fix_home_ssh_perms
repo=$(git config remote.origin.url)
ssh_repo=${repo/https:\/\/github.com\//git@github.com:}
eval $(ssh-agent -s)
set +x # IMPORTANT
openssl aes-256-cbc -d -a -K "$UPX_AUTOMATIC_BUILDS_SSL_KEY" -iv "$UPX_AUTOMATIC_BUILDS_SSL_IV" -in "$upx_SRCDIR/.github/upx-automatic-builds@github.com.enc" -out .git/deploy.key
set -x
chmod 600 .git/deploy.key
ssh-add .git/deploy.key
fix_home_ssh_perms
ssh-keyscan -H github.com >> ~/.ssh/known_hosts
fix_home_ssh_perms
let i=0 || true
while true; do
if [[ $i -ge 10 ]]; then
echo "ERROR: git push failed"
exit 1
fi
if [[ $new_branch == 1 ]]; then
if git push -u $ssh_repo "$branch"; then break; fi
else
if git push $ssh_repo "$branch"; then break; fi
fi
git branch -a -v
git fetch -v origin "$branch"
git branch -a -v
git rebase FETCH_HEAD
git branch -a -v
sleep $((RANDOM % 5 + 1))
let i+=1
done
exit 0
+259
View File
@@ -0,0 +1,259 @@
## vim:set ts=4 sw=4 et:
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#set -x # debug
umask 022
export GIT_PAGER=
# rename short variables to more readable Build-Matrix BM_ names
# C is COMPILER
# B is BUILD_OPTIONS
# T is TESTSUITE_OPTIONS
# X is EXTRA_OPTIONS
BM_CROSS=$CROSS; BM_C=$C; BM_B=$B; BM_T=$T; BM_X=$X
unset CROSS C B T X
[[ -z $BM_C ]] && BM_C=gcc
[[ -z $BM_B ]] && BM_B=release
# just in case, unset variable for passing extra UPX options
export UPX=
# un-export some vars
declare +x UPX_AUTOMATIC_BUILDS_SSL_KEY UPX_AUTOMATIC_BUILDS_SSL_IV
# compatibility wrappers
if [[ $TRAVIS_OS_NAME == osx ]]; then
# use GNU coreutils ("brew install coreutils")
chmod() {
gchmod "$@"
}
date() {
gdate "$@"
}
readlink() {
greadlink "$@"
}
sha256sum() {
gsha256sum "$@"
}
fi
if [[ -n $APPVEYOR_JOB_ID ]]; then
openssl() {
/usr/bin/openssl "$@"
}
sort() {
/usr/bin/sort "$@"
}
fi
# set CC and CXX from BM_C and BM_CROSS
if [[ -z $CC_OVERRIDE ]]; then
CC=false CXX=false SCAN_BUILD=false
AR=ar SIZE=size
if [[ -n $APPVEYOR_JOB_ID ]]; then
BUILD_LOCAL_UCL=1
BUILD_LOCAL_ZLIB=1
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
fi
upx_exeext=.exe
# dir c:\cygwin
case $BM_C in
gcc-m32 | gcc-4.9-m32)
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
gcc-m64 | gcc-4.9-m64)
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
msvc | msvc-*)
AR="link -lib"; CC="cl"; CXX="cl" ;; # standard system compiler
esac
fi # APPVEYOR_JOB_ID
if [[ -n $BM_CROSS ]]; then
BUILD_LOCAL_UCL=1
BUILD_LOCAL_ZLIB=1
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
export upx_EXTRA_LDFLAGS="-static-libgcc -static-libstdc++"
fi
cat /etc/os-release || true
if egrep -q '^PRETTY_NAME="?Ubuntu .*12\.04' /etc/os-release; then
case $BM_CROSS-$BM_C in
arm-linux-gnueabi-gcc | arm-linux-gnueabi-gcc-4.6)
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
arm-linux-gnueabihf-gcc | arm-linux-gnueabihf-gcc-4.6)
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc"; CXX="$x-g++" ;;
i[36]86-w64-mingw32-gcc | i[36]86-w64-mingw32-gcc-4.6)
upx_exeext=.exe
[[ -z $upx_wine ]] && upx_wine="wine"
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
x86_64-w64-mingw32-gcc | x86_64-w64-mingw32-gcc-4.6)
upx_exeext=.exe
[[ -z $upx_wine ]] && upx_wine="wine"
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
esac
elif egrep -q '^PRETTY_NAME="?Ubuntu 16\.04' /etc/os-release; then
case $BM_CROSS-$BM_C in
aarch64-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-aarch64 -L /usr/aarch64-linux-gnu"
x=aarch64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
arm-linux-gnueabi-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabi"
x=arm-linux-gnueabi; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
arm-linux-gnueabihf-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-arm -L /usr/arm-linux-gnueabihf"
x=arm-linux-gnueabihf; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
i[36]86-w64-mingw32-gcc-5)
upx_exeext=.exe
[[ -z $upx_wine ]] && upx_wine="wine"
x=i686-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m32"; CXX="$x-g++ -m32" ;;
mips-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-mips -L /usr/mips-linux-gnu"
x=mips-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
mipsel-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-mipsel -L /usr/mipsel-linux-gnu"
x=mipsel-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
powerpc-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc -L /usr/powerpc-linux-gnu"
x=powerpc-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
powerpc64-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64 -L /usr/powerpc64-linux-gnu"
x=powerpc64-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
powerpc64le-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-ppc64le -L /usr/powerpc64le-linux-gnu"
x=powerpc64le-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
s390x-linux-gnu-gcc-5)
[[ -z $upx_qemu ]] && upx_qemu="qemu-s390x -L /usr/s390x-linux-gnu"
x=s390x-linux-gnu; AR="$x-ar"; CC="$x-gcc-5"; CXX="$x-g++-5" ;;
x86_64-w64-mingw32-gcc-5)
upx_exeext=.exe
[[ -z $upx_wine ]] && upx_wine="wine"
x=x86_64-w64-mingw32; AR="$x-ar"; CC="$x-gcc -m64"; CXX="$x-g++ -m64" ;;
esac
fi
fi # BM_CROSS
if [[ "$CC" == "false" ]]; then # generic
if [[ -z $BM_CROSS ]]; then
case $BM_C in
clang | clang-m?? | clang-3.4-m?? | clang-[6789][0-9][0-9]-m??)
CC="clang"; CXX="clang++" ;; # standard system compiler
clang-[345].[0-9]-m??)
v=${BM_C:6:3}; CC="clang-$v"; CXX="clang++-$v"; SCAN_BUILD="scan-build-$v" ;;
gcc | gcc-m?? | gcc-mx32)
CC="gcc"; CXX="g++" ;; # standard system compiler
gcc-[34].[0-9]-m?? | gcc-[34].[0-9]-mx32)
v=${BM_C:4:3}; CC="gcc-$v"; CXX="g++-$v" ;;
gcc-[567]-m?? | gcc-[567]-mx32)
v=${BM_C:4:1}; CC="gcc-$v"; CXX="g++-$v" ;;
esac
fi
fi # generic
case $BM_C in
clang*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
clang*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
gcc*-m32) CC="$CC -m32"; CXX="$CXX -m32" ;;
gcc*-m64) CC="$CC -m64"; CXX="$CXX -m64" ;;
gcc*-mx32) CC="$CC -mx32"; CXX="$CXX -mx32"; BUILD_LOCAL_UCL=1; BUILD_LOCAL_ZLIB=1 ;;
esac
if [[ $BM_C =~ (^|\-)(clang|gcc)($|\-) ]]; then
CC="$CC -std=gnu89"
fi
unset v x
export AR CC CXX
fi # CC_OVERRIDE
# source dirs
[[ -z $upx_SRCDIR ]] && upx_SRCDIR=$(readlink -mn -- $argv0dir/..)
[[ -z $ucl_SRCDIR ]] && ucl_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/ucl-1.03)
[[ -z $upx_testsuite_SRCDIR ]] && upx_testsuite_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/upx-testsuite)
[[ -z $zlib_SRCDIR ]] && zlib_SRCDIR=$(readlink -mn -- $upx_SRCDIR/../deps/zlib-1.2.8)
# build dirs
mkbuilddirs() {
local d
for d in "$@"; do
mkdir -p -v "$d" || exit 1
[[ -f "$d/.mfxnobackup" ]] || touch "$d/.mfxnobackup"
done
}
# search for an existing $toptop_builddir
if [[ -z $toptop_builddir ]]; then
for d in . ..; do
for subdir in "local" appveyor circle gitlab travis .; do
dd=$d/build/$subdir
if [[ -d $dd ]]; then
toptop_builddir=$(readlink -en -- "$dd")
break 2
fi
done
done
unset d subdir dd
fi
[[ -z $toptop_builddir ]] && toptop_builddir=$(readlink -mn -- ./build)
[[ -z $toptop_bdir ]] && toptop_bdir=$(readlink -mn -- "$toptop_builddir/${BM_CROSS:+$BM_CROSS-}$BM_C/$BM_B")
[[ -z $upx_BUILDDIR ]] && upx_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx")
[[ -z $ucl_BUILDDIR ]] && ucl_BUILDDIR=$(readlink -mn -- "$toptop_bdir/ucl-1.03")
[[ -z $upx_testsuite_BUILDDIR ]] && upx_testsuite_BUILDDIR=$(readlink -mn -- "$toptop_bdir/upx-testsuite")
[[ -z $zlib_BUILDDIR ]] && zlib_BUILDDIR=$(readlink -mn -- "$toptop_bdir/zlib-1.2.8")
[[ -z $lcov_OUTPUTDIR ]] && lcov_OUTPUTDIR=$(readlink -mn -- "$toptop_bdir/.lcov-results")
unset toptop_builddir toptop_bdir
# ensure absolute directories
make_absolute() {
local d
while [[ $# -gt 0 ]]; do
if [[ -n ${!1} ]]; then
d=$(readlink -mn -- "${!1}")
eval $1="$d"
fi
shift
done
}
for var_prefix in ucl upx upx_testsuite zlib; do
for var_suffix in _BUILDDIR _SRCDIR; do
make_absolute ${var_prefix}${var_suffix}
done
done
make_absolute lcov_OUTPUTDIR
unset var_prefix var_suffix
print_header() {
local x="==========="; x="$x$x$x$x$x$x$x"
echo -e "\n${x}\n${1}\n${x}\n"
}
print_settings() {
local v var_prefix var_suffix
# Build Matrix
for v in TRAVIS_OS_NAME BM_CROSS BM_C BM_B BM_T; do
[[ -n ${!v} ]] && echo "${v}='${!v}'"
done
# BM_C related
for v in AR CC CXX CPPFLAGS CFLAGS CXXFLAGS LDFLAGS LIBS SCAN_BUILD; do
[[ -n ${!v} ]] && echo "${v}='${!v}'"
v=EXTRA_${v}
[[ -n ${!v} ]] && echo "${v}='${!v}'"
done
# directories and other info
for v in TRAVIS_XCODE_SDK UPX_UCLDIR lcov_OUTPUTDIR; do
[[ -n ${!v} ]] && echo "${v}='${!v}'"
done
for var_prefix in ucl upx upx_testsuite zlib; do
for var_suffix in _BUILDDIR _SRCDIR; do
v=${var_prefix}${var_suffix}
[[ -n ${!v} ]] && echo "${v}='${!v}'"
done
done
##env | LC_ALL=C sort
}
fix_home_ssh_perms() {
if [[ -d ~/.ssh ]]; then
if [[ -x /usr/sbin/restorecon ]]; then
/usr/sbin/restorecon -v -R ~/.ssh || true
fi
chmod -c -R go-rwx ~/.ssh || true
fi
}
true
+380
View File
@@ -0,0 +1,380 @@
#! /bin/bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
# very first version of the upx-testsuite
#
if [[ $TRAVIS_OS_NAME == osx ]]; then
argv0=$0; argv0abs=$(greadlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
else
argv0=$0; argv0abs=$(readlink -en -- "$0"); argv0dir=$(dirname "$argv0abs")
fi
source "$argv0dir/travis_init.sh" || exit 1
if [[ $BM_T =~ (^|\+)SKIP($|\+) ]]; then
echo "UPX testsuite SKIPPED."
exit 0
fi
if [[ $BM_X == rebuild-stubs ]]; then
exit 0
fi
[[ -f $upx_exe ]] && upx_exe=$(readlink -en -- "$upx_exe")
# create dirs
cd / || exit 1
mkbuilddirs $upx_testsuite_BUILDDIR
cd / && cd $upx_testsuite_BUILDDIR || exit 1
if [[ ! -d $upx_testsuite_SRCDIR/files/packed ]]; then exit 1; fi
# /***********************************************************************
# // support functions
# ************************************************************************/
testsuite_header() {
print_header "$1"
}
testsuite_split_f() {
fd=$(dirname "$1")
fb=$(basename "$1")
fsubdir=$(basename "$fd")
# sanity checks
if [[ ! -f "$1" || -z "$fsubdir" || -z "$fb" ]]; then
fd= fb= fsubdir=
fi
}
testsuite_check_sha() {
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
echo
cat $1/.sha256sums.current
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
echo "UPX-ERROR: $1 FAILED: checksum mismatch"
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
exit_code=1
let num_errors+=1 || true
all_errors="${all_errors} $1"
#exit 1
fi
echo
}
testsuite_check_sha_decompressed() {
(cd "$1" && sha256sum -b */* | LC_ALL=C sort -k2) > $1/.sha256sums.current
if ! cmp -s $1/.sha256sums.expected $1/.sha256sums.current; then
cat $1/.sha256sums.current
echo "UPX-ERROR: FATAL: $1 FAILED: decompressed checksum mismatch"
diff -u $1/.sha256sums.expected $1/.sha256sums.current || true
exit 1
fi
}
testsuite_use_canonicalized=1
testsuite_run_compress() {
testsuite_header $testdir
local files f
if [[ $testsuite_use_canonicalized == 1 ]]; then
files=t020_canonicalized/*/*
else
files=t010_decompressed/*/*
fi
for f in $files; do
testsuite_split_f $f
[[ -z $fb ]] && continue
echo "# $f"
mkdir -p $testdir/$fsubdir $testdir/.decompressed/$fsubdir
$upx_run -qq --prefer-ucl "$@" $f -o $testdir/$fsubdir/$fb
$upx_run -qq -d $testdir/$fsubdir/$fb -o $testdir/.decompressed/$fsubdir/$fb
done
testsuite_check_sha $testdir
$upx_run -qq -l $testdir/*/*
$upx_run -qq --file-info $testdir/*/*
$upx_run -q -t $testdir/*/*
if [[ $testsuite_use_canonicalized == 1 ]]; then
# check that after decompression the file matches the canonicalized version
cp t020_canonicalized/.sha256sums.expected $testdir/.decompressed/
testsuite_check_sha_decompressed $testdir/.decompressed
rm -rf "./$testdir/.decompressed"
fi
}
# /***********************************************************************
# // expected checksums
# //
# // To ease maintenance of this script in case of updates this section
# // can be automatically re-created from the current checksums -
# // see call of function recreate_expected_sha256sums below.
# ************************************************************************/
recreate_expected_sha256sums() {
local o="$1"
local files f d
echo "########## begin .sha256sums.recreate" > "$o"
files=*/.sha256sums.current
for f in $files; do
d=$(dirname "$f")
echo "expected_sha256sums__${d}="'"\' >> "$o"
cat "$f" >> "$o"
echo '"' >> "$o"
done
echo "########## end .sha256sums.recreate" >> "$o"
}
########## begin .sha256sums.recreate
expected_sha256sums__t010_decompressed="\
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
28d7ca8f0dfca8159e637eaf2057230b6e6719e07751aca1d19a45b5efed817c *arm-wince.pe/upx-3.91.exe
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
0dbc3c267ca8cd35ee3ea138b59c8b1ae35872c918be6d17df1a892b75710f9b *i386-win32.pe/upx-3.91.exe
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t020_canonicalized="\
24158f78c34c4ef94bb7773a6dda7231d289be76c2f5f60e8b9ddb3f800c100e *amd64-linux.elf/upx-3.91
28d7ca8f0dfca8159e637eaf2057230b6e6719e07751aca1d19a45b5efed817c *arm-wince.pe/upx-3.91.exe
b1c1c38d50007616aaf8e942839648c80a6111023e0b411e5fa7a06c543aeb4a *armeb-linux.elf/upx-3.91
bcac77a287289301a45fde9a75e4e6c9ad7f8d57856bae6eafaae12ae4445a34 *i386-dos32.djgpp2.coff/upx-3.91.exe
730a513b72a094697f827e4ac1a4f8ef58a614fc7a7ad448fa58d60cd89af7ed *i386-linux.elf/upx-3.91
0dbc3c267ca8cd35ee3ea138b59c8b1ae35872c918be6d17df1a892b75710f9b *i386-win32.pe/upx-3.91.exe
8e5333ea040f5594d3e67d5b09e005d52b3a52ef55099a7c11d7e39ead38e66d *m68k-atari.tos/upx-3.91.ttp
c3f44b4d00a87384c03a6f9e7aec809c1addfe3e271244d38a474f296603088c *mipsel-linux.elf/upx-3.91
b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
7301bb93535f91bb789b44da75c2f365cc2d0fa99a4d597f49de8716d96dbcf6 *amd64-linux.elf/upx-3.91
17a9aef8087ca2b3f5fc4e3a41d7c4d721bf3ad222030ac2068ed00eb85a9deb *arm-wince.pe/upx-3.91.exe
3ddbde0d00ff6ea9ce163d889e6f418146b35238d05005b98b76adb555bcf644 *armeb-linux.elf/upx-3.91
f680566e3daae0526c5f6965c23219d7946c4d4117eeaa277bd9e68e907418c6 *i386-dos32.djgpp2.coff/upx-3.91.exe
14394ce9806dc7a3622addfb625d1731e021600e0489dc7c8ea7f30c54d1fd37 *i386-linux.elf/upx-3.91
d3cfb5347758ee54e54cfc92ae502a3e19702cd4fec115d74f84f8a5ab7a9bc2 *i386-win32.pe/upx-3.91.exe
d0e68eed8f001f3074351acbc7133bd41f67f8e3b7e5f82d5df1911481123378 *m68k-atari.tos/upx-3.91.ttp
58db1b12b5462dbb05c08d7952cacd7c7090a6b3cbfbf9b431e6390f246cbb95 *mipsel-linux.elf/upx-3.91
4fd2e2fc33563e95453f9b4a52c153f248937a548cbfe746bb0d71f19ae5ad03 *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
e537c1a28bea559cbe43cd23723443e2617316a40a6632927f6d94589f800efe *amd64-linux.elf/upx-3.91
33a13fa63379b9eae6878cd2bfb0b41963795a27bc5a026de0b50b4a43131b12 *arm-wince.pe/upx-3.91.exe
3c6f9ab67e21c72073f66c558765d8f07f192ba63d3ffb2ce40ebc9178ccd5ef *armeb-linux.elf/upx-3.91
28bc9ee28b73b11a32fb2e4d3ad99ff06d61cf5b9f104052db89f6f6f0557ca9 *i386-dos32.djgpp2.coff/upx-3.91.exe
8201f15f7ef5e54cddb18474a5ed2d48e2fc7726d6014c457ad3cd82c01e1072 *i386-linux.elf/upx-3.91
5bebadb8455b052580b1f22a949c3eb5a441c8b6ba9c6b50506cb703fc3f65ce *i386-win32.pe/upx-3.91.exe
e4d3a430f93b41a3aa67492e6c06d74a1fcd4e06b272de2c681252d91b7a953a *m68k-atari.tos/upx-3.91.ttp
1bd8be4eb09dc39b4b0d447ef4eebac29c51d56380be79b46461962dea81b8fb *mipsel-linux.elf/upx-3.91
c1928cd500450f1f09f2c0265980c329cd0e083095abb3a48f1999a7dd551309 *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
3fadda0299775195558de2ac25a673ab65467bd147ab8aaf57b7af1542f1d5de *amd64-linux.elf/upx-3.91
99f7d8d7faf57c78053158c6a6915dab8c5cfdcc73112cee9607bcec55837ae8 *arm-wince.pe/upx-3.91.exe
8f06e11a0c60fd83db607089b7ad985a48a26ee09bd533e55072f9fe2ba39f2f *armeb-linux.elf/upx-3.91
542c368392f2d584145cc51d51b9dbc5dc61754597bb1cb7673821a2a4650816 *i386-dos32.djgpp2.coff/upx-3.91.exe
edf61800e09e0ef963b27fded0e032839f4b0cb907a84e43d19ed31bd536440f *i386-linux.elf/upx-3.91
ef5e25c79d356e9ed0736f34dc5ee7a8f4c66d0c330b8d16672fac7d829b5a7c *i386-win32.pe/upx-3.91.exe
2c85e506d670aef707789e5d8a97901ddbb42f50a205a207f575f79b901c2cd7 *m68k-atari.tos/upx-3.91.ttp
93014cd6edd07fafcae133b449837f550f92eeab86ceebd8e7ed5337ab65bdc2 *mipsel-linux.elf/upx-3.91
761f0d45b61e020fd8931cd5192677d06b34fec64a534d99be9fe0346eb56d2b *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t140_compress_lzma_2_no_filter="\
4abe4fff006e53ee147573d74a0f7feba9ebc62b8233e19ac331c5350391bd66 *amd64-linux.elf/upx-3.91
df8ad2d951368ddfb64b8c405f4b4727a2cf5f1c823ecd6e1d298eb21cad0afc *arm-wince.pe/upx-3.91.exe
cd109f76ff00030f564a883da5a57784d9626e85c2c54e6de1f0f2cfda709325 *armeb-linux.elf/upx-3.91
deeae51e0a4c25e6f5afd741361eea445c198fba247b583663b010778699419a *i386-dos32.djgpp2.coff/upx-3.91.exe
591d02bbb604aab55ed653411ea5888d3e93c5e078f3fc79f73d54b12bc83b22 *i386-linux.elf/upx-3.91
171bde9f27a5571b524e9d7cdba6cefa142bb8a0b114c4d5294944ee5781e0bb *i386-win32.pe/upx-3.91.exe
54ca62d5f15ce87708867f7b349584799779711bca015a3ebac69f5cf077b905 *m68k-atari.tos/upx-3.91.ttp
bc9c9ce0ce7ce32e3f77fca39ffdd7809731e93f978fb201ea49b53a980c5d4e *mipsel-linux.elf/upx-3.91
4357697b615fb40d041ad5a2217a4722aa9066d2100ba2c73212262f581f820f *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t150_compress_ucl_2_all_filters="\
15dd4ad982953a1f7b7c74e7cb34e777fc7db11201280cd5af19ac547c8b9a0f *amd64-linux.elf/upx-3.91
a8cd8c9abb50ab45f30bd2f01bcb4d2e934806440ef206d7da44097aced7085b *arm-wince.pe/upx-3.91.exe
c7af209eb44204a6e4ccbed18e1b3f6eaac5df01c1106426d375d1cd65cd01fd *armeb-linux.elf/upx-3.91
ea265e1f78c23beb632187bfebcb4ae15ce688f10e87db69952ab54724666042 *i386-dos32.djgpp2.coff/upx-3.91.exe
530a267e8fdae0f4b746df62d3f2d406c6bcb08a58058448b867e372dd4a6cc6 *i386-linux.elf/upx-3.91
7c3d7398f63eb9e235992d2d8fd6de9e355f6f21621c45032a6ae6c9009067e6 *i386-win32.pe/upx-3.91.exe
bf11d38e3a2cd2c585fdb2173368287e3d82edd5727ea3508c21752b2e7c5a53 *m68k-atari.tos/upx-3.91.ttp
271adf2c52ed777c00a17a19283478e226d76181b1dfb72d6c3aead3923fbad4 *mipsel-linux.elf/upx-3.91
a0152edb1476dc0f713bcd55a7462de200e92e7d057ff4a9af92c7af6abbc3bc *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t160_compress_all_methods_1_no_filter="\
16d2a30dd00dfd38d3aba417a087a7341314fa8f5769f8c87565728f2f2bf06a *amd64-linux.elf/upx-3.91
560335ec9f89f2cb8b2a2cff51b4d3dee215c68ecfc0a182fab4a838fafee166 *arm-wince.pe/upx-3.91.exe
b3b0a0c277e947cfc19048e142e71c902cfe6d77931b2a1caeba63b9449aa8c7 *armeb-linux.elf/upx-3.91
d5f89d57c0d74923e557410e1b5ec135e3853985965bfe9fd38283851896b4c9 *i386-dos32.djgpp2.coff/upx-3.91.exe
e6586de002ae8ccda77d9088e37412c1069626e807d81722c1cd810a8a7367e6 *i386-linux.elf/upx-3.91
4c73a38e81fe12f36dc37e514f8580c12bdf5d8cb92e9a07b7070db291a2f7eb *i386-win32.pe/upx-3.91.exe
53d9857238472bf4e2822134e8d63c11d6ed32f83615bb7491ba4441ff55c6c2 *m68k-atari.tos/upx-3.91.ttp
6b11b762f1dbf07e3135a2ccfbf558d44f4743e23e73ce7c143396b26ae49c4d *mipsel-linux.elf/upx-3.91
96bcf3f5f0f5168d5cdfc01dee5d35e77e0eb8401ae6623ab559254cc99ffbdc *powerpc-linux.elf/upx-3.91
"
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
3ded78e90066b688f820a35fe10270c2d3c00bc4c09d02f811b14a959003cd6b *amd64-linux.elf/upx-3.91
6f70c268d4686a50db2843efc58ef547048d8ed0d758bad0c95a50b3ce155a1f *arm-wince.pe/upx-3.91.exe
20acc14939776fcd2e643cea83075d84a764fb12942ce52fa0e72dc313df026b *armeb-linux.elf/upx-3.91
45ae9d42b5c6f1eec0ebc75e656c767efe796719b00922ba9e8095ffa5373450 *i386-dos32.djgpp2.coff/upx-3.91.exe
a6f13ec927d6a44fddd1af92190a530ff59282134080cd9881fef47b34e262f2 *i386-linux.elf/upx-3.91
14b192b5419ca0ec2b3f238dc6ed9c17596e82ff2674a299d4b0a76d118a73de *i386-win32.pe/upx-3.91.exe
0c341752253e2c530f3dfefc1b4b3619f931f7e23f032a7feffeb192a6a3c373 *m68k-atari.tos/upx-3.91.ttp
24887c6e98651b663cf04720bf7467501fa260a86ae8f83507669cce05d4b8bf *mipsel-linux.elf/upx-3.91
22947eb320540740b012aa53e85b99b038d5c4bf0ebcd28ea76c1c4f9018878f *powerpc-linux.elf/upx-3.91
"
########## end .sha256sums.recreate
# /***********************************************************************
# // init
# ************************************************************************/
#set -x # debug
exit_code=0
num_errors=0
all_errors=
if [[ $BM_T =~ (^|\+)ALLOW_FAIL($|\+) ]]; then
echo "ALLOW_FAIL"
set +e
fi
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.out ]] && upx_exe=$upx_BUILDDIR/upx.out
[[ -z $upx_exe && -f $upx_BUILDDIR/upx.exe ]] && upx_exe=$upx_BUILDDIR/upx.exe
if [[ -z $upx_exe ]]; then exit 1; fi
upx_run=$upx_exe
if [[ $BM_T =~ (^|\+)qemu($|\+) && -n $upx_qemu ]]; then
upx_run="$upx_qemu $upx_qemu_flags -- $upx_exe"
fi
if [[ $BM_T =~ (^|\+)wine($|\+) && -n $upx_wine ]]; then
upx_run="$upx_wine $upx_wine_flags $upx_exe"
fi
if [[ $BM_T =~ (^|\+)valgrind($|\+) ]]; then
if [[ -z $upx_valgrind ]]; then
upx_valgrind="valgrind"
fi
if [[ -z $upx_valgrind_flags ]]; then
#upx_valgrind_flags="--leak-check=full --show-reachable=yes"
#upx_valgrind_flags="-q --leak-check=no --error-exitcode=1"
upx_valgrind_flags="--leak-check=no --error-exitcode=1"
fi
upx_run="$upx_valgrind $upx_valgrind_flags $upx_exe"
fi
if [[ $BM_B =~ (^|\+)coverage($|\+) ]]; then
(cd / && cd $upx_BUILDDIR && lcov -d . --zerocounters)
fi
export UPX="--prefer-ucl --no-color --no-progress"
# let's go
if ! $upx_run --version; then echo "UPX-ERROR: FATAL: upx --version FAILED"; exit 1; fi
if ! $upx_run -L >/dev/null 2>&1; then echo "UPX-ERROR: FATAL: upx -L FAILED"; exit 1; fi
if ! $upx_run --help >/dev/null; then echo "UPX-ERROR: FATAL: upx --help FAILED"; exit 1; fi
rm -rf ./testsuite_1
mkbuilddirs testsuite_1
cd testsuite_1 || exit 1
# /***********************************************************************
# // decompression tests
# ************************************************************************/
testdir=t010_decompressed
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
testsuite_header $testdir
for f in $upx_testsuite_SRCDIR/files/packed/*/upx-3.91*; do
testsuite_split_f $f
[[ -z $fb ]] && continue
echo "# $f"
mkdir -p $testdir/$fsubdir
$upx_run -qq -d $f -o $testdir/$fsubdir/$fb
done
testsuite_check_sha $testdir
# run one pack+unpack step to canonicalize the files
testdir=t020_canonicalized
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
testsuite_header $testdir
for f in t010_decompressed/*/*; do
testsuite_split_f $f
[[ -z $fb ]] && continue
echo "# $f"
mkdir -p $testdir/$fsubdir/.packed
$upx_run -qq --prefer-ucl -1 $f -o $testdir/$fsubdir/.packed/$fb
$upx_run -qq -d $testdir/$fsubdir/.packed/$fb -o $testdir/$fsubdir/$fb
done
testsuite_check_sha $testdir
# /***********************************************************************
# // compression tests
# // info: we use fast compression levels because we want to
# // test UPX and not the compression libraries
# ************************************************************************/
testdir=t110_compress_ucl_nrv2b_3_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --nrv2b -3 --no-filter
testdir=t120_compress_ucl_nrv2d_3_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --nrv2d -3 --no-filter
testdir=t130_compress_ucl_nrv2e_3_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --nrv2e -3 --no-filter
testdir=t140_compress_lzma_2_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --lzma -2 --no-filter
testdir=t150_compress_ucl_2_all_filters
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress -2 --all-filters
testdir=t160_compress_all_methods_1_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --all-methods -1 --no-filter
testdir=t170_compress_all_methods_no_lzma_5_no_filter
mkdir $testdir; v=expected_sha256sums__$testdir; echo -n "${!v}" >$testdir/.sha256sums.expected
time testsuite_run_compress --all-methods --no-lzma -5 --no-filter
# /***********************************************************************
# // summary
# ************************************************************************/
# recreate checkums from current version for an easy update in case of changes
recreate_expected_sha256sums .sha256sums.recreate
testsuite_header "UPX testsuite summary"
if ! $upx_run --version; then
echo "UPX-ERROR: upx --version FAILED"
exit 1
fi
echo
echo "upx_exe='$upx_exe'"
if [[ "$upx_run" != "$upx_exe" ]]; then
echo "upx_run='$upx_run'"
fi
if [[ -f "$upx_exe" ]]; then
ls -l "$upx_exe"
file "$upx_exe" || true
fi
echo "upx_testsuite_SRCDIR='$upx_testsuite_SRCDIR'"
echo "upx_testsuite_BUILDDIR='$upx_testsuite_BUILDDIR'"
echo ".sha256sums.{expected,current}:"
cat */.sha256sums.expected | LC_ALL=C sort | wc
cat */.sha256sums.current | LC_ALL=C sort | wc
echo
if [[ $exit_code == 0 ]]; then
echo "UPX testsuite passed. All done."
else
echo "UPX-ERROR: UPX testsuite FAILED:${all_errors}"
echo "UPX-ERROR: UPX testsuite FAILED with $num_errors error(s). See log file."
fi
exit $exit_code
@@ -0,0 +1,68 @@
uqz4mAtKkF5Ex7Zt2tRP9mhQsAYn5+Xbupfuhee/s+2yVdBBdlXXRN2Q2AhMxF01
myhEuAtRNoQ4m7eyNgNU01pKb+dlyw2xiS+izm9+5fxuuEZfiuv76tQToQLltSdq
jP3Gt08MloJGcWraFiAXXji0S45MasJO3VOdygz09PbzIvGVp/NskGCMCU9lJlRt
2CsItWR+iHs6HNurWEKtEZz4qR8+HZ6RU5IquOnnHnI357lVUiC1w2qRcxmNVWuI
qS7GPvgisv0m4XMxe+l4L3b6a7laZr/hqHjFQqu/aO9Kmy5WmYRe3Bx4hTv5vqRi
OBDOUzwUcrdlUu2wqcvZhVxPaxxqA5u8G63Z3O30VCtWPZVU4yx9TRzcy/0lwxol
dw1b5t7Bl8uIzNyLsFMVS1MpnBspUrxBko6TqLAhv/DvUQmWGJRkP4Ar9naB4myS
vX6sim+Jn57Fr8aZMlvJbqlNindjxnX6+13u51C80GaYJBjHLkAIPaTTNLviOWpj
rbACDifaFloAsgJqz0KK/T7eohJBH2jVe2d9YxU6wZq6THDKJaeQ+nG5MWYvlkWa
K3N+jN8KI1GWqNpUtD8rbLPY1UZo05wQFZBCfdvEZoYdzJFVIS3t6kr0/gOIZu0D
AAIfIcopnpWpUk52MOEekzRRjJuF8fUMkiPX1oVs9HMKW+TU+yx/sFia+ke76w3i
1oiHKJJJNaoCjQXlAcT40rGLmSTLgL0ACCWIMGjK1QJYkpER8GCBCh9/whrJ3k1Q
0hm5hYiGty2ysRJFLIFPkYjangz7hIVzgOUSTYhVjJmIA62W2LmNKcixGX+sssCJ
/DK/Zs0uPiEX4gjkiomDksn7Dy8vAtHe7PzWpZA83mgPK+6zxoM6dgpM7FSe5q1/
tyf394l4nB7eayRUnx3NfK2/PTwrJcms5yAD9Hm2h72cp26TXh+RDVYWOgVX5/N0
dIsDRYo+/077pRTKwiCPrMxTxys53HHV7r5APd+FPmxikXvuszZvYTZ9K2MZB/1L
S2MCJ/u4GTTCwcbvfEjKVs3Fbqu7c2D/tVzakVEmMXloEAGPN/NrzOJsMMEDhWiw
g1wneAg5qF5nG+7R5WqstAeaRCYdXl46xay7iePZQ7viwHA8Zjuke18eHmh7J5jz
uzdh81rxCL3beoXb+BEr1/yKWfrJVTl33+m6c+zxdrV0B7O/ijlYxjke7Wo+ESac
WM2a4xU/WgXMi2+83XqcSZcRPdusZKA6bcTvAcYc/r8t7O1wjfPsTVj0WaM2DwL0
P1QTU4INmVn94zIV0+fGfyN0qI3YiS5iuOoPwLOVB13YECIyXnZz2/VJF7ZASOpS
701or4uF7GVEZxw19ow0AQttk6J/bEzbr7rZ5Um1yCMeQQ1TMHepJfuUbxle4W4S
8w8yC/Ytcy/e4rbiLG2/cY5b35LxtH1TCuaEtuiqa7vkmzr36qqD6fRWnXWC9QdR
0nWyJNj0xIIyMyilnBY2clAjDdT9qd2tMfpoz9hyBkTZPltzDw6Xd/IhhyL1URav
h0NCABGqXbpg8q7KCrIzIE6dJIh+7glfQuWkynmInntN4+fqk9Ked0haHkq5oGH5
vN5ZQNWPyQ67LaXQ4kW8iksgkgl7JEQsuie8oMuQZe13D4S3PWGFKchrBFGwN2xY
ut2+PCs5Al2BHU0qaCKdV7nCqv2tPC8G4uXNw081R2KwyoRlbKhowgFBYBTQIobJ
pc1GLU7HKm9tC61xIZ4u9oij/Bz1+gxx9vLxfx++EC/8UI23oMGygaYdda4gdEtm
v1wt8ldpzO4owI+9peFSolGLwKztwSPxln+5bvOsdsaZ6z5uW37N5ch/EwSwdmfo
Sm1i7fv/zQuZjmZkJXRJGvTd+sKdu7+IZUrTpu5W+jUfMAgmPc+AuYmSOn00K9dv
IJKY973ggNDaJKEw1uKzckl9uk/HRrgk+wgZPaWVRhOulj1npyFf+WmrZ2r3nTq0
koEI8UEselRuKJmojl4O0bz8fXZNgPtpLB/A0cdrj0Ist5TR+qRW9h3eSsybDYRS
GWP4UzFLAIwHflwNX0Q+9/u0uOxaXX6dKXzoddWksInBzh1pmQfrtUM3y7bHQYG5
zqnAMNMwm4WmtmF/mpjg0fKpiwFUU1geygkOwUsaK5Qcp5F0FPocdPRWVxUG0t3Y
QsmSpU5STb99YCs4TvhfUnQmdB2r+d0pZhlMte3v5lcpekSb2FxbUwdX3t9S2uGy
ho9CYmUj1+8ivUizjTLirOu/B8ohQT6kwvNqRSiQwU+YPa5DpxA1DYamIg6ehuX5
6u/dF4Eht+Cn6hasyzFviIUnV1y4ixLfSb0EGw+YoLbHgr8X4Uv4guaNQduKJyEu
g6p1v40fDhZ8AuQly+BOLL0yBlQoDrkY9+3HcIZAC5NmJFU5hle4Hz4gLzS6DwXo
2u8tqIELdtP9Zo4SKM7/yNy+rjl2RNRUEUNjidZsWuIC4bEeL3sUImP0Wt+zpdV0
y0RK1/wPW4dES5xFTCUp9xdP08dsSMtIrYJeBXbHrTZswnuOvk4MYGpmn/qy+qwc
GnkJtzJVm+uNspYuD0cW+JbJz5T+w1eNbejjZ+QVhqmE7ctSHndQUSueIyOcm79E
23jLzIoHMSHsiBJ8KeHN5bTfe66Gl8y3LIOpfchYd5XzkqxS7M01PxkWGZDWGYdl
6Gx64mg7ojPrSNaOzAu3da8oLvGi/YIf3wdJenZqiTzBnSzRsBnTpohQddHbB1Hj
uogDJSoad0ZSY0lLcvxncPB29hKpljFZ4IHO2UKOyO9+LFKsfK8/RbdSx/sHcUaH
hblVkVTSRReHmShxSw6abYZHivGNV0tXNXkY6uEzOMe+Vck9j9dTBSK0bFS/2Xdd
ZII/KFQH10+WEYyw+FurMUeVwU/FER4qpy+13r1PjxMSHfnJviEb8EjgvrcwAUDX
G9JNVtL4Vui6NMFV1u2qkbEMZK763YAIKYZC9UZYjbbhhgYTTMEfRcNvwVCix8nH
2TlWGhivuw5abE9QFduT1fHXJL+1uCn2GMhS8v3fxUrnGDQFit0YLlGEMm5/wVaM
PIZH5JDHlINUC0vbUrMXCz8Ztg3qhpOLiExlBHTD4vqYt9kniHLXOQfexegSC85C
AKiugEOdoHHYJGjNyXj6c0jTuMAe0CBwAKddUqPQztoKclNb02G2a9l5ColE29Uz
jXAb8PFANNqn4Nnm6oPPF1KxB45vLdT6+F1SRzXZunJ6p9N4E9KBtEOR+ixlcphL
InLJSg5iKTfWhXlSK6eldvVsP2GeoyjliERsKLgq1YGMiCW076dmoxR2Z5iPlD2V
G7Hz5nWjPBIoFhABEnONDxbrYB6ryeunILYcHpAaXSYq4OueRo6QGO8NRqFcNutG
WpwBfIlnu6rl9MDO053SJ1ah6D97n/D5aQa2JMMha0faZz84+MH3cnudAgpPjsG9
9G/2fEP08lQNAFiyY91wW3Mtj2No9+OJVYmwFORJm7IOu5nfuQZbzz9OFPcZLU5Y
DVo86icZgXayytW2XZtCKzVBDse+yi0xblGSNtwHlQIN8gKDVpa0I34DxUkIn1Cl
bk9S6+m6APF9ynN/kVCwMu9Nq3lwzmY6JCb/KX0d66uyVwYG3BN1UEWqJhDJjGep
a2JmHnG1aVhYaE/2EsOc+YP89Oub+KeuCj2dHJj2dH3QDCjr2xZUbLO7mw1tsATH
dPjNEBvxet9UU/RXqhhkfkv1XGr/umWrkjKbFqDNl5Tav/00+I59rboW7C/cWRxN
CVbadLPJlPNRR8+54G+VkDZgqaQprPwYih5a7d2MEzrMtZbU0uCJc839dqMgsf++
k4maampkcDLhxt8bBg43WoDgWxiQ+KVWyEBGmTOT2q4WYeLI9PZLseA9eNJbpt9J
oxtNNdqkU48YZWsq/3L1L0eXdGvv5TIMto4bH3SWuvQ2sepwMRxxwTg8qFrutk9K
OLOUbO1Z2ivh1g6+DAgs3RFmy9hPzzqPmJk8cL6F5tcd/VwGcow3UBJ1+Xn3SE5Y
UCHNrSfSrvDaA3N8jyvS/uPq0qRgp7LQRqrhh5cVPi67goDx/ku/fVbMbcrarO/e
Czv6CX7Id2QliOSMGGVId+ECXBvuIGAb2d4til+zTnfhBE2+uS5WQ7MjzH9PKZ7n
TDuV36mA1FDCX+WShPau7R0SGXSqKyeHJ8XSuFHbGwr1Zxwoq4GBYIcAxWjp9HA4
dhBE2x5WSTbnqh1sClxfOeE8MHxi+EUonCcvfvm30NOcC4zw1dCDc6SKLoMJYrFz
EdR3Kt1SJ9M0Jl3dD/gCTKG5kObJzqmo9BladIpQt6c=
+58
View File
@@ -0,0 +1,58 @@
/.bzr*
/.hg*
/.vscode*
/Makevars.global*
/build*
/maint*
.depend
GNUmakefile
MMakefile
Makevars.local*
tmp-testsuite*
*.a
*.dll
*.lib
*.py[cdo]
*.so
*.swp
doc/*.1
doc/*.doc
doc/*.html
doc/*.man
doc/*.ps
doc/*.tex
src/compress_nrv*
src/*.mft
src/*.rc
src/*.d
src/*.exe
src/*.map
src/*.o
src/*.obj
src/*.out
src/*.res
src/*.ttp
src/stub/**/.*-stamp
src/stub/**/MMakefile
src/stub/tmp*/*.bin
src/stub/tmp*/*.bin.bindump
src/stub/tmp*/*.bin.disasm
src/stub/tmp*/*.d
src/stub/tmp*/*.o
src/stub/tmp*/*.o.disasm
src/stub/tmp*/mips.r3000-*.[is]
src/stub/tmp*/mipsel.r3000-*.[is]
src/stub/src/**/tmp*/*
src/stub/tools/armpe/armpe_tester.exe
src/stub/tools/armpe/armpe_tester.out
src/stub/tools/sstrip/amd64-linux-sstrip
src/stub/tools/sstrip/i386-linux-sstrip
src/stub/tools/sstrip/sstrip
+4
View File
@@ -0,0 +1,4 @@
[submodule "src/lzma-sdk"]
path = src/lzma-sdk
url = https://github.com/upx/upx-lzma-sdk.git
branch = master
-51
View File
@@ -1,51 +0,0 @@
syntax: regexp
^\.bzr
^ChangeLog
^Makevars.global
^build
^maint
syntax: glob
Makevars.local
*.a
*.dll
*.lib
*.py[cdo]
*.so
*.swp
doc/*.1
doc/*.doc
doc/*.html
doc/*.man
doc/*.ps
doc/*.tex
src/GNUmakefile
src/MMakefile
src/compress_nrv*
src/*.mft
src/*.rc
src/*.d
src/*.exe
src/*.map
src/*.o
src/*.obj
src/*.out
src/*.res
src/*.ttp
stub/**MMakefile
stub/**.*-stamp
stub/tmp*/*
stub/**/tmp*/*
stub/tools/armpe/armpe_tester
stub/tools/sstrip/amd64-linux-sstrip
stub/tools/sstrip/i386-linux-sstrip
stub/tools/sstrip/sstrip
-15
View File
@@ -1,15 +0,0 @@
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
223ac5b23f9731ceac9ff8d65167df4900776e36 RELEASE_190
2c753c5bf38e7322715e2a5c6c5381111bd7a61a RELEASE_194
2ee65b77f9117651e2e5517b2edede23698d73ca RELEASE_196
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
a935d577fc7dd9c2c87761c9c702805da6ce1e51 RELEASE_193
b0353253b0b3d062eb5adb50d4b665a96620da45 RELEASE_195
b82ef51896199484afe5b0553af7d1e59b7ce428 BRANCHPOINT_FOR_upx2.hg
c2e0cd4d621b047f254f2def42132a03683ff52c RELEASE_192
d276aa09033c24d0981bc3f4fee5628aecc988ad RELEASE_290
eb1ce56dce7dd1835964362470610925963b9043 RELEASE_110
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
+295
View File
@@ -0,0 +1,295 @@
# Support for Travis CI -- https://travis-ci.org/upx/upx/builds
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
sudo: false
dist: precise
language: cpp
notifications: { email: { on_success: never, on_failure: change } }
# Ubuntu 12.04 LTS "Precise"
.ubuntu_precise_toolchain_sources: &PS
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.5
- llvm-toolchain-precise-3.6
- llvm-toolchain-precise-3.7
- llvm-toolchain-precise-3.8
- llvm-toolchain-precise-3.9
# Ubuntu 14.04 LTS "Trusty"
.ubuntu_trusty_toolchain_sources: &TS
- ubuntu-toolchain-r-test
- llvm-toolchain-trusty-5.0
env:
global:
- CROSS= C= B= T= X=
- secure: "YXHLXK+CM5d8yELIUSSs+P0/CoefClO7/AUX1oBj5W75g+YzR5uS2doVsB8UH8S8/GdNxk4P9Jgn4EiEVnjfGgn2eAD9MVpDPIxyJs5vI+5G77asq3QNdSl6QFv3O9I/6yBoVCewgPFPqsMd7Yvs/Ea3LcQkqalVhrC8ybYtmfs6VL2w33gn2J3b3TCn/s21L0ijklM0xvP1GNMDtuUpTSish5wvGOHE/91rwtdUDbJR8u31QY7fTASDiNnL/7ihgEIZ5XxpDYXviX1GC+nemhX1fWpmVmuT8m30Ruodi0yJVGASw9i2SaKv/VX/fJ/w2vlCfspL5LMZKkVLlfpIo3mQGqmMHFxv7mNy+hRu50ptoWNSkWArcqifwveh2liHUpl4jTvWaVll5Tw5VUGJhAUdzCTnqLIbWFnKIgCedL3iRFi4+EbyWNxel8lFESMOTDZFfJG5yEiDJbgbLsUaT2GmrsOphwAG7zDcZzvYTdjg/lF4Wh0MUnQJ+0MhDpii8Ahjp49lAPdw8uRQyyY7d7ksYKXVIkbgl6dRCC5vZSPucJiFjq2BClqIoEmzZPvHveDbovzFkNhJX9tFLrHLcXbPPcegww1FGoQ3wBM6JwJ+TvSD6N4OdCmou05aDuuQeznHi3GxOScjGwxdMIU28fdJDCTDg2rOihm22kHVajo="
- secure: "JpSv3+QRmHcfN/bmT3mVkqET44NCPhM/qpcUssCVXnd2GW0qWURoyPHzVMn/gbeAkUjR6djtN3OzJ+M181QmlmTmE26pZC9Q6r1buNDWdkIH1FcpMCa67BBAjmq+yDwulDtvCMv0lbz60v57lzHBOLczF3yMxBVTjXxt1RsrzDLHzzVaDR5lEe+sQUNeRL7Vaq8crimPNTr4ZhMe59eweTO/3AWovuSPf250k1flfv7I8audZgrVZdbVKvj5C3Sziy1AGXcu8mDfET9/Ya2XBCQHWODjiKlnhSxqthhP3gQuacaLjpS2FjvQlamd+I9x6BBoLSeNbiXD9vgCydDUKvmUrU+zQs64U1hHk9WZWVC19kG7lTtTdanGDIUlIUtFZgqE4AQpJaIUWkUmHGyHi61JMvduzX21eL5c5j9DoJteX42FPb1n3xK/JSnUkLMpbFdQuy5inhzefhDfeNzaYxt8nPwHnJqrF73SW4PLDKeRyzvg/P+zqcou8nXrHfA1z9/FlnYzf7Qc9meai9Q/JARX3Q1ZKu5uyG+RuBLe2POq0192w6pflTr1ZlLJsKNSc1147PviKfmpla1lg3/6uVzMp5tgwbve/hx9SDXiRueGttKw/ymsY662+8G24NRKo4fxNklWFHaB4owM84edDzXDckPXbPgue8/HQT8BFio="
matrix:
fast_finish: true
include:
- os: linux
dist: trusty
compiler: gcc
env: X=rebuild-stubs
addons: { apt: { packages: [ "g++-multilib", "lib32z1" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.4-m32
addons: { apt: { sources: *PS, packages: [ "g++-4.4-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.4-m64
addons: { apt: { sources: *PS, packages: [ "g++-4.4" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.5-m32
addons: { apt: { sources: *PS, packages: [ "g++-4.5-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.5-m64
addons: { apt: { sources: *PS, packages: [ "g++-4.5" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.6-m32
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.6-m64
- os: linux
compiler: gcc
env: C=gcc-4.7-m32
addons: { apt: { sources: *PS, packages: [ "g++-4.7-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.7-m64
addons: { apt: { sources: *PS, packages: [ "g++-4.7" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.8-m32
addons: { apt: { sources: *PS, packages: [ "g++-4.8-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.8-m64
addons: { apt: { sources: *PS, packages: [ "g++-4.8" ] } }
- os: linux
dist: trusty
compiler: gcc
env: C=gcc-4.8-mx32
addons: { apt: { packages: [ "g++-multilib", "libx32stdc++-4.8-dev" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.9-m32
addons: { apt: { sources: *PS, packages: [ "g++-4.9-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-4.9-m64
addons: { apt: { sources: *PS, packages: [ "g++-4.9" ] } }
- os: linux
compiler: gcc
env: C=gcc-5-m32
addons: { apt: { sources: *PS, packages: [ "g++-5-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-5-m64
addons: { apt: { sources: *PS, packages: [ "g++-5" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m32
addons: { apt: { sources: *PS, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m64
addons: { apt: { sources: *PS, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m32 B=debug
addons: { apt: { sources: *PS, packages: [ "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m64 B=debug
addons: { apt: { sources: *PS, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m64 B=debug+sanitize
addons: { apt: { sources: *PS, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m64 B=sanitize
addons: { apt: { sources: *PS, packages: [ "g++-6" ] } }
- os: linux
compiler: gcc
env: C=gcc-6-m64 B=valgrind T=valgrind
addons: { apt: { sources: *PS, packages: [ "g++-6", valgrind ] } }
- os: linux
dist: trusty
compiler: gcc
env: C=gcc-7-m32
addons: { apt: { sources: *TS, packages: [ "g++-7-multilib", "zlib1g-dev:i386" ] } }
- os: linux
dist: trusty
compiler: gcc
env: C=gcc-7-m64
addons: { apt: { sources: *TS, packages: [ "g++-7" ] } }
- os: linux
compiler: clang
env: C=clang-3.4-m32
addons: { apt: { packages: [ "g++-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.4-m64
- os: linux
compiler: clang
env: C=clang-3.5-m32
addons: { apt: { sources: *PS, packages: [ "clang-3.5", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.5-m64
addons: { apt: { sources: *PS, packages: [ "clang-3.5" ] } }
- os: linux
compiler: clang
env: C=clang-3.6-m32
addons: { apt: { sources: *PS, packages: [ "clang-3.6", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.6-m64
addons: { apt: { sources: *PS, packages: [ "clang-3.6" ] } }
- os: linux
compiler: clang
env: C=clang-3.7-m32
addons: { apt: { sources: *PS, packages: [ "clang-3.7", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.7-m64
addons: { apt: { sources: *PS, packages: [ "clang-3.7" ] } }
- os: linux
compiler: clang
env: C=clang-3.8-m32
addons: { apt: { sources: *PS, packages: [ "clang-3.8", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.8-m64
addons: { apt: { sources: *PS, packages: [ "clang-3.8" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m32
addons: { apt: { sources: *PS, packages: [ "clang-3.9", "g++-6-multilib", "zlib1g-dev:i386" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m64
addons: { apt: { sources: *PS, packages: [ "clang-3.9" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m64 B=debug+sanitize
addons: { apt: { sources: *PS, packages: [ "clang-3.9" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m64 B=sanitize
addons: { apt: { sources: *PS, packages: [ "clang-3.9" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m64 B=debug+scan-build
addons: { apt: { sources: *PS, packages: [ "clang-3.9" ] } }
- os: linux
compiler: clang
env: C=clang-3.9-m64 B=scan-build
addons: { apt: { sources: *PS, packages: [ "clang-3.9" ] } }
- os: linux
dist: trusty
compiler: clang
env: C=clang-5.0-m32
addons: { apt: { sources: *TS, packages: [ "clang-5.0", "g++-7-multilib", "zlib1g-dev:i386" ] } }
- os: linux
dist: trusty
compiler: clang
env: C=clang-5.0-m64
addons: { apt: { sources: *TS, packages: [ "clang-5.0" ] } }
- os: linux
compiler: gcc
env: CROSS=arm-linux-gnueabi C=gcc-4.6 T=qemu
addons: { apt: { packages: [ "g++-arm-linux-gnueabi", "qemu-user" ] } }
- os: linux
compiler: gcc
env: CROSS=arm-linux-gnueabihf C=gcc-4.6 T=qemu
addons: { apt: { packages: [ "g++-arm-linux-gnueabihf", "qemu-user" ] } }
- os: linux
compiler: gcc
env: CROSS=i386-w64-mingw32 C=gcc-4.6 T=wine
addons: { apt: { packages: [ "binutils-mingw-w64-i686", "g++-mingw-w64-i686", "wine" ] } }
- os: linux
compiler: gcc
env: CROSS=x86_64-w64-mingw32 C=gcc-4.6 T=wine
addons: { apt: { packages: [ "binutils-mingw-w64-x86-64", "g++-mingw-w64-x86-64", "wine" ] } }
- os: osx
osx_image: xcode6.4
compiler: clang
# must use debug build or else we get "ld: internal error: atom not found" when linking
env: C=clang-602-m32 B=debug
- os: osx
osx_image: xcode6.4
compiler: clang
# must use debug build or else we get "ld: internal error: atom not found" when linking
env: C=clang-602-m64 B=debug
- os: osx
osx_image: xcode7.3
compiler: clang
env: C=clang-703-m32
- os: osx
osx_image: xcode7.3
compiler: clang
env: C=clang-703-m64
- os: osx
osx_image: xcode8.3
compiler: clang
env: C=clang-802-m32
- os: osx
osx_image: xcode8.3
compiler: clang
env: C=clang-802-m64
- os: osx
osx_image: xcode9.2
compiler: clang
env: C=clang-900-m32
- os: osx
osx_image: xcode9.2
compiler: clang
env: C=clang-900-m64
install:
- uname -a; pwd; id; umask
- cat /etc/os-release || true
- |
cd /
if [[ $TRAVIS_OS_NAME == linux ]]; then
if [[ $B =~ (^|\+)coverage($|\+) ]]; then
travis_retry pip install --user cpp-coveralls
fi
fi
if [[ $TRAVIS_OS_NAME == osx ]]; then
if ! gsha256sum </bin/sh >/dev/null 2>/dev/null; then travis_retry brew install coreutils; fi
if [[ $B =~ (^|\+)coverage($|\+) ]]; then
travis_retry brew install lcov
travis_retry pip install --user cpp-coveralls
fi
fi
- git --version && bash --version
- umask 022; cd $TRAVIS_BUILD_DIR && mkdir -p ../deps ../build/travis
- cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/ucl-1.03.tar.xz | tar -xJ
- cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx/releases/download/v3.00/zlib-1.2.8.tar.xz | tar -xJ
- cd ../deps && travis_retry git clone https://github.com/upx/upx-testsuite
- |
if [[ $X =~ (^|\+)rebuild-stubs($|\+) ]]; then
cd ../deps && travis_retry wget -q -O - https://github.com/upx/upx-stubtools/releases/download/v20160918/bin-upx-20160918.tar.xz | tar -xJ
fi
script:
- success=1
- cd $TRAVIS_BUILD_DIR || success=0
- test $success = 0 || bash ./.github/travis_build.sh || success=0
- test $success = 0 || bash ./.github/travis_testsuite_1.sh || success=0
- test $success = 0 || bash ./.github/travis_deploy.sh || success=0
- test $success = 1
# vim:set ts=2 sw=2 et:
+4 -4
View File
@@ -8,8 +8,8 @@
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
Limitations and other things which are not (yet) supported:
@@ -28,7 +28,7 @@ dos/exe
watcom/le
---------
* 16-bit selector alias fixups
* 16-bit offset relocation for objects larger than 4 kB
* 16-bit offset relocation for objects larger than 4 KiB
* 16:16 fixups
If you need any of the above (they're very rare), send us an URL of a
@@ -44,7 +44,7 @@ test file.
win32/pe
--------
* writeable shared sections (`--force' *may* work)
* writable shared sections (`--force' *may* work)
* certificates in the image
* compressing files which contain a big BSS requires lots of memory
during compression
+8 -19
View File
@@ -1,5 +1,7 @@
#
# UPX toplevel Makefile - needs GNU make 3.80 or better
# UPX toplevel Makefile - needs GNU make 3.81 or better
#
# Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
#
MAKEFLAGS += -rR
@@ -8,21 +10,16 @@ export SHELL = /bin/sh
srcdir = .
top_srcdir = .
-include $(top_srcdir)/Makevars.global ./Makevars.local
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
# info: src/stub needs GNU make 3.81 and special build tools
# info: src/stub needs special build tools from https://github.com/upx/upx-stubtools
BUILD_STUB = 0
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),)
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/upx-stubtools-check-version),)
BUILD_STUB = 1
endif
ifneq ($(wildcard $(HOME)/bin/bin-upx/.),)
ifneq ($(wildcard $(HOME)/bin/bin-upx/upx-stubtools-check-version),)
BUILD_STUB = 1
endif
ifneq ($(findstring $(firstword $(MAKE_VERSION)),3.79 3.79.1 3.80),)
BUILD_STUB = 0
endif
default:
@echo "UPX info: please choose a target for 'make'"
@@ -34,14 +31,6 @@ endif
$(MAKE) -C src $@
$(MAKE) -C doc $@
ifneq ($(wildcard .hg/data/.),)
# automatically generate ChangeLog from local Mercurial repo
ChangeLog:
hg log --style=changelog > $@
.PHONY: ChangeLog
endif
.PHONY: default all mostlyclean clean distclean maintainer-clean
# vim:set ts=8 sw=8 noet:
+110 -1
View File
@@ -2,6 +2,115 @@
User visible changes for UPX
==================================================================
Changes in 3.95 (26 Aug 2018):
* Flag --android-shlib to work around bad design in Android
* Flag --force-pie when ET_DYN main program is not marked as DF_1_PIE
* Better compatibility with varying layout of address space on Linux
* Support for 4 PT_LOAD layout in ELF generated by binutils-2.31
* bug fixes, particularly better diagnosis of malformed input
* bug fixes - see https://github.com/upx/upx/milestone/4
Changes in 3.94 (12 May 2017):
* Add support for arm64-linux (aka "aarch64").
* Add support for --lzma compression on 64-bit PowerPC (Thierry Fauck).
* For Mach, "upx -d" will unpack a prefix of the file (and warn).
* Various improvements to the ELF formats.
* bug fixes - see https://github.com/upx/upx/milestone/3
Changes in 3.93 (29 Jan 2017):
* Fixed some win32/pe and win64/pe regressions introduced in 3.92
* bug fixes - see https://github.com/upx/upx/milestone/2
Changes in 3.92 (11 Dec 2016):
* INFO: UPX has moved to GitHub - the new home page is https://upx.github.io
* IMPORTANT: all PE formats: internal changes: reunited the diverged source
files - please report all regressions into the bug tracker and try UPX 3.91
in case of problems.
* Support Apple MacOS 10.12 "Sierra", including more-robust de-compression.
* Explicitly diagnose Go-language bad PT_LOAD; recommend hemfix.c.
https://sourceforge.net/p/upx/bugs/195/ https://github.com/pwaller/goupx
* Fix CERT-FI Case 829767 UPX command line tools segfaults.
Received by UPX Team on 2015-May-08; originally reported
by Codenomicon to NCSC-FI on 2015-01-08.
The vulnerabilities were discovered by Joonas Kuorilehto and
Antti Häyrynen from Codenomicon.
* bug fixes - see https://github.com/upx/upx/milestone/1
Changes in 3.91 (30 Sep 2013):
* Added experimental support for Windows 64-bit PE files, based on
work by Stefan Widmann. Please use for testing only!
* bug fixes
==================================================================
Changes in 3.09 (18 Feb 2013):
* New option --preserve-build-id for GNU ELF.
* Allow for code signing and LC_UUID on Mac OS X executables.
* Allow non-contiguous LC_SEGMENTs and 0==.vmsize for Mach-O.
* Allow zero-filled final page in PackUnix::canUnpack().
* bug fixes
Changes in 3.08 (12 Dec 2011):
* Fix allocation in runtime stub for darwin.macho-entry (i386 and amd64).
* Compress shared library on ELF i386 only [ld.so threatens even this case].
* Attempt to support ELF on QNX 6.3.0 for armel (experimental).
* Better diagnostic when ELF -fPIC is needed.
* PT_NOTE improvements for *BSD.
* Preserve more ELF .e_flags on ARM.
* Minor code improvements for ELF stubs.
* Defend against another flavor of corrupt PE header.
* bug fixes
Changes in 3.07 (08 Sep 2010):
* win32/pe: fixed relocation handling for files with *no* TLS callbacks
[severe bug introduced in 3.06]
Changes in 3.06 (04 Sep 2010):
* win32/pe: TLS callback support contributed by Stefan Widmann. Thanks!
* bug fixes
Changes in 3.05 (27 Apr 2010):
* i386-linux and amd64-linux support shared libraries (DT_INIT must
exist, all info needed by runtime loader must be first in .text, etc.)
* Linux /proc/self/exe now is preserved by default, by leaving behind
one page. New compress-time option --unmap-all-pages is available.
* Withdraw support for shared libraries on Darwin (Apple Mac OS X)
because upx does not understand enough about .dylib.
* bug fixes
Changes in 3.04 (27 Sep 2009):
* new format Mach/AMD64 supports 64-bit programs on Apple Macintosh.
* new formats Dylib/i386 and Dylib/ppc32 support shared libraries
[such as browser plugins] on Darwin (Apple Macintosh). An existing
-init function (LC_ROUTINES command) is required.
* new format vmlinuz/armel for Debian NSLU2 (etc.) linux kernel
* bvmlinuz boot protocol 2.08 for 386 Linux kernel
* Extended ABI version 4 for armel-eabi ARM Linux ELF
* bug fixes
Changes in 3.03 (27 Apr 2008):
* implement cache flushing for PowerPC (esp. model 440)
* fix cache flushing on MIPS (>3 MiB compressed, or with holes)
* fix MIPS big-endian
* bug fixes
Changes in 3.02 (16 Dec 2007):
* fix unmapping on arm-linux.elf
* fix error checking in mmap for i386-linux.elf [triggered by -fPIE]
* bug fixes
Changes in 3.01 (31 Jul 2007):
* new options --no-mode, --no-owner and --no-time to disable preservation
of mode (file permissions), file ownership and timestamps.
* dos/exe: fixed an incorrect error message caused by a bug in
relocation handling
* new format linux/mipsel supports ELF on [32-bit] R3000
* fix argv[0] on PowerPC with --lzma
* bug fixes
Changes in 3.00 (27 Apr 2007):
* watcom/le & tmt/adam: fixed a problem when using certain filters
Changes in 2.93 beta (08 Mar 2007):
* new formats Mach/i386 and Mach/fat support Mac OS X i686 and
Universal binaries [i686 and PowerPC only]
@@ -9,7 +118,7 @@ Changes in 2.93 beta (08 Mar 2007):
you have to explicitly use '--lzma' even for '--ultra-brute' here
because runtime decompression is about 30 times slower than NRV -
which is really noticeable on old machines.
* dos/exe: fixed a rarely occuring bug in relocation handling
* dos/exe: fixed a rarely occurring bug in relocation handling
* win32/pe & arm/pe: better icon compression handling
Changes in 2.92 beta (23 Jan 2007):
+2 -2
View File
@@ -8,8 +8,8 @@
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
Here are some possible projects from which you can choose if you'd like to
+10 -13
View File
@@ -8,8 +8,8 @@
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
@@ -81,12 +81,7 @@ Please report all problems or suggestions to the authors. Thanks.
THE FUTURE
==========
- We'd really love to support handheld systems like the PalmPilot because
compression makes a lot of sense here. And - because of the atari/tos
format - we already have a working decompressor in 68000 assembly.
Unfortunately we know next to nothing about the operating system
architecture of such handhelds, so we need some information from
an expert. Please contact us if you think you can help.
- AArch64 (64-bit ARM) for Linux and iOS.
- The Linux approach could probably get ported to a lot of other Unix
variants, at least for other i386 architectures it shouldn't be too
@@ -108,9 +103,9 @@ THE FUTURE
COPYRIGHT
=========
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
This program may be used freely, and you are welcome to
redistribute it under certain conditions.
@@ -125,12 +120,14 @@ with this program; see the file LICENSE. If not, visit the UPX home page.
Share and enjoy,
Markus & Laszlo
Markus & Laszlo & John
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@BitWagon.com>
[ The term UPX is a shorthand for the Ultimate Packer for eXecutables
+3 -10
View File
@@ -8,16 +8,8 @@
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
WARNING - UNSTABLE BETA VERSION
===============================
The current stable release is 2.02, and the next stable release
will be called version 3.00.
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
MAJOR NEWS IN UPX 3
@@ -29,3 +21,4 @@ The main news since UPX 2 are:
* better compression using the LZMA algorithm (option '--lzma')
* better support for MacOS
+16 -15
View File
@@ -61,15 +61,24 @@ Prerequisites
- first of all you need to build the UCL compression library
http://www.oberhumer.com/opensource/ucl/
Use "CC=gcc -std=gnu89" especially with gcc-6.3 and gcc-7.1.
To build for native aarch64 (64-bit ARM) the files config.guess
and config.sub must be updated according to the recipe at
https://www.gnu.org/software/gettext/manual/html_node/config_002eguess.html
Tools needed to build/modify the UPX sources
--------------------------------------------
- A C++ compiler supporting inner classes, templates, exceptions
and RTTI.
- A C++ compiler: gcc >= 3.3 or clang.
- GNU make 3.80 or better (GNU make 3.81 recommened).
- GNU make 3.81 or better
- zlib and zlib-devel [or zlib-dev] software packages for your
host environment
- LZMA SDK from https://github.com/upx/upx-lzma-sdk
When using git run 'git submodule update --init --recursive'.
To compile the packer sources
@@ -81,11 +90,6 @@ To compile the packer sources
set UPX_UCLDIR=c:\src\ucl-1.03 (DOS / Windows)
export UPX_UCLDIR=$HOME/local/src/ucl-1.03 (Unix)
Set the environment variable UPX_LZMADIR to point to your
to your unpacked lzma443.tar.bz2 source directory, e.g.
export UPX_LZMADIR=$HOME/local/src/lzma-4.43 (Unix)
Finally type
make
@@ -94,14 +98,11 @@ To compile the packer sources
If you want to modify the stub sources you'll also need
-------------------------------------------------------
- GNU make 3.81 or better
http://savannah.gnu.org/projects/make/
- Perl & Python
- A number of cross-assemblers and cross-compilers - precompiled
binaries for i386-linux hosts are available from
http://sourceforge.net/project/showfiles.php?group_id=2331
- upx-stubtools - a number of cross-assemblers and cross-compilers.
Precompiled binaries for i386-linux hosts are available from
https://github.com/upx/upx-stubtools/releases
Misc. notes
@@ -141,4 +142,4 @@ Patches/Contributions
diff -uNr olddirectory newdirectory
# vi:ts=4:et
# vim:set ts=4 sw=4 et:
+4 -2
View File
@@ -8,8 +8,8 @@
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
.___.. .
@@ -53,6 +53,8 @@ Ralph Roth <RalphRoth@gmx.net>
for reporting several bugs
Salvador Eduardo Tropea
for beta testing
Stefan Widmann
for the win32/pe TLS callback support
The WINE project (http://www.winehq.com/)
for lots of useful information found in their PE loader sources
Natascha
-114
View File
@@ -1,114 +0,0 @@
UPX TODO list. Last updated 2006-12-08.
IMPORTANT PROBLEMS THAT SHOULD BE FIXED SOON:
- [None]
OTHER:
- docs: convert docs from upx.pod to use AsciiDoc
- check all <const_cast> to make sure they are not invalid
- throwNotCompressible() is not a real error, so make the output nicer
(info: bla bla). Also ui.cpp (total_*).
-----------------------------------------------------------------------
IMPROVED COMPRESSION RATIO
==========================
- experiment with new filters
- implement filters for dos/exe
- filters: could we exploit a f->firstcall info field ?
- for small programs (e.g. < 64k), try an additional algorithm
to see if it gives better compression
ALL FORMATS
===========
- more thoroughly test the exe-header in canPack()
and throw exceptions when encountering bad values.
- implement `--cpu=486' option to use bswap on the 32-bit formats
(if cpu >= 486)
FORMAT DJGPP2/COFF
==================
- handle overlays
- fix default file extension handling when the --coff option is set
FORMAT DOS/EXE
==============
- implement filters
- add a check so that we don't pack djgpp1 binaries
FORMAT LINUX/386
================
- don't mmap() the temporary output file - this seems to improve
file io speed
FORMAT TMT/ADAM
===============
- the decompressors are already aligned, no need for an
extra alignment
FORMAT WATCOM/LE
================
- handle files without relocations
- the decompressors are already aligned, no need for an
extra alignment
- fix default file extension handling when the --le option is set
- handle holes in the file
FORMAT WIN16/NE
===============
- implement readFileHeader() to correctly identify a win16/ne
executable, so that the call for contribution will get thrown
FORMAT WIN32/PE
===============
- fix the section alignment with the Intel compiler
- decrease runtime memory overhead
3 - difficult) don't compress the BSS section and other holes.
4 - medium - ml) fix when objectalign < 0x1000
4 - easy - ml) put the original offset of moved resources somewhere into
the res.dir. (if it's safe to do)
4 - ??? - ml) fix FIXMEs
5 - medium - ml) try to put the preprocessed imports & relocs back to their
original section if possible. this could save some virtual memory
address space.
+7 -9
View File
@@ -1,5 +1,5 @@
#
# UPX doc Makefile - needs GNU make 3.80 or better
# UPX doc Makefile - needs GNU make 3.81 or better
#
MAKEFLAGS += -rR
@@ -12,14 +12,6 @@ empty :=
space := $(empty) $(empty)
tab := $(empty) $(empty)
# update $PATH for our special stub build tools
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/.),)
export PATH := $(HOME)/local/bin/bin-upx:$(PATH)
endif
ifneq ($(wildcard $(HOME)/bin/bin-upx/.),)
export PATH := $(HOME)/bin/bin-upx:$(PATH)
endif
# /***********************************************************************
# //
@@ -58,22 +50,28 @@ mostlyclean clean distclean maintainer-clean:
%.1 : %.pod
pod2man --center=" " --release="$(PACKAGE) $(VERSION)" --date="$(VERSION_DATE)" $< | $(RTRIM) > $@
test -s $@
%.doc : %.pod
pod2text < $< | $(RTRIM) > $@
test -s $@
%.html : %.pod
pod2html --noindex $< | $(RTRIM) | $(DETAB2) > $@
@rm -f pod2htm*
test -s $@
%.man : %.1
nroff -man $< | $(RTRIM) > $@
test -s $@
%.ps : %.1
groff -man $< | $(RTRIM) > $@
test -s $@
%.tex : %.pod
pod2latex $<
test -s $@
###
+39 -13
View File
@@ -1,5 +1,5 @@
Decompressing ELF Directly to Memory on Linux/x86
Copyright (C) 2000-2007 John F. Reiser jreiser@BitWagon.com
Copyright (C) 2000-2018 John F. Reiser jreiser@BitWagon.com
References:
<elf.h> definitions for the ELF file format
@@ -46,8 +46,8 @@ may not be used to take the address of a function.
The address 0x00400000 was chosen to be out of the way of the usual
load address 0x08048000, and to minimize fragmentation in kernel
page tables; one page of page tables covers 4MB. The address
0x00401000 was chosen as 1 page up from a 64KB boundary, to
page tables; one page of page tables covers 4 MiB. The address
0x00401000 was chosen as 1 page up from a 64 KiB boundary, to
make the startup code and its constants smaller.
Decompression of the executable begins by decompressing the Elf32_Ehdr
@@ -64,16 +64,42 @@ assuming that its automatic stack variables are initialized to zero),
and remove (all but 4 bytes of) the decompression program (and
compressed executable) from the address space.
Because the UPX runtime stub removes all traces of the compressed file
from the address space, then the Linux kernel erases the symlink
/proc/self/exe. Linux stores the pathname argument that was specified
to execve() immediately after the '\0' which terminates the character
string of the last environment variable [as of execve()]. This is true
for at least all Linux 2.6, 2.4, and 2.2 kernels. The pathname is not
"bound" to the file as strongly as /proc/self/exe (the file may be changed
without affecting the pathname), but the pathname does provide some
information. The pathname may be relative to the working directory,
so look before any chdir().
As of upx-3.05, by default on Linux, upon decompression then one page
of the compressed executable remains mapped into the address space
of the process. If all of the pages of the compressed executable are
unmapped, then the Linux kernel erases the symlink /proc/self/exe,
and this can cause trouble for the runtime shared library loader
expanding $ORIGIN in -rpath, or for application code that relies on
/proc/self/exe. Use the compress-time command-line option
--unmap-all-pages to achieve that effect at run time. Upx-3.04
and previous versions did this by default with no option. However,
too much other software erroneously assumes that /proc/self/exe
always exists.
On arm*-linux-elf there is no good address at which to retain one
page of the compressed executable. Pages below the usual .p_vaddr
0x8000 (32KiB) are rejected by the kernel. Using a page above the
original uncompressed brk(0) would require placing the entire initial
compressed program above uncompressed brk(0), which would significantly
increase the running brk(0); but too many programs break if brk(0)
moves. Thus on arm*-linux-elf the compressed executable begins
with 0x8000==.p_vaddr, all pages mapped by execve() that are also
occupied by decompressed bytes are removed before overwriting, and
/proc/self/exe becomes a "(deleted)" symlink. It might be possible
to preserve /proc/self/exe if the original uncompressed executable
were created with 0x9000==.p_vaddr (one page higher than the usual
0x8000) so that the compressed page mapped at 0x8000 would linger.
[This has not been tested.]
Linux stores the pathname argument that was specified to execve()
immediately after the '\0' which terminates the character string of the
last environment variable [as of execve()]. This is true for at least
all Linux 2.6, 2.4, and 2.2 kernels. Linux kernel 2.6.29 and later
records a pointer to that character string in Elf32_auxv[AT_EXECFN].
The pathname is not "bound" to the file as strongly as /proc/self/exe
(the file may be changed without affecting the pathname), but the
pathname does provide some information. The pathname may be relative
to the working directory, so look before any chdir().
The Elf formats for Linux add an environment variable named " " [three
spaces] which saves the results of readlink("/proc/self/exe",,) before
+2 -2
View File
@@ -108,14 +108,14 @@ then skip another one - the unfiltering process needs some information
to be able to reverse the filtering.
UPX uses the following idea, which works nicely. First we assume that
the size of the area that should be filtered is less than 16MB. Then
the size of the area that should be filtered is less than 16 MiB. Then
UPX scans over this area and keeps a record of the bytes that are
following the 0xE8 bytes. If we are lucky, there will be bytes that
were not found following 0xE8. These bytes are our candidates to be
used as markers.
Do you still remember that we assumed that the size of scanned area is
less than 16MB? Well, this means that when we process a real call, the
less than 16 MiB? Well, this means that when we process a real call, the
resulting offset will be less than 0x00FFFFFF too. So the MSB is always
0x00. Which is a nice place to store our marker. Of course we should
reverse the byte order in the resulting offset - so this marker will
+1 -1
View File
@@ -20,7 +20,7 @@ code 127, and a record will be added to the history file
In "targeted enforcing" mode, SELinux pays close attention mostly to
designated processes that run with elevated privileges: web server,
print server, login server, etc. Ordinary user excutables receive
print server, login server, etc. Ordinary user executables receive
much less scrutiny. However, one of the eventual goals of SELinux is to
eradicate runtime generation of instructions because of the possibility
for exploitation by malware (virus, trojan, key logger, privilege
+25 -17
View File
@@ -13,8 +13,8 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
=head1 ABSTRACT
The Ultimate Packer for eXecutables
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
http://upx.sourceforge.net
Copyright (c) 1996-2018 Markus Oberhumer, Laszlo Molnar & John Reiser
https://upx.github.io
B<UPX> is a portable, extendable, high-performance executable packer for
@@ -51,8 +51,8 @@ B<UPX> is a versatile executable packer with the following features:
- excellent compression ratio: compresses better than zip/gzip,
use UPX to decrease the size of your distribution !
- very fast decompression: about 10 MB/sec on an ancient Pentium 133,
about 200 MB/sec on an Athlon XP 2000+.
- very fast decompression: about 10 MiB/sec on an ancient Pentium 133,
about 200 MiB/sec on an Athlon XP 2000+.
- no memory overhead for your compressed executables for most of the
supported formats
@@ -78,6 +78,7 @@ B<UPX> is a versatile executable packer with the following features:
* vmlinux/386
* watcom/le (supporting DOS4G, PMODE/W, DOS32a and CauseWay)
* win32/pe (exe and dll)
* win64/pe (exe and dll)
* arm/pe (exe and dll)
* linux/elfamd64
* linux/elfppc32
@@ -139,7 +140,11 @@ B<--help>: prints the help
B<--version>: print the version of B<UPX>
B<--exact>: when compressing, require to be able to get a byte-identical file
after decompression with option B<-d>
after decompression with option B<-d>. [NOTE: this is work in progress and is
not supported for all formats yet. If you do care, as a workaround you can
compress and then decompress your program a first time - any further
compress-decompress steps should then yield byte-identical results
as compared to the first decompressed version.]
[ ...to be written... - type `B<upx --help>' for now ]
@@ -149,7 +154,7 @@ after decompression with option B<-d>
B<UPX> offers ten different compression levels from B<-1> to B<-9>,
and B<--best>. The default compression level is B<-8> for files
smaller than 512 kB, and B<-7> otherwise.
smaller than 512 KiB, and B<-7> otherwise.
=over 4
@@ -345,7 +350,7 @@ Extra options available for this executable format:
First of all, it is recommended to use B<UPX> *instead* of B<strip>. strip has
the very bad habit of replacing your stub with its own (outdated) version.
Additionally B<UPX> corrects a bug/feature in strip v2.8.x: it
will fix the 4 KByte alignment of the stub.
will fix the 4 KiB alignment of the stub.
B<UPX> includes the full functionality of stubify. This means it will
automatically stubify your COFF files. Use the option B<--coff> to
@@ -656,8 +661,8 @@ Specific drawbacks:
- Because of temporary decompression to disk the decompression speed
is not as fast as with the other executable formats. Still, I can see
no noticeable delay when starting programs like my ~3 MB emacs (which
is less than 1 MB when compressed :-).
no noticeable delay when starting programs like my ~3 MiB emacs (which
is less than 1 MiB when compressed :-).
Extra options available for this executable format:
@@ -677,13 +682,16 @@ nostalgic feelings of one of the authors.
Packed programs will be byte-identical to the original after uncompression,
until further notice.
Maximum uncompressed size: ~1.89 / ~7.60 Mbytes.
Maximum uncompressed size: ~1.89 / ~7.60 MiB.
Notes:
- UPX creates as default a suitable executable for CD-Mastering
and console transfer. For a CD-Master main executable you could also try
the special option "--boot-only" as described below.
It has been reported that upx packed executables are fully compatible with
the Sony PlayStation 2 (PS2, PStwo) and Sony PlayStation Portable (PSP) in
Sony PlayStation (PSone) emulation mode.
- Normally the packed files use the same memory areas like the uncompressed
versions, so they will not override other memory areas while unpacking.
@@ -701,7 +709,7 @@ Extra options available for this executable format:
--8-bit Uses 8 bit size compression [default: 32 bit]
--8mb-ram PSone has 8 MB ram available [default: 2 MB]
--8mib-ram PSone has 8 MiB ram available [default: 2 MiB]
--boot-only This format is for main exes and CD-Mastering only !
It may slightly improve the compression ratio,
@@ -831,7 +839,7 @@ must end with ".scr" (as screensavers are handled slightly different
than normal exe files).
UPX compressed PE files have some minor memory overhead (usually in the
10 - 30 kbytes range) which can be seen by specifying the "-i" command
10 - 30 KiB range) which can be seen by specifying the "-i" command
line switch during compression.
Extra options available for this executable format:
@@ -916,7 +924,7 @@ Please report all bugs immediately to the authors.
Markus F.X.J. Oberhumer <markus@oberhumer.com>
http://www.oberhumer.com
Laszlo Molnar <ml1050@users.sourceforge.net>
Laszlo Molnar <ezerotven+github@gmail.com>
John F. Reiser <jreiser@BitWagon.com>
@@ -926,13 +934,13 @@ Please report all bugs immediately to the authors.
=head1 COPYRIGHT
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 2000-2018 John F. Reiser
Copyright (C) 2002-2007 Jens Medoch
Copyright (C) 2002-2018 Jens Medoch
This program may be used freely, and you are welcome to
redistribute it under certain conditions.
+136 -48
View File
@@ -1,88 +1,176 @@
#
# UPX Makefile - needs GNU make 3.80 or better
# UPX Makefile - needs GNU make 3.81 or better
#
# Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
#
MAKEFLAGS += -rR
# build configuration options for this Makefile
BUILD_TYPE_DEBUG ?= 0
BUILD_TYPE_SANITIZE ?= 0
BUILD_USE_DEPEND ?= 1
MAKEFLAGS += -r
.SUFFIXES:
export SHELL = /bin/sh
override e = $($1) $(EXTRA_$1) $(upx_$1) $($(basename $(notdir $@)).$1)
override ee = $($1) $(EXTRA_$1) $(upx_$1) $(upx_EXTRA_$1) $($(basename $(notdir $@)).$1)
ifndef srcdir
srcdir := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST)))
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,')
srcdir := $(dir $(lastword $(MAKEFILE_LIST)))
srcdir := $(shell echo '$(srcdir)' | sed 's,/*$$,,' || echo 'ERROR')
endif
ifndef top_srcdir
top_srcdir := $(srcdir)/..
endif
-include $(top_srcdir)/Makevars.global ./Makevars.local
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
ifneq ($(srcdir),.)
##$(info Info: using VPATH . $(srcdir))
VPATH := . $(srcdir)
vpath %.cpp .:$(srcdir)
vpath %.h .:$(srcdir)
endif
ifeq ($(CXX),)
CXX = g++
endif
ifneq ($(findstring $(firstword $(CXX)),g++),)
USE_GNUC ?= 1
endif
ifeq ($(USE_GNUC),1)
CXXFLAGS += -MMD
ifeq ($(DEBUG),1)
CXXFLAGS += -O0 -g
else
CXXFLAGS += -O2
endif
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wpointer-arith -Wwrite-strings -Werror
##CXXFLAGS += -Wshadow
endif
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
CXXLD ?= $(CXX)
# toolchain
CXX ?= g++
CXXLD = $(CXX)
exeext ?= .out
libext ?= .a
objext ?= .o
upx_SOURCES := $(wildcard $(srcdir)/*.cpp)
upx_SOURCES := $(sort $(wildcard $(srcdir)/*.cpp))
upx_OBJECTS := $(notdir $(upx_SOURCES:.cpp=$(objext)))
ifneq ($(wildcard $(top_srcdir)/.git/.),)
UPX_VERSION_GITREV := $(strip $(shell cd '$(top_srcdir)' && git rev-parse --short=12 HEAD || echo 'ERROR'))
ifneq ($(UPX_VERSION_GITREV),)
GITREV_PLUS := $(strip $(shell cd '$(top_srcdir)' && git diff --exit-code HEAD >/dev/null && echo '' || echo '+'))
DEFS += '-DUPX_VERSION_GITREV="$(UPX_VERSION_GITREV)$(GITREV_PLUS)"'
endif
endif
# we need UCL and zlib - you can set envvar UPX_UCLDIR
ifneq ($(wildcard $(UPX_UCLDIR)/include/ucl/ucl.h),)
INCLUDES += -I$(UPX_UCLDIR)/include
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
endif
LIBS += -lucl -lz
# you should set envvar UPX_LZMADIR to point to your unpacked lzma443.tar.bz2
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
DEFS += -DWITH_LZMA=1
INCLUDES += -I$(UPX_LZMADIR)
# LZMA from https://github.com/upx/upx-lzma-sdk
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
CPPFLAGS += $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
ifeq ($(BUILD_TYPE_DEBUG),1)
CXXFLAGS_OPTIMIZE ?= -O0 -g
else
CXXFLAGS_OPTIMIZE ?= -O2
endif
CXXFLAGS += $(CXXFLAGS_OPTIMIZE)
# protect against security threats caused by misguided C++ compiler "optimizations"
ifeq ($(findstring clang,$(CXX)),)
CXXFLAGS += -fno-delete-null-pointer-checks
endif
CXXFLAGS += -fno-strict-aliasing -fwrapv
CXXFLAGS += -funsigned-char
CXXFLAGS += -Wall -W -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith -Wshadow -Wvla -Wwrite-strings
CXXFLAGS_WERROR ?= -Werror
CXXFLAGS += $(CXXFLAGS_WERROR)
ifeq ($(BUILD_TYPE_SANITIZE),1)
CXXFLAGS_SANITIZE ?= -fsanitize=address,undefined -fno-omit-frame-pointer -DACC_CFG_NO_UNALIGNED
CXXFLAGS += $(CXXFLAGS_SANITIZE)
# these are the only 2 objects that are actually speed-sensitive
compress_lzma$(objext) filteri$(objext) : override CXXFLAGS_SANITIZE =
endif
all: upx$(exeext)
.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS)
# rules
all: upx$(exeext) | ./.depend
.DELETE_ON_ERROR: upx$(exeext) $(upx_OBJECTS) ./.depend
upx$(exeext): $(upx_OBJECTS) $(upx_DEPENDENCIES)
$($(notdir $@).PRE_LINK_STEP)
$(strip $(CXXLD) $(call e,CPPFLAGS) $(call e,CXXFLAGS) $(call e,LDFLAGS) -o $@ $(upx_OBJECTS) $(call e,LDADD) $(call e,LIBS))
$(strip $(CXXLD) $(call ee,CXXFLAGS) $(call ee,LDFLAGS) -o $@ $(upx_OBJECTS) $(call ee,LDADD) $(call ee,LIBS))
$($(notdir $@).POST_LINK_STEP)
$(CHECK_WHITESPACE)
%.o : %.cpp
$(strip $(CXX) $(call e,CPPFLAGS) $(call e,CXXFLAGS) -o $@ -c $<)
%.o : %.cpp | ./.depend
$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -o $@ -c $<)
%.cpp.ii : %.cpp
$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -o $@ -E $<)
ifeq ($(USE_GNUC),1)
##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer
compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual
compress_lzma$(objext) : CXXFLAGS += -Wno-non-virtual-dtor
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
compress_lzma$(objext) : CXXFLAGS += -Wno-unused
##compress_lzma$(objext) : CXXFLAGS += -Wno-error
ifeq ($(BUILD_USE_DEPEND),1)
./.depend: $(sort $(wildcard $(srcdir)/*.cpp $(srcdir)/*.h)) $(MAKEFILE_LIST)
@rm -f $@
@echo "Updating $@"
@$(strip $(CXX) $(call ee,CPPFLAGS) $(call ee,CXXFLAGS) -MM) $(filter %.cpp,$^) > $@
else
./.depend:
.PHONY: ./.depend
endif
CHECK_WHITESPACE =
ifeq ($(shell uname),Linux)
CHECK_WHITESPACE = $(top_srcdir)/src/stub/scripts/check_whitespace.sh $(top_srcdir)
ifneq ($(wildcard $(top_srcdir)/.git/.),)
CHECK_WHITESPACE = $(top_srcdir)/src/stub/scripts/check_whitespace_git.sh $(top_srcdir)
endif
check-whitespace : ; $(CHECK_WHITESPACE)
endif
.PHONY: check-whitespace
mostlyclean clean distclean maintainer-clean:
rm -f *.d *.map *.o *.obj *.res upx.exe upx.out upx.ttp upx$(exeext)
rm -f *.d *.ii *.map *.o *.obj *.res ./.depend upx.exe upx.out upx.ttp upx$(exeext)
./.depend compress_lzma$(objext) : INCLUDES += -I$(UPX_LZMADIR)
compress_lzma$(objext) : CXXFLAGS += -Wno-shadow
p_mach$(objext) : CXXFLAGS += -Wno-cast-align
-include *.d
.PHONY: all mostlyclean clean distclean maintainer-clean
ifeq ($(MAKECMDGOALS),mostlyclean)
else ifeq ($(MAKECMDGOALS),clean)
else ifeq ($(MAKECMDGOALS),distclean)
else ifeq ($(MAKECMDGOALS),maintainer-clean)
else ifeq ($(MAKECMDGOALS),clang-format)
else ifeq ($(MAKECMDGOALS),check-whitespace)
else
ifeq ($(BUILD_USE_DEPEND),1)
-include ./.depend
endif
help$(objext): $(MAKEFILE_LIST)
endif
# "make run-testsuite"
# search for the UPX testsuite -- git clone https://github.com/upx/upx-testsuite.git
# you also can override upx_testsuite_SRCDIR
ifndef upx_testsuite_SRCDIR
# search standard locations below $(top_srcdir)
ifneq ($(wildcard $(top_srcdir)/../upx-testsuite.git/files/packed/.),)
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite.git
else ifneq ($(wildcard $(top_srcdir)/../upx-testsuite/files/packed/.),)
upx_testsuite_SRCDIR := $(top_srcdir)/../upx-testsuite
endif
endif
# run the UPX testsuite
# The expected (old) checksums are in $(top_srcdir)/.github/travis_testsuite_1.sh
# The actual (new) checksums are in tmp-testsuite/testsuite_1/.sha256sums.recreate
ifneq ($(wildcard $(upx_testsuite_SRCDIR)/files/packed/.),)
ifneq ($(wildcard $(top_srcdir)/.github/travis_testsuite_1.sh),)
run-testsuite: export upx_exe := ./upx$(exeext)
run-testsuite: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
run-testsuite: export upx_testsuite_BUILDDIR := ./tmp-testsuite
run-testsuite: ./upx$(exeext)
time -p bash $(top_srcdir)/.github/travis_testsuite_1.sh
.PHONY: run-testsuite
endif
endif
# automatically format some C++ source code files
ifeq ($(shell uname),Linux)
CLANG_FORMAT_FILES += linker.cpp linker.h packhead.cpp packmast.cpp packmast.h
CLANG_FORMAT_FILES += s_djgpp2.cpp s_object.cpp s_vcsa.cpp s_win32.cpp screen.h
CLANG_FORMAT_FILES += snprintf.cpp
CLANG_FORMAT_FILES += stdcxx.cpp stdcxx.h
CLANG_FORMAT_FILES += ui.cpp ui.h util.cpp util.h work.cpp
clang-format:
$(top_srcdir)/src/stub/scripts/upx-clang-format -i $(addprefix $(top_srcdir)/src/,$(CLANG_FORMAT_FILES))
.PHONY: clang-format
endif
# vim:set ts=8 sw=8 noet:
+82 -142
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_BELE_H
#define __UPX_BELE_H
#define __UPX_BELE_H 1
/*************************************************************************
@@ -88,7 +88,7 @@ inline void set_be32(void *p, unsigned v)
#endif
}
inline acc_uint64l_t get_be64(const void *p)
inline upx_uint64_t get_be64(const void *p)
{
#if defined(ACC_UA_GET_BE64)
return ACC_UA_GET_BE64(p);
@@ -97,7 +97,7 @@ inline acc_uint64l_t get_be64(const void *p)
#endif
}
inline void set_be64(void *p, acc_uint64l_t v)
inline void set_be64(void *p, upx_uint64_t v)
{
#if defined(ACC_UA_SET_BE64)
ACC_UA_SET_BE64(p, v);
@@ -142,6 +142,22 @@ inline void set_le24(void *p, unsigned v)
#endif
}
inline unsigned get_le26(const void *p)
{
const acc_hbyte_p b = ACC_CCAST(const acc_hbyte_p, p);
return ACC_ICONV(acc_uint32l_t, b[0] ) | ( ACC_ICONV(acc_uint32l_t, b[1]) << 8) |
(ACC_ICONV(acc_uint32l_t, b[2]) << 16) | (((ACC_ICONV(acc_uint32l_t, b[3]) & 3)<< 24));
}
inline void set_le26(void *p, unsigned v)
{
acc_hbyte_p b = ACC_PCAST(acc_hbyte_p, p);
b[0] = ACC_ICONV(unsigned char, (v >> 0) & 0xff);
b[1] = ACC_ICONV(unsigned char, (v >> 8) & 0xff);
b[2] = ACC_ICONV(unsigned char, (v >> 16) & 0xff);
b[3] = ACC_ICONV(unsigned char, (v >> 24) & 0x03) | (0xFC & b[3]);
}
inline unsigned get_le32(const void *p)
{
#if defined(ACC_UA_GET_LE32)
@@ -160,7 +176,7 @@ inline void set_le32(void *p, unsigned v)
#endif
}
inline acc_uint64l_t get_le64(const void *p)
inline upx_uint64_t get_le64(const void *p)
{
#if defined(ACC_UA_GET_LE64)
return ACC_UA_GET_LE64(p);
@@ -169,7 +185,7 @@ inline acc_uint64l_t get_le64(const void *p)
#endif
}
inline void set_le64(void *p, acc_uint64l_t v)
inline void set_le64(void *p, upx_uint64_t v)
{
#if defined(ACC_UA_SET_LE64)
ACC_UA_SET_LE64(p, v);
@@ -187,18 +203,16 @@ inline int sign_extend(unsigned v, unsigned bits)
{
const unsigned sign_bit = 1u << (bits - 1);
v &= sign_bit | (sign_bit - 1);
//v = (v ^ sign_bit) - sign_bit;
v |= 0 - (v & sign_bit);
return (int) v;
return ACC_ICAST(int, v);
}
inline acc_int64l_t sign_extend(acc_uint64l_t v, unsigned bits)
inline upx_int64_t sign_extend(upx_uint64_t v, unsigned bits)
{
const acc_uint64l_t sign_bit = ACC_UINT64_C(1) << (bits - 1);
const upx_uint64_t sign_bit = UPX_UINT64_C(1) << (bits - 1);
v &= sign_bit | (sign_bit - 1);
//v = (v ^ sign_bit) - sign_bit;
v |= 0 - (v & sign_bit);
return (acc_int64l_t) v;
return ACC_ICAST(upx_int64_t, v);
}
inline int get_be16_signed(const void *p)
@@ -219,9 +233,9 @@ inline int get_be32_signed(const void *p)
return sign_extend(v, 32);
}
inline acc_int64l_t get_be64_signed(const void *p)
inline upx_int64_t get_be64_signed(const void *p)
{
acc_uint64l_t v = get_be64(p);
upx_uint64_t v = get_be64(p);
return sign_extend(v, 64);
}
@@ -243,9 +257,9 @@ inline int get_le32_signed(const void *p)
return sign_extend(v, 32);
}
inline acc_int64l_t get_le64_signed(const void *p)
inline upx_int64_t get_le64_signed(const void *p)
{
acc_uint64l_t v = get_le64(p);
upx_uint64_t v = get_le64(p);
return sign_extend(v, 64);
}
@@ -269,25 +283,25 @@ inline unsigned acc_swab32(unsigned v)
}
inline unsigned acc_swab16p(const acc_uint16e_t *p)
inline unsigned acc_swab16p(const upx_uint16_t *p)
{
return acc_swab16(*p);
}
inline unsigned acc_swap32p(const acc_uint32e_t *p)
inline unsigned acc_swap32p(const upx_uint32_t *p)
{
return acc_swab32(*p);
}
inline void acc_swab16s(acc_uint16e_t *p)
inline void acc_swab16s(upx_uint16_t *p)
{
*p = acc_swab16(*p);
*p = ACC_ICONV(upx_uint16_t, acc_swab16(*p));
}
inline void acc_swab32s(acc_uint32e_t *p)
inline void acc_swab32s(upx_uint32_t *p)
{
*p = acc_swab32(*p);
*p = ACC_ICONV(upx_uint32_t, acc_swab32(*p));
}
@@ -313,13 +327,9 @@ inline void acc_ua_swab32s(void *p)
// to have gcc bug 17519 fixed - see http://gcc.gnu.org/PR17519 ]
**************************************************************************/
struct BE16
{
__packed_struct(BE16)
unsigned char d[2];
//inline BE16() { }
//BE16(unsigned v) { set_be16(d, v); }
BE16& operator = (unsigned v) { set_be16(d, v); return *this; }
BE16& operator += (unsigned v) { set_be16(d, get_be16(d) + v); return *this; }
BE16& operator -= (unsigned v) { set_be16(d, get_be16(d) - v); return *this; }
@@ -332,17 +342,12 @@ struct BE16
BE16& operator >>= (unsigned v) { set_be16(d, get_be16(d) >> v); return *this; }
operator unsigned () const { return get_be16(d); }
}
__attribute_packed;
__packed_struct_end()
struct BE32
{
__packed_struct(BE32)
unsigned char d[4];
//inline BE32() { }
//BE32(unsigned v) { set_be32(d, v); }
BE32& operator = (unsigned v) { set_be32(d, v); return *this; }
BE32& operator += (unsigned v) { set_be32(d, get_be32(d) + v); return *this; }
BE32& operator -= (unsigned v) { set_be32(d, get_be32(d) - v); return *this; }
@@ -355,40 +360,30 @@ struct BE32
BE32& operator >>= (unsigned v) { set_be32(d, get_be32(d) >> v); return *this; }
operator unsigned () const { return get_be32(d); }
}
__attribute_packed;
__packed_struct_end()
struct BE64
{
__packed_struct(BE64)
unsigned char d[8];
//inline BE64() { }
//BE64(acc_uint64l_t v) { set_be64(d, v); }
BE64& operator = (acc_uint64l_t v) { set_be64(d, v); return *this; }
BE64& operator += (acc_uint64l_t v) { set_be64(d, get_be64(d) + v); return *this; }
BE64& operator -= (acc_uint64l_t v) { set_be64(d, get_be64(d) - v); return *this; }
BE64& operator *= (acc_uint64l_t v) { set_be64(d, get_be64(d) * v); return *this; }
BE64& operator /= (acc_uint64l_t v) { set_be64(d, get_be64(d) / v); return *this; }
BE64& operator &= (acc_uint64l_t v) { set_be64(d, get_be64(d) & v); return *this; }
BE64& operator |= (acc_uint64l_t v) { set_be64(d, get_be64(d) | v); return *this; }
BE64& operator ^= (acc_uint64l_t v) { set_be64(d, get_be64(d) ^ v); return *this; }
BE64& operator = (upx_uint64_t v) { set_be64(d, v); return *this; }
BE64& operator += (upx_uint64_t v) { set_be64(d, get_be64(d) + v); return *this; }
BE64& operator -= (upx_uint64_t v) { set_be64(d, get_be64(d) - v); return *this; }
BE64& operator *= (upx_uint64_t v) { set_be64(d, get_be64(d) * v); return *this; }
BE64& operator /= (upx_uint64_t v) { set_be64(d, get_be64(d) / v); return *this; }
BE64& operator &= (upx_uint64_t v) { set_be64(d, get_be64(d) & v); return *this; }
BE64& operator |= (upx_uint64_t v) { set_be64(d, get_be64(d) | v); return *this; }
BE64& operator ^= (upx_uint64_t v) { set_be64(d, get_be64(d) ^ v); return *this; }
BE64& operator <<= (unsigned v) { set_be64(d, get_be64(d) << v); return *this; }
BE64& operator >>= (unsigned v) { set_be64(d, get_be64(d) >> v); return *this; }
operator acc_uint64l_t () const { return get_be64(d); }
}
__attribute_packed;
operator upx_uint64_t () const { return get_be64(d); }
__packed_struct_end()
struct LE16
{
__packed_struct(LE16)
unsigned char d[2];
//inline LE16() { }
//LE16(unsigned v) { set_le16(d, v); }
LE16& operator = (unsigned v) { set_le16(d, v); return *this; }
LE16& operator += (unsigned v) { set_le16(d, get_le16(d) + v); return *this; }
LE16& operator -= (unsigned v) { set_le16(d, get_le16(d) - v); return *this; }
@@ -401,17 +396,12 @@ struct LE16
LE16& operator >>= (unsigned v) { set_le16(d, get_le16(d) >> v); return *this; }
operator unsigned () const { return get_le16(d); }
}
__attribute_packed;
__packed_struct_end()
struct LE32
{
__packed_struct(LE32)
unsigned char d[4];
//inline LE32() { }
//LE32(unsigned v) { set_le32(d, v); }
LE32& operator = (unsigned v) { set_le32(d, v); return *this; }
LE32& operator += (unsigned v) { set_le32(d, get_le32(d) + v); return *this; }
LE32& operator -= (unsigned v) { set_le32(d, get_le32(d) - v); return *this; }
@@ -424,31 +414,25 @@ struct LE32
LE32& operator >>= (unsigned v) { set_le32(d, get_le32(d) >> v); return *this; }
operator unsigned () const { return get_le32(d); }
}
__attribute_packed;
__packed_struct_end()
struct LE64
{
__packed_struct(LE64)
unsigned char d[8];
//inline LE64() { }
//LE64(acc_uint64l_t v) { set_le64(d, v); }
LE64& operator = (acc_uint64l_t v) { set_le64(d, v); return *this; }
LE64& operator += (acc_uint64l_t v) { set_le64(d, get_le64(d) + v); return *this; }
LE64& operator -= (acc_uint64l_t v) { set_le64(d, get_le64(d) - v); return *this; }
LE64& operator *= (acc_uint64l_t v) { set_le64(d, get_le64(d) * v); return *this; }
LE64& operator /= (acc_uint64l_t v) { set_le64(d, get_le64(d) / v); return *this; }
LE64& operator &= (acc_uint64l_t v) { set_le64(d, get_le64(d) & v); return *this; }
LE64& operator |= (acc_uint64l_t v) { set_le64(d, get_le64(d) | v); return *this; }
LE64& operator ^= (acc_uint64l_t v) { set_le64(d, get_le64(d) ^ v); return *this; }
LE64& operator = (upx_uint64_t v) { set_le64(d, v); return *this; }
LE64& operator += (upx_uint64_t v) { set_le64(d, get_le64(d) + v); return *this; }
LE64& operator -= (upx_uint64_t v) { set_le64(d, get_le64(d) - v); return *this; }
LE64& operator *= (upx_uint64_t v) { set_le64(d, get_le64(d) * v); return *this; }
LE64& operator /= (upx_uint64_t v) { set_le64(d, get_le64(d) / v); return *this; }
LE64& operator &= (upx_uint64_t v) { set_le64(d, get_le64(d) & v); return *this; }
LE64& operator |= (upx_uint64_t v) { set_le64(d, get_le64(d) | v); return *this; }
LE64& operator ^= (upx_uint64_t v) { set_le64(d, get_le64(d) ^ v); return *this; }
LE64& operator <<= (unsigned v) { set_le64(d, get_le64(d) << v); return *this; }
LE64& operator >>= (unsigned v) { set_le64(d, get_le64(d) >> v); return *this; }
operator acc_uint64l_t () const { return get_le64(d); }
}
__attribute_packed;
operator upx_uint64_t () const { return get_le64(d); }
__packed_struct_end()
/*************************************************************************
@@ -498,15 +482,16 @@ template <class T> T* operator - (T* ptr, const LE64& v);
// global overloads
**************************************************************************/
#if 1 && !defined(ALIGN_DOWN)
inline unsigned ALIGN_DOWN(unsigned a, const BE32& b) { return ALIGN_DOWN(a, (unsigned) b); }
inline unsigned ALIGN_DOWN(const BE32& a, unsigned b) { return ALIGN_DOWN((unsigned) a, b); }
inline unsigned ALIGN_UP (unsigned a, const BE32& b) { return ALIGN_UP (a, (unsigned) b); }
inline unsigned ALIGN_UP (const BE32& a, unsigned b) { return ALIGN_UP ((unsigned) a, b); }
inline unsigned ALIGN_DOWN(unsigned a, const LE32& b) { return ALIGN_DOWN(a, (unsigned) b); }
inline unsigned ALIGN_DOWN(const LE32& a, unsigned b) { return ALIGN_DOWN((unsigned) a, b); }
inline unsigned ALIGN_UP (unsigned a, const LE32& b) { return ALIGN_UP (a, (unsigned) b); }
inline unsigned ALIGN_UP (const LE32& a, unsigned b) { return ALIGN_UP ((unsigned) a, b); }
#endif
#if !defined(UPX_MAX)
inline unsigned UPX_MAX(unsigned a, const BE16& b) { return UPX_MAX(a, (unsigned) b); }
inline unsigned UPX_MAX(const BE16& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
inline unsigned UPX_MIN(unsigned a, const BE16& b) { return UPX_MIN(a, (unsigned) b); }
@@ -526,7 +511,6 @@ inline unsigned UPX_MAX(unsigned a, const LE32& b) { return UPX_MAX(a, (unsig
inline unsigned UPX_MAX(const LE32& a, unsigned b) { return UPX_MAX((unsigned) a, b); }
inline unsigned UPX_MIN(unsigned a, const LE32& b) { return UPX_MIN(a, (unsigned) b); }
inline unsigned UPX_MIN(const LE32& a, unsigned b) { return UPX_MIN((unsigned) a, b); }
#endif
/*************************************************************************
@@ -554,44 +538,8 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
} // extern "C"
// just for testing...
#if !defined(ACC_CFG_NO_UNALIGNED)
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x030200)
typedef acc_uint16e_t LE16_unaligned __attribute__((__aligned__(1)));
typedef acc_uint32e_t LE32_unaligned __attribute__((__aligned__(1)));
# ifndef LE16
# define LE16 LE16_unaligned
# endif
# ifndef LE32
# define LE32 LE32_unaligned
# endif
#endif
#if 0 && (ACC_ARCH_I386) && (ACC_CC_INTELC)
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
# ifndef LE16
# define LE16 LE16_unaligned
# endif
# ifndef LE32
# define LE32 LE32_unaligned
# endif
#endif
#if 0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_CC_MSC) && (_MSC_VER >= 1200)
typedef __declspec(align(1)) acc_uint16e_t LE16_unaligned;
typedef __declspec(align(1)) acc_uint32e_t LE32_unaligned;
# ifndef LE16
# define LE16 LE16_unaligned
# endif
# ifndef LE32
# define LE32 LE32_unaligned
# endif
# pragma warning(disable: 4244) // Wx: conversion, possible loss of data
#endif
#endif
/*************************************************************************
// Provide namespaces and classes to abtract endianness policies.
// Provide namespaces and classes to abstract endianness policies.
//
// CTP - Compile-Time Polymorphism (templates)
// RTP - Run-Time Polymorphism (virtual functions)
@@ -599,13 +547,15 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
// forward declarations
namespace N_BELE_CTP {
class BEPolicy; class LEPolicy;
struct BEPolicy;
struct LEPolicy;
extern const BEPolicy be_policy;
extern const LEPolicy le_policy;
}
namespace N_BELE_RTP {
class AbstractPolicy;
class BEPolicy; class LEPolicy;
struct AbstractPolicy;
struct BEPolicy;
struct LEPolicy;
extern const BEPolicy be_policy;
extern const LEPolicy le_policy;
}
@@ -623,23 +573,13 @@ namespace N_BELE_RTP {
}
namespace N_BELE_CTP {
template <class T>
inline const N_BELE_RTP::AbstractPolicy* getRTP();
template <>
inline const N_BELE_RTP::AbstractPolicy* getRTP<BEPolicy>()
inline const N_BELE_RTP::AbstractPolicy* getRTP(const BEPolicy*)
{ return &N_BELE_RTP::be_policy; }
template <>
inline const N_BELE_RTP::AbstractPolicy* getRTP<LEPolicy>()
inline const N_BELE_RTP::AbstractPolicy* getRTP(const LEPolicy*)
{ return &N_BELE_RTP::le_policy; }
}
#endif /* already included */
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+17 -21
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -39,7 +39,7 @@
// CTP - Compile-Time Polymorphism (templates)
# define V static inline
# define S static int __acc_cdecl_qsort
# define C
# define C /*empty*/
#elif defined(BELE_RTP)
// RTP - Run-Time Polymorphism (virtual functions)
# define V virtual
@@ -61,17 +61,17 @@ struct AbstractPolicy
V unsigned get16(const void *p) C = 0;
V unsigned get24(const void *p) C = 0;
V unsigned get32(const void *p) C = 0;
V acc_uint64l_t get64(const void *p) C = 0;
V upx_uint64_t get64(const void *p) C = 0;
V void set16(void *p, unsigned v) C = 0;
V void set24(void *p, unsigned v) C = 0;
V void set32(void *p, unsigned v) C = 0;
V void set64(void *p, acc_uint64l_t v) C = 0;
V void set64(void *p, upx_uint64_t v) C = 0;
V unsigned get16_signed(const void *p) C = 0;
V unsigned get24_signed(const void *p) C = 0;
V unsigned get32_signed(const void *p) C = 0;
V acc_uint64l_t get64_signed(const void *p) C = 0;
V upx_uint64_t get64_signed(const void *p) C = 0;
S u16_compare(const void *a, const void *b) C = 0;
S u24_compare(const void *a, const void *b) C = 0;
@@ -113,7 +113,7 @@ struct BEPolicy
{ return get_be24(p); }
V unsigned get32(const void *p) C
{ return get_be32(p); }
V acc_uint64l_t get64(const void *p) C
V upx_uint64_t get64(const void *p) C
{ return get_be64(p); }
V void set16(void *p, unsigned v) C
@@ -122,7 +122,7 @@ struct BEPolicy
{ set_be24(p, v); }
V void set32(void *p, unsigned v) C
{ set_be32(p, v); }
V void set64(void *p, acc_uint64l_t v) C
V void set64(void *p, upx_uint64_t v) C
{ set_be64(p, v); }
V unsigned get16_signed(const void *p) C
@@ -131,7 +131,7 @@ struct BEPolicy
{ return get_be24_signed(p); }
V unsigned get32_signed(const void *p) C
{ return get_be32_signed(p); }
V acc_uint64l_t get64_signed(const void *p) C
V upx_uint64_t get64_signed(const void *p) C
{ return get_be64_signed(p); }
S u16_compare(const void *a, const void *b) C
@@ -190,7 +190,7 @@ struct LEPolicy
{ return get_le24(p); }
V unsigned get32(const void *p) C
{ return get_le32(p); }
V acc_uint64l_t get64(const void *p) C
V upx_uint64_t get64(const void *p) C
{ return get_le64(p); }
V void set16(void *p, unsigned v) C
@@ -199,7 +199,7 @@ struct LEPolicy
{ set_le24(p, v); }
V void set32(void *p, unsigned v) C
{ set_le32(p, v); }
V void set64(void *p, acc_uint64l_t v) C
V void set64(void *p, upx_uint64_t v) C
{ set_le64(p, v); }
V unsigned get16_signed(const void *p) C
@@ -208,7 +208,7 @@ struct LEPolicy
{ return get_le24_signed(p); }
V unsigned get32_signed(const void *p) C
{ return get_le32_signed(p); }
V acc_uint64l_t get64_signed(const void *p) C
V upx_uint64_t get64_signed(const void *p) C
{ return get_le64_signed(p); }
S u16_compare(const void *a, const void *b) C
@@ -259,9 +259,9 @@ struct HostAlignedPolicy
enum { isBE = HostPolicy::isBE, isLE = HostPolicy::isLE };
#endif
typedef acc_uint16e_t U16;
typedef acc_uint32e_t U32;
typedef acc_uint64l_t U64;
typedef upx_uint16_t U16;
typedef upx_uint32_t U32;
typedef upx_uint64_t U64;
static void compileTimeAssertions() {
COMPILE_TIME_ASSERT(sizeof(U16) == 2)
@@ -276,8 +276,4 @@ struct HostAlignedPolicy
#undef S
#undef C
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+31 -40
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_BPTR_H
#define __UPX_BPTR_H
#define __UPX_BPTR_H 1
/*************************************************************************
@@ -37,70 +37,65 @@
template <class T>
class BoundedPtr
{
// typedef BoundedPtr<T> Self;
public:
typedef T* StoredType;
typedef T* PointerType;
typedef T& ReferenceType;
//typedef T* StoredType;
//typedef T* PointerType;
//typedef T& ReferenceType;
~BoundedPtr() { }
explicit BoundedPtr(void* base, unsigned size, T* ptr=0)
: ptr_(ptr), base_(base), size_(size) { check(); }
explicit BoundedPtr(void* base, size_t size_in_bytes, T* ptr=0)
: ptr_(ptr), base_(base), size_in_bytes_(0)
{
assert(base_ != NULL);
size_in_bytes_ = mem_size(1, size_in_bytes);
check();
}
// assignment
BoundedPtr& operator= (const BoundedPtr& other) {
assert(base_ == other.base_); assert(size_ == other.size_);
assert(base_ == other.base_);
assert(size_in_bytes_ == other.size_in_bytes_);
ptr_ = other.ptr_; check(); return *this;
}
BoundedPtr& operator= (T* other) {
ptr_ = other; check(); return *this;
}
operator T* () { check(); return ptr_; }
operator const T* () const { check(); return ptr_; }
operator T* () { return ptr_; }
operator const T* () const { return ptr_; }
BoundedPtr& operator += (size_t n) {
checkStrict(); ptr_ += n; checkStrict(); return *this;
checkNULL(); ptr_ += n; checkRange(); return *this;
}
BoundedPtr& operator -= (size_t n) {
checkStrict(); ptr_ -= n; checkStrict(); return *this;
checkNULL(); ptr_ -= n; checkRange(); return *this;
}
BoundedPtr& operator ++ (void) {
checkStrict(); ptr_ += 1; checkStrict(); return *this;
checkNULL(); ptr_ += 1; checkRange(); return *this;
}
// T* operator ++ (int) {
// T* p = ptr_; checkStrict(); ptr_ += 1; checkStrict(); return p;
// }
// BoundedPtr& operator -- (void) {
// checkStrict(); ptr_ -= 1; checkStrict(); return *this;
// }
private:
void checkNULL() const {
if (!ptr_)
if __acc_very_unlikely(!ptr_)
throwCantUnpack("unexpected NULL pointer; take care!");
}
void checkRange(size_t extra=0) const {
void checkRange() const {
size_t off = (const char *) ptr_ - (const char *) base_;
if (off > size_ || off + extra > size_)
if __acc_very_unlikely(off > size_in_bytes_)
throwCantUnpack("pointer out of range; take care!");
}
void checkStrict(size_t extra=0) const {
checkNULL();
checkRange(extra);
}
void check(size_t extra=0) const {
if (ptr_) checkRange(extra);
void check() const { // check ptr_ invariant: either NULL or valid checkRange()
if (ptr_ != NULL)
checkRange();
}
T* ptr_;
void* base_;
size_t size_;
size_t size_in_bytes_;
// disable copy
BoundedPtr(const BoundedPtr&); // {}
// BoundedPtr& operator= (const BoundedPtr&); // { return *this; }
// disable dynamic allocation
DISABLE_NEW_DELETE
};
@@ -108,8 +103,4 @@ private:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+5 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,13 +22,13 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
/*************************************************************************
//
@@ -89,8 +89,4 @@ console_t console_file =
#endif /* USE_CONSOLE */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+8 -12
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -30,7 +30,7 @@
FILE *con_term = NULL;
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
/*************************************************************************
//
@@ -84,14 +84,14 @@ static int do_init(FILE *f)
if (!acc_isatty(STDIN_FILENO) || !acc_isatty(STDOUT_FILENO) || !acc_isatty(STDERR_FILENO))
return con_mode;
#if defined(USE_ANSI)
#if (USE_ANSI)
try_init(&console_ansi_mono,f);
try_init(&console_ansi_color,f);
#endif
#if defined(USE_SCREEN)
#if (USE_SCREEN)
try_init(&console_screen,f);
#endif
#if defined(USE_AALIB)
#if (USE_AALIB)
try_init(&console_aalib,f);
#endif
@@ -159,8 +159,4 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...)
#endif /* USE_CONSOLE */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+5 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,13 +22,13 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
/*************************************************************************
//
@@ -75,8 +75,4 @@ console_t console_none =
#endif /* USE_CONSOLE */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+10 -14
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,13 +22,13 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#if defined(USE_SCREEN)
#if (USE_SCREEN)
#include "screen.h"
@@ -126,19 +126,19 @@ static int init(FILE *f, int o, int now)
else
return CON_INIT;
#if defined(__DJGPP__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
if (!screen)
screen = do_construct(screen_djgpp2_construct(),fd);
#endif
#if defined(USE_SCREEN_WIN32)
#if (USE_SCREEN_WIN32)
if (!screen)
screen = do_construct(screen_win32_construct(),fd);
#endif
#if defined(USE_SCREEN_VCSA)
#if (USE_SCREEN_VCSA)
if (!screen)
screen = do_construct(screen_vcsa_construct(),fd);
#endif
#if defined(USE_SCREEN_CURSES)
#if (USE_SCREEN_CURSES)
if (!screen && o == CON_SCREEN)
screen = do_construct(screen_curses_construct(),fd);
#endif
@@ -298,7 +298,7 @@ static void print0(FILE *f, const char *ss)
static bool intro(FILE *f)
{
UNUSED(f);
#if defined(USE_FRAMES)
#if (USE_FRAMES)
if (screen->intro)
return screen->intro(screen,screen_show_frames);
#endif
@@ -317,8 +317,4 @@ console_t console_screen =
#endif /* USE_SCREEN */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+33 -40
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,14 +22,13 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#include "compress.h"
#include "mem.h"
#include <zlib.h>
/*************************************************************************
@@ -41,12 +40,10 @@ unsigned upx_adler32(const void *buf, unsigned len, unsigned adler)
if (len == 0)
return adler;
assert(buf != NULL);
#if 0
return adler32(adler, (const Bytef *) buf, len); // zlib
#elif defined(WITH_UCL)
return ucl_adler32(adler, (const ucl_bytep) buf, len);
#if 1
return upx_ucl_adler32(buf, len, adler);
#else
# error
return upx_zlib_adler32(buf, len, adler);
#endif
}
@@ -57,12 +54,10 @@ unsigned upx_crc32(const void *buf, unsigned len, unsigned crc)
if (len == 0)
return crc;
assert(buf != NULL);
#if 0
return crc32(crc, (const Bytef *) buf, len); // zlib
#elif defined(WITH_UCL)
return ucl_crc32(crc, (const ucl_bytep) buf, len);
#if 1
return upx_ucl_crc32(buf, len, crc);
#else
# error
return upx_zlib_crc32(buf, len, crc);
#endif
}
#endif /* UNUSED */
@@ -106,19 +101,19 @@ int upx_compress ( const upx_bytep src, unsigned src_len,
cresult->c_len = 0;
#endif
if (0) {
if __acc_cte(0) {
}
#if defined(WITH_LZMA)
#if (WITH_LZMA)
else if (M_IS_LZMA(method))
r = upx_lzma_compress(src, src_len, dst, dst_len,
cb, method, level, cconf, cresult);
#endif
#if defined(WITH_NRV)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
#if (WITH_NRV)
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
r = upx_nrv_compress(src, src_len, dst, dst_len,
cb, method, level, cconf, cresult);
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
r = upx_ucl_compress(src, src_len, dst, dst_len,
cb, method, level, cconf, cresult);
@@ -152,21 +147,21 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
if (cresult && cresult->method == 0)
cresult = NULL;
if (0) {
if __acc_cte(0) {
}
#if defined(WITH_LZMA)
#if (WITH_LZMA)
else if (M_IS_LZMA(method))
r = upx_lzma_decompress(src, src_len, dst, dst_len, method, cresult);
#endif
#if defined(WITH_NRV)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
#if (WITH_NRV)
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
r = upx_nrv_decompress(src, src_len, dst, dst_len, method, cresult);
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
r = upx_ucl_decompress(src, src_len, dst, dst_len, method, cresult);
#endif
#if defined(WITH_ZLIB)
#if (WITH_ZLIB)
else if (M_IS_DEFLATE(method))
r = upx_zlib_decompress(src, src_len, dst, dst_len, method, cresult);
#endif
@@ -182,8 +177,10 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
//
**************************************************************************/
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult )
{
@@ -197,19 +194,19 @@ int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned overlap_overhead = src_off + src_len - *dst_len;
assert((int)overlap_overhead > 0);
if (0) {
if __acc_cte(0) {
}
#if defined(WITH_LZMA)
#if (WITH_LZMA)
else if (M_IS_LZMA(method))
r = upx_lzma_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
r = upx_lzma_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
#endif
#if defined(WITH_NRV)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
r = upx_nrv_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
#if (WITH_NRV)
else if ((M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method)) && !opt->prefer_ucl)
r = upx_nrv_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
else if (M_IS_NRV2B(method) || M_IS_NRV2D(method) || M_IS_NRV2E(method))
r = upx_ucl_test_overlap(buf, src_off, src_len, dst_len, method, cresult);
r = upx_ucl_test_overlap(buf, tbuf, src_off, src_len, dst_len, method, cresult);
#endif
else {
throwInternalError("unknown decompression method");
@@ -218,8 +215,4 @@ int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
return r;
}
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+34 -21
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,19 +22,20 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_COMPRESS_H
#define __UPX_COMPRESS_H
#define __UPX_COMPRESS_H 1
/*************************************************************************
//
**************************************************************************/
#if defined(WITH_LZMA)
#if (WITH_LZMA)
int upx_lzma_init(void);
const char *upx_lzma_version_string(void);
int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
@@ -46,14 +47,17 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_lzma_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
#endif
#if defined(WITH_NRV)
#if (WITH_NRV)
int upx_nrv_init(void);
const char *upx_nrv_version_string(void);
int upx_nrv_compress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
@@ -65,14 +69,17 @@ int upx_nrv_decompress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
int upx_nrv_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_nrv_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
int upx_ucl_init(void);
const char *upx_ucl_version_string(void);
int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
@@ -84,13 +91,19 @@ int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_ucl_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler);
unsigned upx_ucl_crc32 (const void *buf, unsigned len, unsigned crc);
#endif
#if defined(WITH_ZLIB)
#if (WITH_ZLIB)
int upx_zlib_init(void);
const char *upx_zlib_version_string(void);
int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
@@ -102,17 +115,17 @@ int upx_zlib_decompress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
int upx_zlib_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_zlib_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler);
unsigned upx_zlib_crc32 (const void *buf, unsigned len, unsigned crc);
#endif
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+189 -184
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,18 +22,27 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#include "compress.h"
#include "mem.h"
#if (ACC_CC_MSC)
# pragma warning(disable: 4456) // -Wno-shadow
#endif
#if (ACC_CC_MSC && (_MSC_VER < 1900))
# pragma warning(disable: 4127) // warning C4127: conditional expression is constant
#endif
#if (ACC_CC_INTELC_GNUC)
# pragma warning(error: 424) // #424: extra ";" ignored
#endif
void lzma_compress_config_t::reset()
{
memset(this, 0, sizeof(*this));
pos_bits.reset();
lit_pos_bits.reset();
lit_context_bits.reset();
@@ -46,12 +55,6 @@ void lzma_compress_config_t::reset()
}
#if !defined(WITH_LZMA)
extern int compress_lzma_dummy;
int compress_lzma_dummy = 0;
#else
// INFO: the LZMA SDK is covered by a permissive license which allows
// using unmodified LZMA source code in UPX and the UPX stubs.
// See SPECIAL EXCEPTION below.
@@ -90,10 +93,130 @@ int compress_lzma_dummy = 0;
/*************************************************************************
// cruft because of pseudo-COM layer
// compress defaults
**************************************************************************/
#undef USE_LZMA_PROPERTIES
static int prepare(lzma_compress_result_t *res,
unsigned src_len, int method, int level,
const lzma_compress_config_t *lcconf)
{
// setup defaults
res->pos_bits = 2; // 0 .. 4
res->lit_pos_bits = 0; // 0 .. 4
res->lit_context_bits = 3; // 0 .. 8
res->dict_size = 4 * 1024 * 1024; // 1 .. 2**30
res->fast_mode = 2;
res->num_fast_bytes = 64; // 5 .. 273
res->match_finder_cycles = 0;
// UPX overrides
res->pos_bits = lzma_compress_config_t::pos_bits_t::default_value;
res->lit_pos_bits = lzma_compress_config_t::lit_pos_bits_t::default_value;
res->lit_context_bits = lzma_compress_config_t::lit_context_bits_t::default_value;
res->dict_size = lzma_compress_config_t::dict_size_t::default_value;
res->num_fast_bytes = lzma_compress_config_t::num_fast_bytes_t::default_value;
// method overrides
if (method >= 0x100) {
res->pos_bits = (method >> 16) & 15;
res->lit_pos_bits = (method >> 12) & 15;
res->lit_context_bits = (method >> 8) & 15;
}
#if 0
// DEBUG - set sizes so that we use a maxmimum amount of stack.
// These settings cause res->num_probs == 3147574, i.e. we will
// need about 6 MiB of stack during runtime decompression.
res->lit_pos_bits = 4;
res->lit_context_bits = 8;
#endif
// TODO: tune these settings according to level
switch (level)
{
case 1:
res->dict_size = 256 * 1024;
res->fast_mode = 0;
res->num_fast_bytes = 8;
break;
case 2:
res->dict_size = 256 * 1024;
res->fast_mode = 0;
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
res->dict_size = 8 * 1024 * 1024;
break;
case 10:
res->dict_size = src_len;
break;
default:
goto error;
}
// cconf overrides
if (lcconf)
{
oassign(res->pos_bits, lcconf->pos_bits);
oassign(res->lit_pos_bits, lcconf->lit_pos_bits);
oassign(res->lit_context_bits, lcconf->lit_context_bits);
oassign(res->dict_size, lcconf->dict_size);
oassign(res->num_fast_bytes, lcconf->num_fast_bytes);
}
// limit dictionary size
if (res->dict_size > src_len)
res->dict_size = src_len;
// limit num_probs
if (lcconf && lcconf->max_num_probs)
{
for (;;)
{
unsigned n = 1846 + (768 << (res->lit_context_bits + res->lit_pos_bits));
if (n <= lcconf->max_num_probs)
break;
if (res->lit_pos_bits > res->lit_context_bits)
{
if (res->lit_pos_bits == 0)
goto error;
res->lit_pos_bits -= 1;
}
else
{
if (res->lit_context_bits == 0)
goto error;
res->lit_context_bits -= 1;
}
}
}
lzma_compress_config_t::pos_bits_t::assertValue(res->pos_bits);
lzma_compress_config_t::lit_pos_bits_t::assertValue(res->lit_pos_bits);
lzma_compress_config_t::lit_context_bits_t::assertValue(res->lit_context_bits);
lzma_compress_config_t::dict_size_t::assertValue(res->dict_size);
lzma_compress_config_t::num_fast_bytes_t::assertValue(res->num_fast_bytes);
res->num_probs = 1846 + (768 << (res->lit_context_bits + res->lit_pos_bits));
//printf("\nlzma_compress config: %u %u %u %u %u\n", res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs);
return 0;
error:
return -1;
}
/*************************************************************************
// compress - cruft because of pseudo-COM layer
**************************************************************************/
#undef MSDOS
#undef OS2
@@ -109,6 +232,7 @@ namespace MyLzma {
struct InStream: public ISequentialInStream, public CMyUnknownImp
{
virtual ~InStream() { }
MY_UNKNOWN_IMP
const Byte *b_buf; size_t b_size; size_t b_pos;
void Init(const Byte *data, size_t size) {
@@ -121,7 +245,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
{
size_t remain = b_size - b_pos;
if (size > remain) size = (UInt32) remain;
memcpy(data, b_buf + b_pos, size);
memmove(data, b_buf + b_pos, size);
b_pos += size;
if (processedSize != NULL) *processedSize = size;
return S_OK;
@@ -129,6 +253,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
{
virtual ~OutStream() { }
MY_UNKNOWN_IMP
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
void Init(Byte *data, size_t size) {
@@ -146,7 +271,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
{
size_t remain = b_size - b_pos;
if (size > remain) size = (UInt32) remain, overflow = true;
memcpy(b_buf + b_pos, data, size);
memmove(b_buf + b_pos, data, size);
b_pos += size;
if (processedSize != NULL) *processedSize = size;
return overflow ? E_FAIL : S_OK;
@@ -154,6 +279,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
{
virtual ~ProgressInfo() { }
MY_UNKNOWN_IMP
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
upx_callback_p cb;
@@ -168,11 +294,6 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
} // namespace
#if (ACC_CC_INTELC) && defined(__linux__)
# pragma warning(disable: 424) // #424: extra ";" ignored
#endif
#include "C/Common/Alloc.cpp"
#include "C/Common/CRC.cpp"
//#include "C/7zip/Common/InBuffer.cpp"
@@ -221,134 +342,25 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
NCoderPropID::kMatchFinder // 7 mf
};
PROPVARIANT pr[8];
const unsigned nprops = 8;
static const wchar_t matchfinder[] = L"BT4";
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
pr[7].vt = VT_BSTR; pr[7].bstrVal = ACC_PCAST(BSTR, ACC_UNCONST_CAST(wchar_t *, matchfinder));
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
pr[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
pr[7].vt = VT_BSTR;
// setup defaults
pr[0].uintVal = 2; // 0 .. 4
pr[1].uintVal = 0; // 0 .. 4
pr[2].uintVal = 3; // 0 .. 8
pr[3].uintVal = 4 * 1024 * 1024; // 1 .. 2**30
pr[4].uintVal = 2;
pr[5].uintVal = 64; // 5 .. 273
pr[6].uintVal = 0;
#ifdef COMPRESS_MF_BT4
static wchar_t matchfinder[] = L"BT4";
#endif
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
pr[7].bstrVal = matchfinder;
#if 1
pr[0].uintVal = lzma_compress_config_t::pos_bits_t::default_value_c;
pr[1].uintVal = lzma_compress_config_t::lit_pos_bits_t::default_value_c;
pr[2].uintVal = lzma_compress_config_t::lit_context_bits_t::default_value_c;
pr[3].uintVal = lzma_compress_config_t::dict_size_t::default_value_c;
pr[5].uintVal = lzma_compress_config_t::num_fast_bytes_t::default_value_c;
#endif
// method overrides
if (method >= 0x100) {
pr[0].uintVal = (method >> 16) & 15;
pr[1].uintVal = (method >> 12) & 15;
pr[2].uintVal = (method >> 8) & 15;
}
#if 0
// DEBUG - set sizes so that we use a maxmimum amount of stack.
// These settings cause res->num_probs == 3147574, i.e. we will
// need about 6 MB of stack during runtime decompression.
pr[1].uintVal = 4;
pr[2].uintVal = 8;
#endif
// FIXME: tune these settings according to level
switch (level)
{
case 1:
pr[3].uintVal = 256 * 1024;
pr[4].uintVal = 0;
pr[5].uintVal = 8;
break;
case 2:
pr[3].uintVal = 256 * 1024;
pr[4].uintVal = 0;
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
break;
case 7:
break;
case 8:
break;
case 9:
pr[3].uintVal = 8 * 1024 * 1024;
break;
case 10:
pr[3].uintVal = src_len;
break;
default:
if (prepare(res, src_len, method, level, lcconf) != 0)
goto error;
}
pr[0].uintVal = res->pos_bits;
pr[1].uintVal = res->lit_pos_bits;
pr[2].uintVal = res->lit_context_bits;
pr[3].uintVal = res->dict_size;
pr[4].uintVal = res->fast_mode;
pr[5].uintVal = res->num_fast_bytes;
pr[6].uintVal = res->match_finder_cycles;
// cconf overrides
if (lcconf)
{
oassign(pr[0].uintVal, lcconf->pos_bits);
oassign(pr[1].uintVal, lcconf->lit_pos_bits);
oassign(pr[2].uintVal, lcconf->lit_context_bits);
oassign(pr[3].uintVal, lcconf->dict_size);
oassign(pr[5].uintVal, lcconf->num_fast_bytes);
}
// limit dictionary size
if (pr[3].uintVal > src_len)
pr[3].uintVal = src_len;
// limit num_probs
if (lcconf && lcconf->max_num_probs)
{
for (;;)
{
unsigned n = 1846 + (768 << (pr[2].uintVal + pr[1].uintVal));
if (n <= lcconf->max_num_probs)
break;
if (pr[1].uintVal > pr[2].uintVal)
{
if (pr[1].uintVal == 0)
goto error;
pr[1].uintVal -= 1;
}
else
{
if (pr[2].uintVal == 0)
goto error;
pr[2].uintVal -= 1;
}
}
}
res->pos_bits = pr[0].uintVal;
res->lit_pos_bits = pr[1].uintVal;
res->lit_context_bits = pr[2].uintVal;
res->dict_size = pr[3].uintVal;
res->fast_mode = pr[4].uintVal;
res->num_fast_bytes = pr[5].uintVal;
res->match_finder_cycles = pr[6].uintVal;
//res->num_probs = LzmaGetNumProbs(&s.Properties));
//res->num_probs = (LZMA_BASE_SIZE + (LZMA_LIT_SIZE << ((Properties)->lc + (Properties)->lp)))
res->num_probs = 1846 + (768 << (res->lit_context_bits + res->lit_pos_bits));
//printf("\nlzma_compress config: %u %u %u %u %u\n", res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs);
#ifndef _NO_EXCEPTIONS
try {
#else
# error
#endif
if (enc.SetCoderProperties(propIDs, pr, 8) != S_OK)
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
goto error;
if (enc.WriteCoderProperties(&os) != S_OK)
goto error;
@@ -358,21 +370,17 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
goto error;
}
assert(os.b_pos == 5);
#if defined(USE_LZMA_PROPERTIES)
os.b_pos = 1;
#else
os.b_pos = 0;
// extra stuff in first byte: 5 high bits convenience for stub decompressor
unsigned t = res->lit_context_bits + res->lit_pos_bits;
os.WriteByte((t << 3) | res->pos_bits);
os.WriteByte((res->lit_pos_bits << 4) | (res->lit_context_bits));
#endif
os.WriteByte(Byte((t << 3) | res->pos_bits));
os.WriteByte(Byte((res->lit_pos_bits << 4) | (res->lit_context_bits)));
rh = enc.Code(&is, &os, NULL, NULL, &progress);
#ifndef _NO_EXCEPTIONS
} catch (...) { rh = E_OUTOFMEMORY; }
#endif
} catch (...) {
rh = E_OUTOFMEMORY;
}
assert(is.b_pos <= src_len);
assert(os.b_pos <= *dst_len);
@@ -391,7 +399,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
}
error:
*dst_len = os.b_pos;
*dst_len = (unsigned) os.b_pos;
//printf("\nlzma_compress: %d: %u %u %u %u %u, %u - > %u\n", r, res->pos_bits, res->lit_pos_bits, res->lit_context_bits, res->dict_size, res->num_probs, src_len, *dst_len);
//printf("%u %u %u\n", is.__m_RefCount, os.__m_RefCount, progress.__m_RefCount);
return r;
@@ -425,14 +433,6 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
int r = UPX_E_ERROR;
int rh;
#if defined(USE_LZMA_PROPERTIES)
if (src_len < 2)
goto error;
rh = LzmaDecodeProperties(&s.Properties, src, src_len);
if (rh != 0)
goto error;
src += 1; src_len -= 1;
#else
if (src_len < 3)
goto error;
s.Properties.pb = src[0] & 7;
@@ -444,7 +444,6 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
// extra
if ((src[0] >> 3) != s.Properties.lc + s.Properties.lp) goto error;
src += 2; src_len -= 2;
#endif
if (cresult)
{
@@ -476,35 +475,37 @@ int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
error:
*dst_len = dst_out;
free(s.Probs);
UNUSED(cresult);
return r;
}
/*************************************************************************
// test_overlap
// test_overlap - see <ucl/ucl.h> for semantics
**************************************************************************/
int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_lzma_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult )
{
assert(M_IS_LZMA(method));
// FIXME - implement this
// Note that Packer::verifyOverlappingDecompression() will
// verify the final result in any case.
UNUSED(buf);
unsigned overlap_overhead = src_off + src_len - *dst_len;
//printf("upx_lzma_test_overlap: %d\n", overlap_overhead);
if ((int)overlap_overhead >= 256)
return UPX_E_OK;
UNUSED(cresult);
MemBuffer b(src_off + src_len);
memcpy(b + src_off, buf + src_off, src_len);
unsigned saved_dst_len = *dst_len;
int r = upx_lzma_decompress(b + src_off, src_len, b, dst_len, method, cresult);
if (r != UPX_E_OK)
return r;
if (*dst_len != saved_dst_len)
return UPX_E_ERROR;
// NOTE: there is a very tiny possibility that decompression has
// succeeded but the data is not restored correctly because of
// in-place buffer overlapping, so we use an extra memcmp().
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
return UPX_E_ERROR;
return UPX_E_OK;
}
@@ -512,16 +513,20 @@ int upx_lzma_test_overlap ( const upx_bytep buf, unsigned src_off,
// misc
**************************************************************************/
int upx_lzma_init(void)
{
return 0;
}
const char *upx_lzma_version_string(void)
{
// FIXME
// return NULL;
#if (WITH_LZMA == 0x443)
return "4.43";
#else
# error "unknown WITH_LZMA version"
return NULL;
#endif
}
#endif /* WITH_LZMA */
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+46 -17
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,29 +22,29 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#include "compress.h"
#if !defined(WITH_UCL)
#if !(WITH_UCL)
extern int compress_ucl_dummy;
int compress_ucl_dummy = 0;
#else
#if 1 && !defined(UCL_USE_ASM) && (ACC_ARCH_I386)
# if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
# define UCL_USE_ASM
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
# if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
# define UCL_USE_ASM 1
# endif
#endif
#if defined(UCL_NO_ASM)
#if (UCL_NO_ASM)
# undef UCL_USE_ASM
#endif
#if defined(ACC_CFG_NO_UNALIGNED)
#if (ACC_CFG_NO_UNALIGNED)
# undef UCL_USE_ASM
#endif
#if 1 && defined(UCL_USE_ASM)
#if 1 && (UCL_USE_ASM)
# include <ucl/ucl_asm.h>
# define ucl_nrv2b_decompress_safe_8 ucl_nrv2b_decompress_asm_safe_8
# define ucl_nrv2b_decompress_safe_le16 ucl_nrv2b_decompress_asm_safe_le16
@@ -85,7 +85,7 @@ static int convert_errno_from_ucl(int r)
extern "C" {
static void wrap_nprogress_ucl(ucl_uint a, ucl_uint b, int state, ucl_voidp user)
static void __UCL_CDECL wrap_nprogress_ucl(ucl_uint a, ucl_uint b, int state, ucl_voidp user)
{
if (state != -1 && state != 3) return;
upx_callback_p cb = (upx_callback_p) user;
@@ -120,7 +120,7 @@ int upx_ucl_compress ( const upx_bytep src, unsigned src_len,
ucl_compress_config_t cconf; cconf.reset();
if (cconf_parm)
cconf = cconf_parm->conf_ucl; // struct copy
memcpy(&cconf, &cconf_parm->conf_ucl, sizeof(cconf)); // cconf = cconf_parm->conf_ucl; // struct copy
ucl_uint *res = cresult->result_ucl.result;
// assume no info available - fill in worst case results
@@ -228,12 +228,15 @@ int upx_ucl_decompress ( const upx_bytep src, unsigned src_len,
//
**************************************************************************/
int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_ucl_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult )
{
int r;
UNUSED(tbuf); // not needed for UCL
switch (method)
{
@@ -278,14 +281,40 @@ int upx_ucl_test_overlap ( const upx_bytep buf, unsigned src_off,
// misc
**************************************************************************/
extern "C" {
static ucl_voidp __UCL_CDECL my_malloc(ucl_uint n) { return calloc(1, n); }
static void __UCL_CDECL my_free(ucl_voidp p) { free(p); }
}
int upx_ucl_init(void)
{
if (ucl_init() != UCL_E_OK)
return -1;
#if defined(UPX_OFFICIAL_BUILD)
if (UCL_VERSION != ucl_version())
return -2;
#endif
ucl_set_malloc_hooks(my_malloc, my_free);
return 0;
}
const char *upx_ucl_version_string(void)
{
return ucl_version_string();
}
unsigned upx_ucl_adler32(const void *buf, unsigned len, unsigned adler)
{
return ucl_adler32(adler, (const ucl_bytep) buf, len);
}
#if 0 /* UNUSED */
unsigned upx_ucl_crc32(const void *buf, unsigned len, unsigned crc)
{
return ucl_crc32(crc, (const ucl_bytep) buf, len);
}
#endif
#endif /* WITH_UCL */
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+50 -24
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,17 +22,18 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#include "compress.h"
#include "mem.h"
void zlib_compress_config_t::reset()
{
memset(this, 0, sizeof(*this));
mem_clear(this, sizeof(*this));
mem_level.reset();
window_bits.reset();
@@ -40,7 +41,7 @@ void zlib_compress_config_t::reset()
}
#if !defined(WITH_ZLIB)
#if !(WITH_ZLIB)
extern int compress_zlib_dummy;
int compress_zlib_dummy = 0;
#else
@@ -98,7 +99,7 @@ int upx_zlib_compress ( const upx_bytep src, unsigned src_len,
z_stream s;
s.zalloc = (alloc_func) 0;
s.zfree = (free_func) 0;
s.next_in = const_cast<upx_bytep>(src); // UNCONST
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
s.avail_in = src_len;
s.next_out = dst;
s.avail_out = *dst_len;
@@ -152,7 +153,7 @@ int upx_zlib_decompress ( const upx_bytep src, unsigned src_len,
z_stream s;
s.zalloc = (alloc_func) 0;
s.zfree = (free_func) 0;
s.next_in = const_cast<upx_bytep>(src); // UNCONST
s.next_in = ACC_UNCONST_CAST(upx_bytep, src);
s.avail_in = src_len;
s.next_out = dst;
s.avail_out = *dst_len;
@@ -188,28 +189,32 @@ done:
/*************************************************************************
// test_overlap
// test_overlap - see <ucl/ucl.h> for semantics
**************************************************************************/
int upx_zlib_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_zlib_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult )
{
assert(method == M_DEFLATE);
// FIXME - implement this
// Note that Packer::verifyOverlappingDecompression() will
// verify the final result in any case.
UNUSED(buf);
unsigned overlap_overhead = src_off + src_len - *dst_len;
//printf("upx_zlib_test_overlap: %d\n", overlap_overhead);
if ((int)overlap_overhead >= 256)
return UPX_E_OK;
UNUSED(cresult);
MemBuffer b(src_off + src_len);
memcpy(b + src_off, buf + src_off, src_len);
unsigned saved_dst_len = *dst_len;
int r = upx_zlib_decompress(b + src_off, src_len, b, dst_len, method, cresult);
if (r != UPX_E_OK)
return r;
if (*dst_len != saved_dst_len)
return UPX_E_ERROR;
// NOTE: there is a very tiny possibility that decompression has
// succeeded but the data is not restored correctly because of
// in-place buffer overlapping, so we use an extra memcmp().
if (tbuf != NULL && memcmp(tbuf, b, *dst_len) != 0)
return UPX_E_ERROR;
return UPX_E_OK;
}
@@ -217,14 +222,35 @@ int upx_zlib_test_overlap ( const upx_bytep buf, unsigned src_off,
// misc
**************************************************************************/
int upx_zlib_init(void)
{
#if defined(UPX_OFFICIAL_BUILD)
if (strcmp(ZLIB_VERSION, zlibVersion()) != 0)
return -2;
#endif
return 0;
}
const char *upx_zlib_version_string(void)
{
return zlibVersion();
}
#if 0 /* UNUSED */
unsigned upx_zlib_adler32(const void *buf, unsigned len, unsigned adler)
{
return adler32(adler, (const Bytef *) buf, len);
}
#endif
#if 0 /* UNUSED */
unsigned upx_zlib_crc32(const void *buf, unsigned len, unsigned crc)
{
return crc32(crc, (const Bytef *) buf, len);
}
#endif
#endif /* WITH_ZLIB */
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+173 -240
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,110 +22,88 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_CONF_H
#define __UPX_CONF_H
#define __UPX_CONF_H 1
#include "version.h"
#if !defined(_FILE_OFFSET_BITS)
# define _FILE_OFFSET_BITS 64
#endif
#undef NDEBUG
/*************************************************************************
// ACC
**************************************************************************/
#include "miniacc.h"
#if ((ACC_OS_WIN32 || ACC_OS_WIN64) && ACC_CC_MWERKS) && defined(__MSL__)
# undef HAVE_UTIME_H /* this pulls in <windows.h> */
#ifndef ACC_CFG_USE_NEW_STYLE_CASTS
#define ACC_CFG_USE_NEW_STYLE_CASTS 1
#endif
#define ACC_CFG_PREFER_TYPEOF_ACC_INT32E_T ACC_TYPEOF_INT
#define ACC_CFG_PREFER_TYPEOF_ACC_INT64E_T ACC_TYPEOF_LONG_LONG
#include "miniacc.h"
#if !(ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_MSC)
// other compilers may work, but we're NOT interested into supporting them
# error "only clang and gcc are officially supported"
#endif
// UPX sanity checks for a sane compiler
#if !defined(UINT_MAX) || (UINT_MAX != 0xffffffffL)
# error "UINT_MAX"
#endif
ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(int) == 4)
ACC_COMPILE_TIME_ASSERT_HEADER((1u << 31) << 1 == 0)
ACC_COMPILE_TIME_ASSERT_HEADER(((int)(1u << 31)) >> 31 == -1) // arithmetic right shift
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255) // -funsigned-char
ACC_COMPILE_TIME_ASSERT_HEADER((char)(-1) > 0) // -funsigned-char
#if (ACC_CC_MSC)
# pragma warning(error: 4127)
# pragma warning(error: 4146)
# pragma warning(error: 4319)
# pragma warning(error: 4805)
# pragma warning(disable: 4244) // -Wconversion
# pragma warning(disable: 4267) // -Wconversion
# pragma warning(disable: 4820) // padding added after data member
#endif
// FIXME - quick hack for arm-wince-gcc-3.4 (Debian pocketpc-*.deb packages)
#if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(_WIN32)
#if 1 && (ACC_ARCH_ARM) && defined(__pe__) && !defined(__CEGCC__) && !defined(_WIN32)
# undef HAVE_CHMOD
# undef HAVE_CHOWN
# undef HAVE_LSTAT
# undef HAVE_UTIME
#endif
// pragmas
#if (ACC_CC_BORLANDC)
# if (__BORLANDC__ < 0x0500)
# error "need Borland C++ 5.0 or newer"
# endif
# pragma warn -aus // 8004: 'x' is assigned a value that is never used
# pragma warn -inl // 8026+8027: Function not expanded inline
// Borland compilers typically produce a number of bogus warnings, and
// the actual diagnostics vary from version to version...
# if (__BORLANDC__ < 0x0530)
# pragma warn -csu // 8012: Comparing signed and unsigned values
# endif
# if (__BORLANDC__ >= 0x0530 && __BORLANDC__ < 0x0560)
# pragma warn -osh // 8055: Possible overflow in shift operation
# endif
# if (__BORLANDC__ >= 0x0560)
# pragma warn -use // 8080: 'x' is declared but never used
# endif
#elif (ACC_CC_DMC)
# if (__DMC__ < 0x829)
# error "need Digital Mars C++ 8.29 or newer"
# endif
#elif (ACC_CC_INTELC)
# if (__INTEL_COMPILER < 450)
# error "need Intel C++ 4.5 or newer"
# endif
# if (ACC_OS_WIN32 || ACC_OS_WIN64)
# elif defined(__linux__)
# pragma warning(error: 424) // #424: extra ";" ignored
# pragma warning(disable: 193) // #193: zero used for undefined preprocessing identifier
# pragma warning(disable: 810) // #810: conversion from "A" to "B" may lose significant bits
# pragma warning(disable: 981) // #981: operands are evaluated in unspecified order
# pragma warning(disable: 1418) // #1418: external definition with no prior declaration
# else
# error "untested platform"
# endif
#elif (ACC_CC_MSC)
# if (_MSC_VER < 1100)
# error "need Visual C++ 5.0 or newer"
# endif
# pragma warning(error: 4096) // W2: '__cdecl' must be used with '...'
# pragma warning(disable: 4097) // W3: typedef-name 'A' used as synonym for class-name 'B'
# pragma warning(disable: 4511) // W3: 'class': copy constructor could not be generated
# pragma warning(disable: 4512) // W4: 'class': assignment operator could not be generated
# pragma warning(disable: 4514) // W4: 'function': unreferenced inline function has been removed
# pragma warning(disable: 4710) // W4: 'function': function not inlined
# if (_MSC_VER >= 1300)
# pragma warning(disable: 4625) // W4: 'class' : copy constructor could not be generated because a base class copy constructor is inaccessible
# pragma warning(disable: 4626) // W4: 'class' : assignment operator could not be generated because a base class assignment operator is inaccessible
# pragma warning(disable: 4711) // W4: 'function' selected for automatic inline expansion
# pragma warning(disable: 4820) // W4: 'struct' : 'x' bytes padding added after member 'member'
# endif
# if (_MSC_VER >= 1400)
# pragma warning(disable: 4996) // W1: 'function': was declared deprecated
# endif
#elif (ACC_CC_SUNPROC)
//# pragma error_messages(off,"badargtype2w") // FIXME
#elif (ACC_CC_WATCOMC)
# if (__WATCOMC__ < 1100)
# error "need Watcom C++ 11.0c or newer"
# endif
# if defined(__cplusplus)
# pragma warning 656 9 // w5: define this function inside its class definition (may improve code quality)
# endif
#endif
#define ACC_WANT_ACC_INCD_H 1
#define ACC_WANT_ACC_INCE_H 1
#define ACC_WANT_ACC_LIB_H 1
#define ACC_WANT_ACC_CXX_H 1
#include "miniacc.h"
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
# error "something pulled in <windows.h>"
# endif
#endif
/* intergral types */
typedef acc_int8_t upx_int8_t;
typedef acc_uint8_t upx_uint8_t;
typedef acc_int16_t upx_int16_t;
typedef acc_uint16_t upx_uint16_t;
typedef acc_int32_t upx_int32_t;
typedef acc_uint32_t upx_uint32_t;
typedef acc_int64_t upx_int64_t;
typedef acc_uint64_t upx_uint64_t;
typedef acc_uintptr_t upx_uintptr_t;
#define UPX_INT16_C ACC_INT16_C
#define UPX_UINT16_C ACC_UINT16_C
#define UPX_INT32_C ACC_INT32_C
#define UPX_UINT32_C ACC_UINT32_C
#define UPX_INT64_C ACC_INT64_C
#define UPX_UINT64_C ACC_UINT64_C
typedef unsigned char upx_byte;
#define upx_bytep upx_byte *
/*************************************************************************
@@ -137,38 +115,24 @@
#endif
// just in case
#undef NDEBUG
#undef _
#undef __
#undef ___
#undef dos
#undef linux
#undef small
#undef tos
#if defined(ACC_CC_DMC)
# undef tell
#endif
#if !defined(ACC_CC_PGI)
#undef unix
#endif
#if defined(__DJGPP__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
# undef sopen
# undef __unix__
# undef __unix
#endif
#if !defined(WITH_UCL)
#define WITH_LZMA 0x443
#define WITH_UCL 1
#endif
#if 0 && !defined(WITH_LZMA)
# define WITH_LZMA 1
#endif
#if defined(UPX_OFFICIAL_BUILD)
# if !defined(WITH_LZMA) || !defined(WITH_NRV) || !defined(WITH_UCL)
# error
# endif
#endif
#if defined(WITH_NRV)
# include <nrv/nrvconf.h>
#endif
#if defined(WITH_UCL)
#define WITH_ZLIB 1
#if (WITH_UCL)
# define ucl_compress_config_t REAL_ucl_compress_config_t
# include <ucl/uclconf.h>
# include <ucl/ucl.h>
@@ -178,47 +142,32 @@
# undef ucl_compress_config_t
# undef ucl_compress_config_p
#endif
#if !defined(__UPX_CHECKER)
# if defined(__UCL_CHECKER) || defined(__NRV_CHECKER)
# define __UPX_CHECKER
# endif
#endif
#if !defined(UINT_MAX) || (UINT_MAX < 0xffffffffL)
# error "UINT_MAX"
#endif
#define upx_byte unsigned char
#define upx_bytep upx_byte *
/*************************************************************************
// system includes
**************************************************************************/
// malloc debuggers
#if defined(WITH_VALGRIND)
#if (WITH_VALGRIND)
# include <valgrind/memcheck.h>
#endif
#if !defined(VALGRIND_MAKE_WRITABLE)
# define VALGRIND_MAKE_WRITABLE(addr,len) 0
#if !defined(VALGRIND_MAKE_MEM_DEFINED)
# define VALGRIND_MAKE_MEM_DEFINED(addr,len) 0
#endif
#if !defined(VALGRIND_MAKE_READABLE)
# if 0
# define VALGRIND_MAKE_READABLE(addr,len) (memset(addr,0,len), 0)
# else
# define VALGRIND_MAKE_READABLE(addr,len) 0
#if !defined(VALGRIND_MAKE_MEM_NOACCESS)
# define VALGRIND_MAKE_MEM_NOACCESS(addr,len) 0
#endif
#endif
#if !defined(VALGRIND_DISCARD)
# define VALGRIND_DISCARD(handle) ((void)(&handle))
#if !defined(VALGRIND_MAKE_MEM_UNDEFINED)
# define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) 0
#endif
// unconditionally turn on assertions
// IMPORTANT: unconditionally enable assertions
#undef NDEBUG
#include <assert.h>
// protect against integer overflows and malicious header fields
// see C 11 standard, Annex K
typedef size_t upx_rsize_t;
#define UPX_RSIZE_MAX UPX_RSIZE_MAX_MEM
#define UPX_RSIZE_MAX_MEM (768 * 1024 * 1024) // DO NOT CHANGE
#define UPX_RSIZE_MAX_STR (1024 * 1024)
/*************************************************************************
// portab
@@ -234,15 +183,13 @@
# define STDERR_FILENO (fileno(stderr))
#endif
#if !defined(HAVE_STRCASECMP) && defined(HAVE_STRICMP)
#if !(HAVE_STRCASECMP) && (HAVE_STRICMP)
# define strcasecmp stricmp
#endif
#if !defined(HAVE_STRNCASECMP) && defined(HAVE_STRNICMP)
#if !(HAVE_STRNCASECMP) && (HAVE_STRNICMP)
# define strncasecmp strnicmp
#endif
#if !defined(S_IWUSR) && defined(_S_IWUSR)
# define S_IWUSR _S_IWUSR
#elif !defined(S_IWUSR) && defined(_S_IWRITE)
@@ -282,7 +229,6 @@
# endif
#endif
// avoid warnings about shadowing global functions
#undef index
#define basename upx_basename
@@ -292,6 +238,11 @@
#undef PAGE_MASK
#undef PAGE_SIZE
#if !defined(O_BINARY) || (O_BINARY+0 == 0)
# if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# error "missing O_BINARY"
# endif
#endif
#if !defined(O_BINARY)
# define O_BINARY 0
#endif
@@ -301,30 +252,26 @@
#endif
#undef __attribute_packed
#if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE)
# if (ACC_ARCH_I386) && (ACC_CC_INTELC && (__INTEL_COMPILER < 800))
# elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386))
# else
# define __attribute_packed __attribute__((__packed__,__aligned__(1)))
# endif
#endif
#if !defined(__attribute_packed)
# define __attribute_packed
#endif
/*************************************************************************
//
**************************************************************************/
#if (ACC_CC_MSC)
#define __packed_struct(s) struct s {
#define __packed_struct_end() };
#else
#define __packed_struct(s) __acc_struct_packed(s)
#define __packed_struct_end() __acc_struct_packed_end()
#endif
#define UNUSED(var) ACC_UNUSED(var)
#define COMPILE_TIME_ASSERT(e) ACC_COMPILE_TIME_ASSERT(e)
#define __COMPILE_TIME_ASSERT_ALIGNOF_SIZEOF(a,b) { \
typedef a acc_tmp_a_t; typedef b acc_tmp_b_t; \
struct acc_tmp_t { acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; } __attribute_packed; \
__packed_struct(acc_tmp_t) acc_tmp_b_t x; acc_tmp_a_t y; acc_tmp_b_t z; __packed_struct_end() \
COMPILE_TIME_ASSERT(sizeof(struct acc_tmp_t) == 2*sizeof(b)+sizeof(a)) \
COMPILE_TIME_ASSERT(sizeof(((acc_tmp_t*)0)->x)+sizeof(((acc_tmp_t*)0)->y)+sizeof(((acc_tmp_t*)0)->z) == 2*sizeof(b)+sizeof(a)) \
}
#if defined(__acc_alignof)
# define __COMPILE_TIME_ASSERT_ALIGNOF(a,b) \
@@ -339,52 +286,35 @@
#define TABLESIZE(table) ((sizeof(table)/sizeof((table)[0])))
#if 0
#define ALIGN_DOWN(a,b) (((a) / (b)) * (b))
#define ALIGN_UP(a,b) ALIGN_DOWN((a) + ((b) - 1), b)
#define ALIGN_GAP(a,b) (ALIGN_UP(a,b) - (a))
#elif 1
template <class T>
inline T ALIGN_DOWN(const T& a, const T& b) { T r; r = (a / b) * b; return r; }
template <class T>
inline T ALIGN_UP (const T& a, const T& b) { T r; r = ((a + b - 1) / b) * b; return r; }
template <class T>
inline T ALIGN_GAP (const T& a, const T& b) { T r; r = ALIGN_UP(a, b) - a; return r; }
#else
inline unsigned ALIGN_DOWN(unsigned a, unsigned b) { return (a / b) * b; }
inline unsigned ALIGN_UP (unsigned a, unsigned b) { return ((a + b - 1) / b) * b; }
inline unsigned ALIGN_GAP (unsigned a, unsigned b) { return ALIGN_UP(a, b) - a; }
#endif
#if 0
#define UPX_MAX(a,b) ((a) >= (b) ? (a) : (b))
#define UPX_MIN(a,b) ((a) <= (b) ? (a) : (b))
#elif 1
template <class T>
inline const T& UPX_MAX(const T& a, const T& b) { if (a < b) return b; return a; }
template <class T>
inline const T& UPX_MIN(const T& a, const T& b) { if (a < b) return a; return b; }
#else
inline unsigned UPX_MAX(unsigned a, unsigned b) { return a < b ? b : a; }
inline unsigned UPX_MIN(unsigned a, unsigned b) { return a < b ? a : b; }
#endif
// An Array allocates memory on the heap, but automatically
// gets destructed when leaving scope or on exceptions.
#define Array(type, var, size) \
assert((int)(size) > 0); \
MemBuffer var ## _membuf((size)*(sizeof(type))); \
type * const var = ((type *) var ## _membuf.getVoidPtr())
MemBuffer var ## _membuf(mem_size(sizeof(type), size)); \
type * const var = ACC_STATIC_CAST(type *, var ## _membuf.getVoidPtr())
#define ByteArray(var, size) Array(unsigned char, var, size)
struct nocopy
class noncopyable
{
inline nocopy() {}
protected:
inline noncopyable() {}
inline ~noncopyable() {}
private:
nocopy(const nocopy &); // undefined
nocopy& operator=(const nocopy &); // undefined
noncopyable(const noncopyable &); // undefined
const noncopyable& operator=(const noncopyable &); // undefined
};
@@ -431,41 +361,65 @@ private:
#define UPX_F_DOS_EXE 3
#define UPX_F_DJGPP2_COFF 4
#define UPX_F_WATCOM_LE 5
#define UPX_F_VXD_LE 6
#define UPX_F_DOS_EXEH 7 /* OBSOLETE */
#define UPX_F_VXD_LE 6 // NOT IMPLEMENTED
#define UPX_F_DOS_EXEH 7 // OBSOLETE
#define UPX_F_TMT_ADAM 8
#define UPX_F_WIN32_PE 9
#define UPX_F_LINUX_i386 10
#define UPX_F_WIN16_NE 11
#define UPX_F_WIN16_NE 11 // NOT IMPLEMENTED
#define UPX_F_LINUX_ELF_i386 12
#define UPX_F_LINUX_SEP_i386 13
#define UPX_F_LINUX_SEP_i386 13 // NOT IMPLEMENTED
#define UPX_F_LINUX_SH_i386 14
#define UPX_F_VMLINUZ_i386 15
#define UPX_F_BVMLINUZ_i386 16
#define UPX_F_ELKS_8086 17
#define UPX_F_ELKS_8086 17 // NOT IMPLEMENTED
#define UPX_F_PS1_EXE 18
#define UPX_F_VMLINUX_i386 19
#define UPX_F_LINUX_ELFI_i386 20
#define UPX_F_WINCE_ARM_PE 21
#define UPX_F_LINUX_ELF64_AMD 22
#define UPX_F_LINUX_ELF32_ARMLE 23
#define UPX_F_LINUX_ELF32_ARMEL 23
#define UPX_F_BSD_i386 24
#define UPX_F_BSD_ELF_i386 25
#define UPX_F_BSD_SH_i386 26
#define UPX_F_VMLINUX_AMD64 27
#define UPX_F_VMLINUX_ARM 28
#define UPX_F_VMLINUX_ARMEL 28
#define UPX_F_MACH_i386 29
#define UPX_F_LINUX_ELF32_MIPSEL 30
#define UPX_F_VMLINUZ_ARMEL 31
#define UPX_F_MACH_ARMEL 32
#define UPX_F_PLAIN_TEXT 127
#define UPX_F_DYLIB_i386 33
#define UPX_F_MACH_AMD64 34
#define UPX_F_DYLIB_AMD64 35
#define UPX_F_WIN64_PEP 36
#define UPX_F_MACH_ARM64EL 37
#define UPX_F_MACH_PPC64LE 38
#define UPX_F_LINUX_ELFPPC64LE 39
#define UPX_F_VMLINUX_PPC64LE 40
#define UPX_F_DYLIB_PPC64LE 41
#define UPX_F_LINUX_ELF64_ARM 42
#define UPX_F_ATARI_TOS 129
#define UPX_F_SOLARIS_SPARC 130
#define UPX_F_SOLARIS_SPARC 130 // NOT IMPLEMENTED
#define UPX_F_MACH_PPC32 131
#define UPX_F_LINUX_ELFPPC32 132
#define UPX_F_LINUX_ELF32_ARMBE 133
#define UPX_F_LINUX_ELF32_ARMEB 133
#define UPX_F_MACH_FAT 134
#define UPX_F_VMLINUX_ARMEB 135
#define UPX_F_VMLINUX_PPC32 136
#define UPX_F_LINUX_ELF32_MIPSEB 137
#define UPX_F_DYLIB_PPC32 138
#define UPX_F_MACH_PPC64 139
#define UPX_F_LINUX_ELFPPC64 140
#define UPX_F_VMLINUX_PPC64 141
#define UPX_F_DYLIB_PPC64 142
// compression methods
#define M_ALL (-1)
@@ -509,13 +463,7 @@ private:
**************************************************************************/
struct upx_callback_t;
#define upx_callback_p upx_callback_t *
#if 0
typedef void* (__acc_cdecl *upx_alloc_func_t)
(upx_callback_p self, unsigned items, unsigned size);
typedef void (__acc_cdecl *upx_free_func_t)
(upx_callback_p self, void* ptr);
#endif
typedef upx_callback_t *upx_callback_p;
typedef void (__acc_cdecl *upx_progress_func_t)
(upx_callback_p, unsigned, unsigned);
@@ -532,34 +480,30 @@ struct upx_callback_t
// compression - config_t
**************************************************************************/
template <class T, T default_value, T min_value, T max_value>
template <class T, T default_value_, T min_value_, T max_value_>
struct OptVar
{
typedef T Type;
static const T default_value_c = default_value;
static const T min_value_c = min_value;
static const T max_value_c = max_value;
typedef T value_type;
static const T default_value = default_value_;
static const T min_value = min_value_;
static const T max_value = max_value_;
void assertValue() {
// FIXME: this generates annoying warnings "unsigned >= 0 is always true"
//assert((v >= min_value) && (v <= max_value));
static void assertValue(const T &v) {
// info: this generates annoying warnings "unsigned >= 0 is always true"
//assert(v >= min_value);
assert(v == min_value || v >= min_value + 1);
assert(v <= max_value);
}
void assertValue() const {
assertValue(v);
}
OptVar() : v(default_value), is_set(0) { }
OptVar& operator= (const T other) {
v = other; is_set += 1;
OptVar& operator= (const T &other) {
v = other; is_set = 1;
assertValue();
return *this;
}
#if 0
#error
// there is too much implicit magic in this copy operator;
// better introduce an explicit "oassign" function.
OptVar& operator= (const OptVar& other) {
if (other.is_set) { v = other.v; is_set += 1; }
assertValue(); return *this;
}
#endif
void reset() { v = default_value; is_set = 0; }
operator T () const { return v; }
@@ -570,24 +514,20 @@ struct OptVar
// optional assignments
template <class T> inline void oassign(T& self, const T& other) {
if (other.is_set) { self.v = other.v; self.is_set += 1; }
template <class T, T a, T b, T c>
inline void oassign(OptVar<T,a,b,c> &self, const OptVar<T,a,b,c> &other) {
if (other.is_set) { self.v = other.v; self.is_set = 1; }
}
#if 0
template <class V, class T> inline void oassign(V& v, const T& other) {
template <class T, T a, T b, T c>
inline void oassign(T &v, const OptVar<T,a,b,c> &other) {
if (other.is_set) { v = other.v; }
}
#else
template <class T> inline void oassign(unsigned& v, const T& other) {
if (other.is_set) { v = other.v; }
}
#endif
struct lzma_compress_config_t
{
typedef OptVar<unsigned, 2u, 0u, 4u> pos_bits_t; // pb
typedef OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lb
typedef OptVar<unsigned, 0u, 0u, 4u> lit_pos_bits_t; // lp
typedef OptVar<unsigned, 3u, 0u, 8u> lit_context_bits_t; // lc
typedef OptVar<unsigned, (1u<<22), 1u, (1u<<30) > dict_size_t;
typedef OptVar<unsigned, 64u, 5u, 273u> num_fast_bytes_t;
@@ -693,10 +633,7 @@ struct upx_compress_result_t
// globals
**************************************************************************/
#include "snprintf.h"
#if defined(__cplusplus)
#include "snprintf.h" // must get included first!
#include "stdcxx.h"
#include "options.h"
#include "except.h"
@@ -712,8 +649,8 @@ typedef ElfLinker Linker;
// main.cpp
extern const char *progname;
bool set_ec(int ec);
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
bool set_exit_code(int ec);
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
void e_exit(int ec) __attribute__((__noreturn__));
#else
void e_exit(int ec);
@@ -725,7 +662,7 @@ void printSetNl(int need_nl);
void printClearLine(FILE *f = NULL);
void printErr(const char *iname, const Throwable *e);
void printUnhandledException(const char *iname, const std::exception *e);
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
__attribute__((__format__(__printf__,2,3)));
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
@@ -735,7 +672,7 @@ void __acc_cdecl_va printErr(const char *iname, const char *format, ...);
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
#endif
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
void __acc_cdecl_va infoWarning(const char *format, ...)
__attribute__((__format__(__printf__,1,2)));
void __acc_cdecl_va infoHeader(const char *format, ...)
@@ -757,6 +694,7 @@ void do_files(int i, int argc, char *argv[]);
// help.cpp
extern const char gitrev[];
void show_head(void);
void show_help(int verbose=0);
void show_license(void);
@@ -778,15 +716,14 @@ int upx_decompress ( const upx_bytep src, unsigned src_len,
upx_bytep dst, unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
unsigned src_len, unsigned* dst_len,
int upx_test_overlap ( const upx_bytep buf,
const upx_bytep tbuf,
unsigned src_off, unsigned src_len,
unsigned* dst_len,
int method,
const upx_compress_result_t *cresult );
#endif /* __cplusplus */
#if (ACC_OS_CYGWIN || ACC_OS_DOS16 || ACC_OS_DOS32 || ACC_OS_EMX || ACC_OS_OS2 || ACC_OS_OS216 || ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
# if defined(INVALID_HANDLE_VALUE) || defined(MAKEWORD) || defined(RT_CURSOR)
# error "something pulled in <windows.h>"
@@ -796,8 +733,4 @@ int upx_test_overlap ( const upx_bytep buf, unsigned src_off,
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+24 -28
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -39,41 +39,41 @@
#undef USE_SCREEN_WIN32
#undef USE_FRAMES
#if defined(WITH_GUI) && !defined(NO_CONSOLE)
# define NO_CONSOLE
#if 1 && (WITH_GUI) && !defined(NO_CONSOLE)
# define NO_CONSOLE 1
#endif
#if 1 && defined(__linux__)
# define USE_SCREEN
# define USE_SCREEN_VCSA
# if !defined(HAVE_LINUX_KD_H)
# define USE_SCREEN 1
# define USE_SCREEN_VCSA 1
# if !(HAVE_LINUX_KD_H)
# undef USE_SCREEN
# undef USE_SCREEN_VCSA
# endif
# if !defined(HAVE_LINUX_KDEV_T_H) || !defined(HAVE_LINUX_MAJOR_H)
# if !(HAVE_LINUX_KDEV_T_H) || !(HAVE_LINUX_MAJOR_H)
# undef USE_SCREEN
# undef USE_SCREEN_VCSA
# endif
#endif
#if 1 && defined(__DJGPP__)
# define USE_SCREEN
#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
# define USE_SCREEN 1
#elif 1 && (ACC_OS_CYGWIN || ACC_OS_WIN32 || ACC_OS_WIN64)
# define USE_SCREEN
# define USE_SCREEN_WIN32
# define USE_SCREEN 1
# define USE_SCREEN_WIN32 1
#elif 1 && (ACC_OS_EMX && defined(__RSXNT__))
# define USE_SCREEN
# define USE_SCREEN_WIN32
# define USE_SCREEN 1
# define USE_SCREEN_WIN32 1
#endif
#if 0 || defined(NO_ANSI)
#if 0 || (NO_ANSI)
# undef USE_ANSI
#endif
#if 0 || defined(NO_SCREEN)
#if 0 || (NO_SCREEN)
# undef USE_SCREEN
#endif
#if 0 || defined(NO_FRAMES) || !defined(USE_SCREEN)
#if 0 || (NO_FRAMES) || !(USE_SCREEN)
# undef USE_FRAMES
#endif
#if 1
@@ -81,11 +81,11 @@
#endif
#if 0 || defined(USE_ANSI) || defined(USE_SCREEN)
# define USE_CONSOLE
#if 0 || (USE_ANSI) || (USE_SCREEN)
# define USE_CONSOLE 1
#endif
#if 0 || defined(NO_CONSOLE) || !defined(USE_CONSOLE)
#if 0 || (NO_CONSOLE) || !(USE_CONSOLE)
# undef USE_CONSOLE
# undef USE_ANSI
# undef USE_SCREEN
@@ -110,7 +110,7 @@ enum {
};
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
typedef struct
{
@@ -165,7 +165,7 @@ void __acc_cdecl_va con_fprintf(FILE *f, const char *format, ...);
extern FILE *con_term;
#if defined(USE_CONSOLE)
#if (USE_CONSOLE)
extern int con_mode;
extern console_t *con;
@@ -187,8 +187,4 @@ extern console_t console_screen;
#endif /* USE_CONSOLE */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+16 -12
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -33,7 +33,7 @@
//
**************************************************************************/
long Throwable::counter = 0;
unsigned long Throwable::counter = 0;
Throwable::Throwable(const char *m, int e, bool w) NOTHROW
: super(), msg(NULL), err(e), is_warning(w)
@@ -41,7 +41,7 @@ Throwable::Throwable(const char *m, int e, bool w) NOTHROW
if (m)
msg = strdup(m);
#if 0
fprintf(stderr, "construct exception: %s %ld\n", msg, counter);
fprintf(stderr, "construct exception: %s %lu\n", msg, counter);
counter++;
#endif
}
@@ -53,7 +53,7 @@ Throwable::Throwable(const Throwable &other) NOTHROW
if (other.msg)
msg = strdup(other.msg);
#if 0
fprintf(stderr, "copy exception: %s %ld\n", msg, counter);
fprintf(stderr, "copy exception: %s %lu\n", msg, counter);
counter++;
#endif
}
@@ -63,7 +63,7 @@ Throwable::~Throwable() NOTHROW
{
#if 0
counter--;
fprintf(stderr, "destruct exception: %s %ld\n", msg, counter);
fprintf(stderr, "destruct exception: %s %lu\n", msg, counter);
#endif
if (msg)
free(msg);
@@ -161,6 +161,14 @@ void throwBadLoader()
}
void throwOutOfMemoryException(const char *msg)
{
if (msg == NULL)
msg = "out of memory";
throw OutOfMemoryException(msg);
}
void throwIOException(const char *msg, int e)
{
throw IOException(msg, e);
@@ -197,8 +205,4 @@ const char *prettyName(const char *n) NOTHROW
return n;
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+10 -14
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_EXCEPT_H
#define __UPX_EXCEPT_H
#define __UPX_EXCEPT_H 1
#ifdef __cplusplus
@@ -62,7 +62,7 @@ private:
DISABLE_NEW_DELETE
private:
static long counter; // for debugging
static unsigned long counter; // for debugging
};
@@ -129,7 +129,7 @@ public:
/*************************************************************************
// application execptions
// application exceptions
**************************************************************************/
class OverlayException : public Exception
@@ -200,11 +200,10 @@ public:
**************************************************************************/
#undef NORET
#if 0 && defined(__GNUC__)
// (noreturn) is probably not the correct semantics for throwing exceptions
#if 1 && defined(__GNUC__)
#define NORET __attribute__((__noreturn__))
#else
#define NORET
#define NORET /*empty*/
#endif
void throwCantPack(const char *msg) NORET;
@@ -220,6 +219,7 @@ void throwBadLoader() NORET;
void throwChecksumError() NORET;
void throwCompressedDataViolation() NORET;
void throwInternalError(const char *msg) NORET;
void throwOutOfMemoryException(const char *msg = NULL) NORET;
void throwIOException(const char *msg = NULL, int e = 0) NORET;
void throwEOFException(const char *msg = NULL, int e = 0) NORET;
@@ -230,8 +230,4 @@ void throwEOFException(const char *msg = NULL, int e = 0) NORET;
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+69 -30
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -37,7 +37,7 @@
void File::chmod(const char *name, int mode)
{
#if defined(HAVE_CHMOD)
#if (HAVE_CHMOD)
if (::chmod(name,mode) != 0)
throwIOException(name,errno);
#else
@@ -48,7 +48,7 @@ void File::chmod(const char *name, int mode)
void File::rename(const char *old_, const char *new_)
{
#if defined(__DJGPP__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
if (::_rename(old_,new_) != 0)
#else
if (::rename(old_,new_) != 0)
@@ -88,26 +88,28 @@ FileBase::~FileBase()
}
void FileBase::sopen()
bool FileBase::do_sopen()
{
if (_shflags < 0)
_fd = ::open(_name, _flags, _mode);
else
{
#if defined(__DJGPP__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
_fd = ::open(_name,_flags | _shflags, _mode);
#elif defined(__MINT__)
_fd = ::open(_name,_flags | (_shflags & O_SHMODE), _mode);
#elif defined(SH_DENYRW)
_fd = ::sopen(_name, _flags, _shflags, _mode);
#else
assert(0);
throwInternalError("bad usage of do_sopen()");
#endif
}
if (!(_fd < 0)) {
::fstat(_fd, &st);
if (_fd < 0)
return false;
if (::fstat(_fd, &st) != 0)
throwIOException(_name, errno);
_length = st.st_size;
}
return true;
}
@@ -138,6 +140,7 @@ int FileBase::read(void *buf, int len)
{
if (!isOpen() || len < 0)
throwIOException("bad read");
mem_size_assert(1, len); // sanity check
errno = 0;
long l = acc_safe_hread(_fd, buf, len);
if (errno)
@@ -159,6 +162,7 @@ void FileBase::write(const void *buf, int len)
{
if (!isOpen() || len < 0)
throwIOException("bad write");
mem_size_assert(1, len); // sanity check
errno = 0;
long l = acc_safe_hwrite(_fd, buf, len);
if (l != len)
@@ -166,8 +170,10 @@ void FileBase::write(const void *buf, int len)
}
void FileBase::seek(off_t off, int whence)
off_t FileBase::seek(upx_int64_t off64, int whence)
{
mem_size_assert(1, off64 >= 0 ? off64 : -off64); // sanity check
off_t off = ACC_ICONV(off_t, off64);
if (!isOpen())
throwIOException("bad seek 1");
if (whence == SEEK_SET) {
@@ -183,6 +189,7 @@ void FileBase::seek(off_t off, int whence)
}
if (::lseek(_fd,off,whence) < 0)
throwIOException("seek error",errno);
return off - _offset;
}
@@ -232,8 +239,7 @@ void InputFile::sopen(const char *name, int flags, int shflags)
_mode = 0;
_offset = 0;
_length = 0;
FileBase::sopen();
if (!isOpen())
if (!FileBase::do_sopen())
{
if (errno == ENOENT)
throw FileNotFoundException(_name, errno);
@@ -242,6 +248,7 @@ void InputFile::sopen(const char *name, int flags, int shflags)
else
throwIOException(_name, errno);
}
_length_orig = _length;
}
@@ -282,9 +289,12 @@ int InputFile::readx(MemBuffer &buf, int len)
}
void InputFile::seek(off_t off, int whence)
off_t InputFile::seek(upx_int64_t off64, int whence)
{
super::seek(off,whence);
off_t pos = super::seek(off64, whence);
if (_length < pos)
throwIOException("bad seek 4");
return pos;
}
@@ -293,6 +303,10 @@ off_t InputFile::tell() const
return super::tell();
}
off_t InputFile::st_size_orig() const
{
return _length_orig;
}
/*************************************************************************
//
@@ -318,8 +332,7 @@ void OutputFile::sopen(const char *name, int flags, int shflags, int mode)
_mode = mode;
_offset = 0;
_length = 0;
FileBase::sopen();
if (!isOpen())
if (!FileBase::do_sopen())
{
#if 0
// don't throw FileNotFound here -- this is confusing
@@ -366,7 +379,9 @@ off_t OutputFile::st_size() const
return bytes_written; // too big if seek()+write() instead of rewrite()
}
struct stat my_st;
::fstat(_fd, &my_st);
my_st.st_size = 0;
if (::fstat(_fd, &my_st) != 0)
throwIOException(_name, errno);
return my_st.st_size;
}
@@ -391,26 +406,54 @@ void OutputFile::rewrite(const void *buf, int len)
bytes_written -= len; // restore
}
void OutputFile::seek(off_t off, int whence)
off_t OutputFile::seek(upx_int64_t off64, int whence)
{
mem_size_assert(1, off64 >= 0 ? off64 : -off64); // sanity check
off_t off = ACC_ICONV(off_t, off64);
assert(!opt->to_stdout);
super::seek(off,whence);
switch (whence) {
case SEEK_SET: {
if (bytes_written < off) {
bytes_written = off;
}
_length = bytes_written; // cheap, lazy update; needed?
} break;
case SEEK_END: {
_length = bytes_written; // necessary
} break;
}
return super::seek(off,whence);
}
// WARNING: fsync() does not exist in some Windows environments.
// This trick works only on UNIX-like systems.
//int OutputFile::read(void *buf, int len)
//{
// fsync(_fd);
// InputFile infile;
// infile.open(this->getName(), O_RDONLY | O_BINARY);
// infile.seek(this->tell(), SEEK_SET);
// return infile.read(buf, len);
//}
void OutputFile::set_extent(off_t offset, off_t length)
{
super::set_extent(offset, length);
bytes_written = 0;
if (0==offset && (off_t)~0u==length) {
::fstat(_fd, &st);
if (::fstat(_fd, &st) != 0)
throwIOException(_name, errno);
_length = st.st_size - offset;
}
}
off_t OutputFile::unset_extent()
{
off_t l = ::lseek(_fd, 0, SEEK_END);
if (l < 0)
throwIOException("lseek error", errno);
_offset = 0;
_length = ::lseek(_fd, 0, SEEK_END);
_length = l;
bytes_written = _length;
return _length;
}
@@ -418,8 +461,8 @@ off_t OutputFile::unset_extent()
void OutputFile::dump(const char *name, const void *buf, int len, int flags)
{
if (flags < 0)
flags = O_CREAT | O_BINARY | O_TRUNC;
flags |= O_WRONLY;
flags = O_CREAT | O_TRUNC;
flags |= O_WRONLY | O_BINARY;
OutputFile f;
f.open(name, flags, 0600);
f.write(buf, len);
@@ -455,8 +498,4 @@ void MemoryOutputFile::write(const void *buf, int len)
#endif /* if 0 */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+12 -13
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_FILE_H
#define __UPX_FILE_H
#define __UPX_FILE_H 1
class MemBuffer;
@@ -63,11 +63,11 @@ public:
virtual void set_extent(off_t offset, off_t length);
protected:
void sopen();
bool do_sopen();
virtual int read(void *buf, int len);
virtual int readx(void *buf, int len);
virtual void write(const void *buf, int len);
virtual void seek(off_t off, int whence);
virtual off_t seek(upx_int64_t off, int whence);
virtual off_t tell() const;
int _fd;
@@ -106,8 +106,11 @@ public:
virtual int read(MemBuffer &buf, int len);
virtual int readx(MemBuffer &buf, int len);
virtual void seek(off_t off, int whence);
virtual off_t seek(upx_int64_t off, int whence);
virtual off_t tell() const;
virtual off_t st_size_orig() const;
protected:
off_t _length_orig;
};
@@ -139,7 +142,7 @@ public:
virtual off_t st_size() const; // { return _length; }
// FIXME - these won't work when using the '--stdout' option
virtual void seek(off_t off, int whence);
virtual off_t seek(upx_int64_t off, int whence);
virtual void rewrite(const void *buf, int len);
// util
@@ -182,8 +185,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+4 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -228,8 +228,4 @@ bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
return false;
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+5 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_FILTER_H
#define __UPX_FILTER_H
#define __UPX_FILTER_H 1
class Filter;
class FilterImp;
@@ -131,8 +131,4 @@ private:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+44 -6
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -459,7 +459,45 @@ static int s_ct24arm_be(Filter *f)
#undef CT24ARM_BE
#undef ARMCT_COND
/*
vi:ts=4:et:nowrap
*/
/*************************************************************************
// 26-bit ARM calltrick ("naive")
**************************************************************************/
#define CT26ARM_LE(f, cond, addvalue, get, set) \
upx_byte *b = f->buf; \
upx_byte *b_end = b + f->buf_len - 4; \
do { \
if (cond) \
{ \
unsigned a = (unsigned) (b - f->buf); \
f->lastcall = a; \
set(b, get(b) + (addvalue)); \
f->calls++; \
} \
b += 4; \
} while (b < b_end); \
if (f->lastcall) f->lastcall += 4; \
return 0;
#define ARMCT_COND (((b[3] & 0x7C) == 0x14))
static int f_ct26arm_le(Filter *f)
{
CT26ARM_LE(f, ARMCT_COND, a / 4 + f->addvalue, get_le26, set_le26)
}
static int u_ct26arm_le(Filter *f)
{
CT26ARM_LE(f, ARMCT_COND, 0 - a / 4 - f->addvalue, get_le26, set_le26)
}
static int s_ct26arm_le(Filter *f)
{
CT26ARM_LE(f, ARMCT_COND, a + f->addvalue, get_le26, set_dummy)
}
#undef CT26ARM_LE
#undef ARMCT_COND
/* vim:set ts=4 sw=4 et: */
+6 -10
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -47,7 +47,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
@@ -126,7 +126,7 @@ static int F(Filter *f)
f->noncalls = noncalls;
f->lastcall = lastcall;
#ifdef TESTING
#if 0 || defined(TESTING)
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
#endif
return 0;
@@ -169,8 +169,4 @@ static int U(Filter *f)
#undef F
#undef U
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+7 -11
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -51,7 +51,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
@@ -125,7 +125,7 @@ static int F(Filter *f)
f->noncalls = noncalls;
f->lastcall = lastcall;
#ifdef TESTING
#if 0 || defined(TESTING)
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
#endif
return 0;
@@ -168,8 +168,4 @@ static int U(Filter *f)
#undef F
#undef U
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+14 -15
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -62,7 +62,7 @@ f80_jcc2(Filter const *f)
return f80_jmp1(f);
}
static int const N_MRU = 32; // does not have to be a power of 2
#define N_MRU 32 // does not have to be a power of 2
// Adaptively remember recent destinations.
static void
@@ -123,8 +123,8 @@ static int F(Filter *f)
N_MRU : 0;
#endif //}
// FIXME: We must fit into 8MB because we steal one bit.
// find a 16MB large empty address space
// FIXME: We must fit into 8 MiB because we steal one bit.
// find a 16 MiB large empty address space
{
int which;
unsigned char buf[256];
@@ -249,11 +249,11 @@ static int F(Filter *f)
f->noncalls = noncalls;
f->lastcall = lastcall;
/*#ifdef TESTING*/
#if 0 || defined(TESTING)
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",
calls,noncalls,noncalls2,size,cto8);
printf("CALL/JMP/JCC %d %d %d\n",wtally[0],wtally[1],wtally[2]);
/*#endif*/
#endif
return 0;
}
@@ -300,6 +300,9 @@ static int U(Filter *f)
}
else { // not 1st time at this destination
jc >>= 1;
if (N_MRU <= jc) {
throwCompressedDataViolation();
}
int kh = jc + hand;
if (N_MRU <= kh) {
kh -= N_MRU;
@@ -337,12 +340,8 @@ static int U(Filter *f)
}
#endif
#undef N_MRU
#undef F
#undef U
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+7 -11
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -52,7 +52,7 @@ static int F(Filter *f)
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
unsigned lastnoncall = size, lastcall = 0;
// find a 16MB large empty address space
// find a 16 MiB large empty address space
{
unsigned char buf[256];
memset(buf,0,256);
@@ -126,7 +126,7 @@ static int F(Filter *f)
f->noncalls = noncalls;
f->lastcall = lastcall;
#ifdef TESTING
#if 0 || defined(TESTING)
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
#endif
return 0;
@@ -171,8 +171,4 @@ static int U(Filter *f)
#undef F
#undef U
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -166,8 +166,4 @@ static int s_ctsw32_e9_e8(Filter *f)
#undef CTSW32
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -67,9 +67,4 @@ static int getcto(Filter *f, const unsigned char *buf, const int n=256)
return ic;
}
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+16 -15
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2004-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2004-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -47,7 +47,7 @@ static int F(Filter *f)
// scan
const upx_byte *b = f->buf;
#endif
const unsigned size = umin(f->buf_len, -(~0u<<(32 - (6+ W_CTO))));
const unsigned size = umin(f->buf_len, 0u - (~0u<<(32 - (6+ W_CTO))));
const unsigned size4 = size -4;
unsigned ic;
@@ -72,9 +72,11 @@ static int F(Filter *f)
}
if (getcto(f, buf) < 0) {
if (0!=W_CTO) // FIXME: what is this ???
#if (W_CTO != 0)
return -1;
#else
f->cto = 0;
#endif
}
}
const unsigned char cto8 = f->cto;
@@ -95,8 +97,9 @@ static int F(Filter *f)
lastcall = ic;
}
else {
assert(0==W_CTO // FIXME: what is this ???
|| (~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != cto8); // this should not happen
#if (W_CTO != 0)
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != (unsigned) cto8); // this should not happen
#endif
lastnoncall = ic;
noncalls++;
}
@@ -105,8 +108,9 @@ static int F(Filter *f)
f->calls = calls;
f->noncalls = noncalls;
f->lastcall = lastcall;
ACC_UNUSED(lastnoncall);
#if 0
#if 0 || defined(TESTING)
printf("\ncalls=%d noncalls=%d text_size=%x calltrickoffset=%x\n",
calls,noncalls,size,cto8);
#endif
@@ -122,14 +126,14 @@ static int F(Filter *f)
static int U(Filter *f)
{
upx_byte *b = f->buf;
const unsigned size4 = umin(f->buf_len - 4, -(~0u<<(32 - (6+ W_CTO))));
const unsigned size4 = umin(f->buf_len - 4, 0u - (~0u<<(32 - (6+ W_CTO))));
const unsigned addvalue = f->addvalue;
unsigned ic;
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
unsigned const word = get_be32(b+ic);
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == f->cto) {
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == (unsigned) f->cto) {
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
f->calls++;
@@ -149,7 +153,4 @@ static int U(Filter *f)
#undef W_CTO
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -79,9 +79,4 @@
assert((int)f->calls > 0); \
return 0;
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -115,8 +115,4 @@ static int s_sub16_4(Filter *f)
#undef ADD16
#undef SCAN16
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -115,8 +115,4 @@ static int s_sub32_4(Filter *f)
#undef ADD32
#undef SCAN32
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -115,8 +115,4 @@ static int s_sub8_4(Filter *f)
#undef ADD8
#undef SCAN8
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+4 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -180,9 +180,4 @@ static int s_sw32_e8e9(Filter *f)
#undef SW32
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+7 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -228,6 +228,9 @@ const FilterImp::FilterEntry FilterImp::filters[] = {
{ 0x50, 8, 0x01ffffff, f_ct24arm_le, u_ct24arm_le, s_ct24arm_le },
{ 0x51, 8, 0x01ffffff, f_ct24arm_be, u_ct24arm_be, s_ct24arm_be },
// 26-bit calltrick for arm64
{ 0x52, 8, 0x03ffffff, f_ct26arm_le, u_ct26arm_le, s_ct26arm_le },
// 32-bit cto calltrick with jmp and jcc(swap 0x0f/0x8Y) and relative renumbering
{ 0x80, 8, 0x00ffffff, f_ctojr32_e8e9_bswap_le, u_ctojr32_e8e9_bswap_le, s_ctojr32_e8e9_bswap_le },
{ 0x81, 8, 0x00ffffff, f_ctojr32_e8e9_bswap_le, u_ctojr32_e8e9_bswap_le, s_ctojr32_e8e9_bswap_le },
@@ -260,8 +263,4 @@ const FilterImp::FilterEntry FilterImp::filters[] = {
const int FilterImp::n_filters = TABLESIZE(filters);
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+66 -85
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -38,6 +38,12 @@
static bool head_done = 0;
#if defined(UPX_VERSION_GITREV)
const char gitrev[] = UPX_VERSION_GITREV;
#else
const char gitrev[1] = { 0 };
#endif
void show_head(void)
{
FILE *f = con_term;
@@ -51,14 +57,20 @@ void show_head(void)
fg = con_fg(f,FG_GREEN);
con_fprintf(f,
" Ultimate Packer for eXecutables\n"
" Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007\n"
"UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
#if (ACC_OS_DOS16 || ACC_OS_DOS32)
" Copyright (C) 1996 - " UPX_VERSION_YEAR "\n"
#if defined(UPX_VERSION_GITREV)
"UPX git-%6.6s%c"
#else
"UPX %-11s"
#endif
" Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
#if defined(UPX_VERSION_GITREV)
gitrev,
(sizeof(gitrev)-1 > 6 && gitrev[sizeof(gitrev)-2] == '+') ? '+' : ' ',
#elif (ACC_OS_DOS16 || ACC_OS_DOS32)
V("d"),
#elif (ACC_OS_WIN16 || ACC_OS_WIN32 || ACC_OS_WIN64)
V("w"),
#elif 0 && defined(__linux__)
V("l"),
#else
UPX_VERSION_STRING,
#endif
@@ -79,7 +91,7 @@ void show_usage(void)
FILE *f = con_term;
con_fprintf(f,"Usage: %s [-123456789dlthVL] [-qvfk] [-o file] %sfile..\n", progname,
#if defined(__DJGPP__) || defined(__EMX__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
"[@]");
#else
"");
@@ -97,14 +109,14 @@ struct PackerNames
const char* fname;
const char* sname;
};
Entry names[32];
Entry names[64];
size_t names_count;
const options_t *o;
PackerNames() : names_count(0), o(NULL) { }
void add(const Packer *p)
{
p->assertPacker();
assert(names_count < 32);
assert(names_count < 64);
names[names_count].fname = p->getFullName(o);
names[names_count].sname = p->getName();
names_count++;
@@ -113,6 +125,7 @@ struct PackerNames
{
PackerNames *self = (PackerNames *) user;
self->add(p);
delete p; p = NULL;
return NULL;
}
static int __acc_cdecl_qsort cmp_fname(const void *a, const void *b) {
@@ -127,32 +140,33 @@ static void show_all_packers(FILE *f, int verbose)
{
options_t o; o.reset();
PackerNames pn; pn.o = &o;
PackMaster::visitAllPackers(pn.visit, NULL, &o, &pn);
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), pn.cmp_fname);
PackMaster::visitAllPackers(PackerNames::visit, NULL, &o, &pn);
qsort(pn.names, pn.names_count, sizeof(PackerNames::Entry), PackerNames::cmp_fname);
size_t pos = 0;
for (size_t i = 0; i < pn.names_count; ++i)
{
const char *fn = pn.names[i].fname;
const char *sn = pn.names[i].sname;
if (verbose)
if (verbose > 0)
{
con_fprintf(f, " %-32s %s\n", fn, sn);
con_fprintf(f, " %-36s %s\n", fn, sn);
}
else
{
size_t fl = strlen(fn);
if (pos == 0) {
con_fprintf(f, " %s", fn);
pos = 2 + strlen(fn);
} else if (pos + 1 + strlen(fn) > 80) {
pos = 2 + fl;
} else if (pos + 1 + fl > 80) {
con_fprintf(f, "\n %s", fn);
pos = 2 + strlen(fn);
pos = 2 + fl;
} else {
con_fprintf(f, " %s", fn);
pos += 1 + strlen(fn);
pos += 1 + fl;
}
}
}
if (!verbose && pn.names_count)
if (verbose <= 0 && pn.names_count)
con_fprintf(f, "\n");
}
@@ -205,8 +219,8 @@ void show_help(int verbose)
con_fprintf(f,"\nCompression tuning options:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --brute try all available compression methods & filters\n"
" --ultra-brute try even more compression variants\n"
" --brute try all available compression methods & filters [slow]\n"
" --ultra-brute try even more compression variants [very slow]\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Backup options:\n");
@@ -224,26 +238,16 @@ void show_help(int verbose)
" --overlay=skip don't compress a file with an overlay\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for atari/tos:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --all-methods try all available compression methods\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for djgpp2/coff:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --coff produce COFF output [default: EXE]\n"
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for dos/com:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --8086 make compressed com work on any 8086\n"
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for dos/exe:\n");
@@ -251,57 +255,30 @@ void show_help(int verbose)
con_fprintf(f,
" --8086 make compressed exe work on any 8086\n"
" --no-reloc put no relocations in to the exe header\n"
" --all-methods try all available compression methods\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for dos/sys:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --8086 make compressed sys work on any 8086\n"
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
#if 0
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for linux/386\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --script use /usr/local/lib/upx/upx[bd] as decompressor\n"
" --script=/path/upxX use path/upxX as decompressor\n"
"\n");
#endif
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for ps1/exe:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --all-methods try all available compression methods\n"
" --8-bit uses 8 bit size compression [default: 32 bit]\n"
" --8mb-ram 8 megabyte memory limit [default: 2 mb]\n"
" --8mib-ram 8 megabyte memory limit [default: 2 MiB]\n"
" --boot-only disables client/host transfer compatibility\n"
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for tmt/adam:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for vmlinuz/386\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for watcom/le:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --le produce LE output [default: EXE]\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for win32/pe, rtm32/pe & arm/pe:\n");
con_fprintf(f,"Options for win32/pe, win64/pe, rtm32/pe & arm/pe:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --compress-exports=0 do not compress the export section\n"
@@ -314,8 +291,12 @@ void show_help(int verbose)
" --keep-resource=list do not compress resources specified by list\n"
" --strip-relocs=0 do not strip relocations\n"
" --strip-relocs=1 strip relocations [default]\n"
" --all-methods try all available compression methods\n"
" --all-filters try all available preprocessing filters\n"
"\n");
fg = con_fg(f,FG_YELLOW);
con_fprintf(f,"Options for linux/elf:\n");
fg = con_fg(f,fg);
con_fprintf(f,
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
"\n");
}
@@ -333,17 +314,17 @@ void show_help(int verbose)
con_fprintf(f,"\nType '%s --help' for more detailed help.\n", progname);
}
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit http://upx.sf.net\n"
con_fprintf(f,"\nUPX comes with ABSOLUTELY NO WARRANTY; for details visit https://upx.github.io\n"
// "\nUPX comes with ABSOLUTELY NO WARRANTY; for details type 'upx -L'.\n"
"");
#if defined(DEBUG) || defined(TESTING)
#if (DEBUG) || (TESTING)
fg = con_fg(f,FG_RED);
con_fprintf(f,"\nWARNING: this version is compiled with"
#if defined(DEBUG)
#if (DEBUG)
" -DDEBUG"
#endif
#if defined(TESTING)
#if (TESTING)
" -DTESTING"
#endif
"\n");
@@ -380,14 +361,14 @@ void show_license(void)
);
int fg = con_fg(f,FG_CYAN);
con_fprintf(f,
" http://upx.sourceforge.net\n"
" https://upx.github.io\n"
" http://www.oberhumer.com/opensource/upx/\n"
);
(void)con_fg(f,FG_ORANGE);
con_fprintf(f,
"\n"
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
" <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>\n"
" <markus@oberhumer.com> <ezerotven+github@gmail.com>\n"
);
fg = con_fg(f,fg);
@@ -406,42 +387,42 @@ void show_version(int x)
UNUSED(x);
UNUSED(v);
fprintf(fp, "upx %s\n", UPX_VERSION_STRING);
#if defined(WITH_NRV)
fprintf(fp, "upx %s\n", UPX_VERSION_STRING
#if defined(UPX_VERSION_GITREV)
"-git-" UPX_VERSION_GITREV
#endif
);
#if (WITH_NRV)
v = upx_nrv_version_string();
if (v != NULL && v[0])
fprintf(fp, "NRV data compression library %s\n", v);
#endif
#if defined(WITH_UCL)
#if (WITH_UCL)
v = upx_ucl_version_string();
if (v != NULL && v[0])
fprintf(fp, "UCL data compression library %s\n", v);
#endif
#if defined(WITH_ZLIB)
#if (WITH_ZLIB)
v = upx_zlib_version_string();
if (v != NULL && v[0])
fprintf(fp, "zlib data compression library %s\n", v);
#endif
#if defined(WITH_LZMA)
#if (WITH_LZMA)
v = upx_lzma_version_string();
if (v != NULL && v[0])
fprintf(fp, "LZMA SDK version %s\n", v);
#endif
fprintf(fp, "Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer\n");
fprintf(fp, "Copyright (C) 1996-2007 Laszlo Molnar\n");
fprintf(fp, "Copyright (C) 2000-2007 John F. Reiser\n");
fprintf(fp, "Copyright (C) 2002-2007 Jens Medoch\n");
#if defined(WITH_ZLIB)
fprintf(fp, "Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer\n");
fprintf(fp, "Copyright (C) 1996-2018 Laszlo Molnar\n");
fprintf(fp, "Copyright (C) 2000-2018 John F. Reiser\n");
fprintf(fp, "Copyright (C) 2002-2018 Jens Medoch\n");
#if (WITH_ZLIB)
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
#endif
#if defined(WITH_LZMA)
#if (WITH_LZMA)
fprintf(fp, "Copyright (C) 1999" "-2006 Igor Pavlov\n");
#endif
fprintf(fp, "UPX comes with ABSOLUTELY NO WARRANTY; for details type '%s -L'.\n", progname);
}
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+5 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -338,6 +338,7 @@ void LeFile::countFixups(unsigned *counts) const
break;
case 6: // 16:32 pointer
counts[o] += 9;
// fall through
case 7: // 32-bit offset
counts[fix[4]-1] += 4;
fix += (fix[1] & 0x10) ? 9 : 7;
@@ -360,8 +361,4 @@ void LeFile::countFixups(unsigned *counts) const
counts[o+1] += 4; // extra space for 0xFFFFFFFF
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+15 -24
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_LEFILE_H
#define __UPX_LEFILE_H
#define __UPX_LEFILE_H 1
class InputFile;
class OutputFile;
@@ -49,8 +49,8 @@ public:
protected:
enum { FIXUP_EXTRA = 3 };
struct le_header_t
{ // 0x00
__packed_struct(le_header_t)
// 0x00
char _[2]; // signature: 'LE' || 'LX'
char byte_order; // 0 little endian
char word_order; // 0 little endian
@@ -112,33 +112,28 @@ protected:
LE32 extra_heap_alloc;
char reserved[12];
LE32 versioninfo;
LE32 unkown;
LE32 unknown;
// 0xC0
LE16 device_id;
LE16 ddk_version;
#endif
}
__attribute_packed;
__packed_struct_end()
struct le_object_table_entry_t
{
__packed_struct(le_object_table_entry_t)
LE32 virtual_size;
LE32 base_address;
LE32 flags;
LE32 pagemap_index;
LE32 npages;
LE32 reserved;
}
__attribute_packed;
__packed_struct_end()
struct le_pagemap_entry_t
{
__packed_struct(le_pagemap_entry_t)
unsigned char h;
unsigned char m;
unsigned char l;
unsigned char type; // 0x00-legal;0x40-iterated;0x80-invalid;0xC0-zeroed
}
__attribute_packed;
__packed_struct_end()
virtual void readObjectTable();
virtual void writeObjectTable();
@@ -185,8 +180,8 @@ protected:
InputFile *fif;
OutputFile *fof;
long le_offset;
long exe_offset;
unsigned le_offset;
unsigned exe_offset;
le_header_t ih;
le_header_t oh;
@@ -226,8 +221,4 @@ private:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+385 -357
View File
File diff suppressed because it is too large Load Diff
+109 -73
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,23 +22,21 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_LINKER_H
#define __UPX_LINKER_H
#define __UPX_LINKER_H 1
/*************************************************************************
// ElfLinker
**************************************************************************/
class ElfLinker : private nocopy
{
class ElfLinker : private noncopyable {
friend class Packer;
public:
const N_BELE_RTP::AbstractPolicy *bele;
const N_BELE_RTP::AbstractPolicy *bele; // target endianness
protected:
struct Section;
struct Symbol;
@@ -72,9 +70,9 @@ protected:
Section *findSection(const char *name, bool fatal = true) const;
Symbol *findSymbol(const char *name, bool fatal = true) const;
Symbol *addSymbol(const char *name, const char *section, unsigned offset);
Symbol *addSymbol(const char *name, const char *section, upx_uint64_t offset);
Relocation *addRelocation(const char *section, unsigned off, const char *type,
const char *symbol, unsigned add);
const char *symbol, upx_uint64_t add);
public:
ElfLinker();
@@ -84,7 +82,7 @@ public:
// virtual void setLoaderAlignOffset(int phase);
virtual int addLoader(const char *sname);
void addLoader(const char *s, va_list ap);
#if 1 && (ACC_CC_GNUC >= 0x040100)
#if 1 && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x040100))
void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
#else
void __acc_cdecl_va addLoaderVA(const char *s, ...);
@@ -93,8 +91,8 @@ public:
virtual int getSection(const char *sname, int *slen = NULL) const;
virtual int getSectionSize(const char *sname) const;
virtual upx_byte *getLoader(int *llen = NULL) const;
virtual void defineSymbol(const char *name, unsigned value);
virtual unsigned getSymbolOffset(const char *) const;
virtual void defineSymbol(const char *name, upx_uint64_t value);
virtual upx_uint64_t getSymbolOffset(const char *) const;
virtual void dumpSymbol(const Symbol *, unsigned flags, FILE *fp) const;
virtual void dumpSymbols(unsigned flags = 0, FILE *fp = NULL) const;
@@ -105,18 +103,24 @@ public:
protected:
virtual void relocate();
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
// target endianness abstraction
unsigned get_te16(const void *p) const { return bele->get16(p); }
unsigned get_te32(const void *p) const { return bele->get32(p); }
upx_uint64_t get_te64(const void *p) const { return bele->get64(p); }
void set_te16(void *p, unsigned v) const { bele->set16(p, v); }
void set_te32(void *p, unsigned v) const { bele->set32(p, v); }
void set_te64(void *p, upx_uint64_t v) const { bele->set64(p, v); }
};
struct ElfLinker::Section : private nocopy
{
struct ElfLinker::Section : private noncopyable {
char *name;
void *input;
upx_byte *output;
unsigned size;
unsigned offset;
upx_uint64_t offset;
unsigned p2align; // log2
Section *next;
@@ -124,112 +128,144 @@ struct ElfLinker::Section : private nocopy
~Section();
};
struct ElfLinker::Symbol : private nocopy
{
struct ElfLinker::Symbol : private noncopyable {
char *name;
Section *section;
unsigned offset;
upx_uint64_t offset;
Symbol(const char *n, Section *s, unsigned o);
Symbol(const char *n, Section *s, upx_uint64_t o);
~Symbol();
};
struct ElfLinker::Relocation : private nocopy
{
struct ElfLinker::Relocation : private noncopyable {
const Section *section;
unsigned offset;
const char *type;
const Symbol *value;
unsigned add; // used in .rela relocations
upx_uint64_t add; // used in .rela relocations
Relocation(const Section *s, unsigned o, const char *t,
const Symbol *v, unsigned a);
Relocation(const Section *s, unsigned o, const char *t, const Symbol *v, upx_uint64_t a);
};
/*************************************************************************
// ElfLinker arch subclasses
**************************************************************************/
class ElfLinkerAMD64 : public ElfLinker
{
class ElfLinkerAMD64 : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerArmBE : public ElfLinker
{
class ElfLinkerARM64 : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerArmBE : public ElfLinker {
typedef ElfLinker super;
public:
ElfLinkerArmBE() { bele = &N_BELE_RTP::be_policy; }
protected:
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerArmLE : public ElfLinker
{
class ElfLinkerArmLE : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerM68k : public ElfLinker
{
class ElfLinkerArm64LE : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerM68k : public ElfLinker {
typedef ElfLinker super;
public:
ElfLinkerM68k() { bele = &N_BELE_RTP::be_policy; }
protected:
virtual void alignCode(unsigned len);
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerMipsLE : public ElfLinker
{
class ElfLinkerMipsBE : public ElfLinker {
typedef ElfLinker super;
public:
ElfLinkerMipsBE() { bele = &N_BELE_RTP::be_policy; }
protected:
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerPpc32 : public ElfLinker
{
class ElfLinkerMipsLE : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerPpc32 : public ElfLinker {
typedef ElfLinker super;
public:
ElfLinkerPpc32() { bele = &N_BELE_RTP::be_policy; }
protected:
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerX86 : public ElfLinker
{
class ElfLinkerPpc64le : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerPpc64 : public ElfLinker {
typedef ElfLinker super;
public:
ElfLinkerPpc64() { bele = &N_BELE_RTP::be_policy; }
protected:
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
class ElfLinkerX86 : public ElfLinker {
typedef ElfLinker super;
protected:
virtual void alignCode(unsigned len) { alignWithByte(len, 0x90); }
virtual void relocate1(const Relocation *, upx_byte *location,
unsigned value, const char *type);
virtual void relocate1(const Relocation *, upx_byte *location, upx_uint64_t value,
const char *type);
};
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
Submodule
+1
Submodule src/lzma-sdk added at 426fe82d12
+161 -111
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,18 +22,18 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#include "conf.h"
#include "mygetopt.h"
#include "compress.h"
#include "file.h"
#include "packer.h"
#include "p_elf.h"
#if 1 && defined(__DJGPP__)
#if 1 && (ACC_OS_DOS32) && defined(__DJGPP__)
#include <crt0.h>
int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
#endif
@@ -46,7 +46,7 @@ int _crt0_startup_flags = _CRT0_FLAG_UNIX_SBRK;
void options_t::reset()
{
options_t *o = this;
memset(o, 0, sizeof(*o));
mem_clear(o, sizeof(*o));
o->crp.reset();
o->cmd = CMD_NONE;
@@ -56,11 +56,14 @@ void options_t::reset()
o->backup = -1;
o->overlay = -1;
o->preserve_mode = true;
o->preserve_ownership = true;
o->preserve_timestamp = true;
o->console = CON_FILE;
#if defined(__DJGPP__)
#if (ACC_OS_DOS32) && defined(__DJGPP__)
o->console = CON_INIT;
#elif defined(USE_SCREEN_WIN32)
#elif (USE_SCREEN_WIN32)
o->console = CON_INIT;
#elif 1 && defined(__linux__)
o->console = CON_INIT;
@@ -81,12 +84,24 @@ static options_t global_options;
options_t *opt = &global_options;
static int done_output_name = 0;
static int done_script_name = 0;
const char *argv0 = "";
const char *progname = "";
static acc_getopt_t mfx_getopt;
#define mfx_optarg mfx_getopt.optarg
#define mfx_optind mfx_getopt.optind
#define mfx_option acc_getopt_longopt_t
static void handle_opterr(acc_getopt_p g, const char *f, void *v)
{
struct A { va_list ap; };
struct A *a = (struct A *) v;
fprintf( stderr, "%s: ", g->progname);
vfprintf(stderr, f, a->ap);
fprintf( stderr, "\n");
}
static int num_files = -1;
static int exit_code = EXIT_OK;
@@ -143,7 +158,7 @@ static bool set_eec(int ec, int *eec)
return 0;
}
bool set_ec(int ec)
bool set_exit_code(int ec)
{
return set_eec(ec,&exit_code);
}
@@ -151,25 +166,27 @@ bool set_ec(int ec)
void e_exit(int ec)
{
(void) set_ec(ec);
(void) set_exit_code(ec);
do_exit();
}
void e_usage(void)
static void e_usage(void)
{
show_usage();
e_exit(EXIT_USAGE);
}
void e_memory(void)
#if 0 // UNUSED
static void e_memory(void)
{
show_head();
fflush(con_term);
fprintf(stderr,"%s: out of memory\n", argv0);
e_exit(EXIT_MEMORY);
}
#endif // UNUSED
static void e_method(int m, int l)
@@ -197,7 +214,7 @@ static void e_optval(const char *n)
#if defined(OPTIONS_VAR)
void e_envopt(const char *n)
static void e_envopt(const char *n)
{
fflush(con_term);
if (n)
@@ -211,18 +228,20 @@ void e_envopt(const char *n)
#endif /* defined(OPTIONS_VAR) */
void __acc_cdecl_sighandler e_sighandler(int signum)
#if 0 // UNUSED
static void __acc_cdecl_sighandler e_sighandler(int signum)
{
UNUSED(signum);
e_exit(EXIT_FATAL);
}
#endif // UNUSED
/*************************************************************************
// check options
**************************************************************************/
void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
static void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
{
if (e1 && e2)
{
@@ -233,7 +252,7 @@ void check_not_both(bool e1, bool e2, const char *c1, const char *c2)
}
void check_options(int i, int argc)
static void check_options(int i, int argc)
{
assert(i <= argc);
@@ -283,7 +302,7 @@ void check_options(int i, int argc)
// misc
**************************************************************************/
void e_help(void)
static void e_help(void)
{
show_help();
e_exit(EXIT_USAGE);
@@ -312,14 +331,9 @@ static bool set_method(int m, int l)
{
if (!Packer::isValidCompressionMethod(m))
return false;
#if 1
// something like "--brute --lzma" should not disable "--brute"
if (!opt->all_methods)
#endif
{
opt->method = m;
opt->all_methods = false;
}
}
if (l > 0)
opt->level = l;
@@ -351,29 +365,6 @@ static void set_output_name(const char *n, bool allow_m)
done_output_name++;
}
static void set_script_name(const char *n, bool allow_m)
{
#if 1
if (done_script_name > 0)
{
fprintf(stderr,"%s: option '--script' more than once given\n",argv0);
e_usage();
}
#endif
if (!n || !n[0] || (!allow_m && n[0] == '-'))
{
fprintf(stderr,"%s: missing script name\n",argv0);
e_usage();
}
if (strlen(n) >= (size_t)opt->o_unix.SCRIPT_MAX - 3)
{
fprintf(stderr,"%s: script name too long\n",argv0);
e_usage();
}
opt->o_unix.script_name = n;
done_script_name++;
}
/*************************************************************************
// get options
@@ -424,7 +415,7 @@ char* prepare_shortopts(char *buf, const char *n,
template <class T>
int getoptvar(T *var, const T min_value, const T max_value, const char *arg_fatal)
static int getoptvar(T *var, const T min_value, const T max_value, const char *arg_fatal)
{
const char *p = mfx_optarg;
char *endptr;
@@ -454,9 +445,8 @@ done:
return r;
}
#if 1 && (ACC_CC_GNUC >= 0x030300)
template <class T, T default_value, T min_value, T max_value>
int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_fatal)
static int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_fatal)
{
T v = default_value;
int r = getoptvar(&v, min_value, max_value, arg_fatal);
@@ -464,17 +454,6 @@ int getoptvar(OptVar<T,default_value,min_value,max_value> *var, const char *arg_
*var = v;
return r;
}
#else
template <class T>
int getoptvar(T *var, const char *arg_fatal)
{
typename T::Type v = T::default_value_c;
int r = getoptvar(&v, T::min_value_c, T::max_value_c, arg_fatal);
if (r == 0)
*var = v;
return r;
}
#endif
static int do_option(int optc, const char *arg)
@@ -579,6 +558,12 @@ static int do_option(int optc, const char *arg)
if (M_IS_LZMA(opt->method))
opt->method = -1;
break;
case 723:
opt->prefer_ucl = false;
break;
case 724:
opt->prefer_ucl = true;
break;
// compression level
case '1':
@@ -630,6 +615,17 @@ static int do_option(int optc, const char *arg)
opt->debug.disable_random_id = true;
break;
// mp (meta)
case 501:
getoptvar(&opt->mp_compress_task, 1, 999999, arg);
break;
case 502:
opt->mp_query_format = true;
break;
case 503:
opt->mp_query_num_tasks = true;
break;
// misc
case 512:
opt->console = CON_FILE;
@@ -646,6 +642,15 @@ static int do_option(int optc, const char *arg)
case 519:
opt->no_env = true;
break;
case 526:
opt->preserve_mode = false;
break;
case 527:
opt->preserve_ownership = false;
break;
case 528:
opt->preserve_timestamp = false;
break;
// compression settings
case 520: // --small
if (opt->small < 0)
@@ -821,11 +826,6 @@ static int do_option(int optc, const char *arg)
case 661:
opt->o_unix.force_execve = true;
break;
case 662:
opt->o_unix.script_name = "/usr/local/lib/upx/upxX";
if (mfx_optarg && mfx_optarg[0])
set_script_name(mfx_optarg, 1);
break;
case 663:
opt->o_unix.is_ptinterp = true;
break;
@@ -858,7 +858,19 @@ static int do_option(int optc, const char *arg)
opt->ps1_exe.do_8bit = true;
break;
case 673:
opt->ps1_exe.do_8mb = false;
opt->ps1_exe.do_8mib = false;
break;
case 674:
opt->o_unix.unmap_all_pages = true; // val ?
break;
case 675:
opt->o_unix.preserve_build_id = true;
break;
case 676:
opt->o_unix.android_shlib = true;
break;
case 677:
opt->o_unix.force_pie = true;
break;
case '\0':
@@ -900,7 +912,10 @@ static const struct mfx_option longopts[] =
{"force-compress", 0, 0, 'f'}, // and compression of suspicious files
{"info", 0, 0, 'i'}, // info mode
{"no-env", 0x10, 0, 519}, // no environment var
{"no-mode", 0x10, 0, 526}, // do not preserve mode (permissions)
{"no-owner", 0x10, 0, 527}, // do not preserve ownership
{"no-progress", 0, 0, 516}, // no progress bar
{"no-time", 0x10, 0, 528}, // do not preserve timestamp
{"output", 0x21, 0, 'o'},
{"quiet", 0, 0, 'q'}, // quiet mode
{"silent", 0, 0, 'q'}, // quiet mode
@@ -946,7 +961,9 @@ static const struct mfx_option longopts[] =
{"nrv2d", 0x10, 0, 704}, // --nrv2d
{"nrv2e", 0x10, 0, 705}, // --nrv2e
{"lzma", 0x10, 0, 721}, // --lzma
{"no-lzma", 0x10, 0, 722}, // (disable all_methods_use_lzma)
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
{"prefer-nrv", 0x10, 0, 723},
{"prefer-ucl", 0x10, 0, 724},
// compression settings
{"all-filters", 0x10, 0, 523},
{"all-methods", 0x10, 0, 524},
@@ -992,9 +1009,6 @@ static const struct mfx_option longopts[] =
// unix
{"blocksize", 0x31, 0, 660}, // --blocksize=
{"force-execve", 0x10, 0, 661}, // force linux/386 execve format
#if 0
{"script", 0x31, 0, 662}, // --script=
#endif
{"is_ptinterp", 0x10, 0, 663}, // linux/elf386 PT_INTERP program
{"use_ptinterp", 0x10, 0, 664}, // linux/elf386 PT_INTERP program
{"make_ptinterp", 0x10, 0, 665}, // linux/elf386 PT_INTERP program
@@ -1006,6 +1020,10 @@ static const struct mfx_option longopts[] =
{"netbsd", 0x10, 0, 668},
{"OpenBSD", 0x10, 0, 669},
{"openbsd", 0x10, 0, 669},
{"unmap-all-pages", 0x10, 0, 674}, // linux /proc/self/exe vanishes
{"preserve-build-id", 0, 0, 675},
{"android-shlib", 0, 0, 676},
{"force-pie", 0, 0, 677},
// watcom/le
{"le", 0x10, 0, 620}, // produce LE output
// win32/pe
@@ -1019,19 +1037,26 @@ static const struct mfx_option longopts[] =
{"boot-only", 0x10, 0, 670},
{"no-align", 0x10, 0, 671},
{"8-bit", 0x10, 0, 672},
{"8mib-ram", 0x10, 0, 673},
{"8mb-ram", 0x10, 0, 673},
// mp (meta) options
{"mp-compress-task", 0x31, 0, 501},
{"mp-query-format", 0x10, 0, 502},
{"mp-query-num-tasks", 0x10, 0, 503},
{ NULL, 0, NULL, 0 }
};
int optc, longind;
char buf[256];
char shortopts[256];
prepare_shortopts(buf,"123456789hH?V",longopts),
mfx_optind = 0;
mfx_opterr = 1;
prepare_shortopts(shortopts, "123456789hH?V", longopts),
acc_getopt_init(&mfx_getopt, 1, argc, argv);
mfx_getopt.progname = progname;
mfx_getopt.opterr = handle_opterr;
opt->o_unix.osabi0 = Elf32_Ehdr::ELFOSABI_LINUX;
while ((optc = mfx_getopt_long(argc, argv, buf, longopts, &longind)) >= 0)
while ((optc = acc_getopt(&mfx_getopt, shortopts, longopts, &longind)) >= 0)
{
if (do_option(optc, argv[mfx_optind-1]) != 0)
e_usage();
@@ -1091,6 +1116,15 @@ static const struct mfx_option longopts[] =
// compression settings
{"exact", 0x10, 0, 525}, // user requires byte-identical decompression
// compression method
{"nrv2b", 0x10, 0, 702}, // --nrv2b
{"nrv2d", 0x10, 0, 704}, // --nrv2d
{"nrv2e", 0x10, 0, 705}, // --nrv2e
{"lzma", 0x10, 0, 721}, // --lzma
{"no-lzma", 0x10, 0, 722}, // disable all_methods_use_lzma
{"prefer-nrv", 0x10, 0, 723},
{"prefer-ucl", 0x10, 0, 724},
// compression settings
// compression runtime parameters
// win32/pe
@@ -1110,7 +1144,7 @@ static const struct mfx_option longopts[] =
int targc;
char **targv = NULL;
static const char sep[] = " \t";
char buf[256];
char shortopts[256];
var = getenv(OPTIONS_VAR);
if (var == NULL || !var[0])
@@ -1166,10 +1200,11 @@ static const struct mfx_option longopts[] =
e_envopt(targv[i]);
/* handle options */
prepare_shortopts(buf,"123456789",longopts);
mfx_optind = 0;
mfx_opterr = 1;
while ((optc = mfx_getopt_long(targc, targv, buf, longopts, &longind)) >= 0)
prepare_shortopts(shortopts, "123456789", longopts);
acc_getopt_init(&mfx_getopt, 1, targc, targv);
mfx_getopt.progname = progname;
mfx_getopt.opterr = handle_opterr;
while ((optc = acc_getopt(&mfx_getopt, shortopts, longopts, &longind)) >= 0)
{
if (do_option(optc, targv[mfx_optind-1]) != 0)
e_envopt(NULL);
@@ -1218,8 +1253,8 @@ template <class T> struct TestBELE {
static bool test(void)
{
COMPILE_TIME_ASSERT_ALIGNED1(T)
struct test1_t { char a; T b; } __attribute_packed;
struct test2_t { char a; T b[3]; } __attribute_packed;
__packed_struct(test1_t) char a; T b; __packed_struct_end()
__packed_struct(test2_t) char a; T b[3]; __packed_struct_end()
test1_t t1[7]; UNUSED(t1); test2_t t2[7]; UNUSED(t2);
COMPILE_TIME_ASSERT(sizeof(test1_t) == 1 + sizeof(T))
COMPILE_TIME_ASSERT_ALIGNED1(test1_t)
@@ -1231,7 +1266,7 @@ static bool test(void)
COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1)
COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1)
#endif
#if 1 && !defined(xUPX_OFFICIAL_BUILD)
#if 1 && !defined(UPX_OFFICIAL_BUILD)
T allbits; allbits = 0; allbits -= 1;
//++allbits; allbits++; --allbits; allbits--;
T v1; v1 = 1; v1 *= 2; v1 -= 1;
@@ -1257,7 +1292,7 @@ static bool test(void)
#undef ACCCHK_ASSERT
#include "miniacc.h"
void upx_sanity_check(void)
__acc_static_noinline void upx_sanity_check(void)
{
#define ACC_WANT_ACC_CHK_CH 1
#undef ACCCHK_ASSERT
@@ -1273,6 +1308,9 @@ void upx_sanity_check(void)
COMPILE_TIME_ASSERT(sizeof(off_t) >= sizeof(long))
COMPILE_TIME_ASSERT(((off_t) -1) < 0)
#if (ACC_OS_POSIX_DARWIN || ACC_OS_POSIX_LINUX)
COMPILE_TIME_ASSERT(sizeof(off_t) >= 8)
#endif
COMPILE_TIME_ASSERT(sizeof(BE16) == 2)
COMPILE_TIME_ASSERT(sizeof(BE32) == 4)
@@ -1294,7 +1332,13 @@ void upx_sanity_check(void)
COMPILE_TIME_ASSERT(sizeof(UPX_VERSION_YEAR) == 4 + 1)
assert(strlen(UPX_VERSION_YEAR) == 4);
assert(memcmp(UPX_VERSION_DATE_ISO, UPX_VERSION_YEAR, 4) == 0);
assert(memcmp(UPX_VERSION_DATE + strlen(UPX_VERSION_DATE) - 4, UPX_VERSION_YEAR, 4) == 0);
assert(memcmp(&UPX_VERSION_DATE[sizeof(UPX_VERSION_DATE)-1 - 4], UPX_VERSION_YEAR, 4) == 0);
if (gitrev[0]) {
size_t revlen = strlen(gitrev);
if (strncmp(gitrev, "ERROR", 5) == 0) { assert(revlen == 5 || revlen == 6); }
else { assert(revlen == 12 || revlen == 13); }
if (revlen == 6 || revlen == 13) { assert(gitrev[revlen-1] == '+'); }
}
#if 1
assert(TestBELE<LE16>::test());
@@ -1304,29 +1348,42 @@ void upx_sanity_check(void)
assert(TestBELE<BE32>::test());
assert(TestBELE<BE64>::test());
{
static const unsigned char dd[32] = { 0, 0, 0, 0, 0, 0, 0,
static const unsigned char dd[32]
#if 1 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) && defined(__ELF__)
__attribute__((__aligned__(16)))
#endif
= { 0, 0, 0, 0, 0, 0, 0,
0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8,
0, 0, 0, 0,
0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78,
0, 0, 0, 0, 0 };
const unsigned char *d;
const N_BELE_RTP::AbstractPolicy *bele;
d = dd + 7;
assert(upx_adler32(d, 4) == 0x09f003f7);
assert(upx_adler32(d, 4, 0) == 0x09ec03f6);
assert(upx_adler32(d, 4, 1) == 0x09f003f7);
bele = &N_BELE_RTP::be_policy;
assert(get_be16(d) == 0xfffe);
assert(bele->get16(d) == 0xfffe);
assert(get_be16_signed(d) == -2);
assert(get_be24(d) == 0xfffefd);
assert(bele->get24(d) == 0xfffefd);
assert(get_be24_signed(d) == -259);
assert(get_be32(d) == 0xfffefdfc);
assert(bele->get32(d) == 0xfffefdfc);
assert(get_be32_signed(d) == -66052);
bele = &N_BELE_RTP::le_policy;
assert(get_le16(d) == 0xfeff);
assert(bele->get16(d) == 0xfeff);
assert(get_le16_signed(d) == -257);
assert(get_le24(d) == 0xfdfeff);
assert(bele->get24(d) == 0xfdfeff);
assert(get_le24_signed(d) == -131329);
assert(get_le32(d) == 0xfcfdfeff);
assert(bele->get32(d) == 0xfcfdfeff);
assert(get_le32_signed(d) == -50462977);
assert(get_le64_signed(d) == ACC_INT64_C(-506097522914230529));
assert(get_le64_signed(d) == UPX_INT64_C(-506097522914230529));
assert(find_be16(d, 2, 0xfffe) == 0);
assert(find_le16(d, 2, 0xfeff) == 0);
assert(find_be32(d, 4, 0xfffefdfc) == 0);
@@ -1335,7 +1392,7 @@ void upx_sanity_check(void)
assert(get_be16_signed(d) == 32638);
assert(get_be24_signed(d) == 8355453);
assert(get_be32_signed(d) == 2138996092);
assert(get_be64_signed(d) == ACC_INT64_C(9186918263483431288));
assert(get_be64_signed(d) == UPX_INT64_C(9186918263483431288));
}
#endif
}
@@ -1345,11 +1402,14 @@ void upx_sanity_check(void)
// main entry point
**************************************************************************/
#if !defined(WITH_GUI)
#if !(WITH_GUI)
#if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__)
extern "C" { extern long _stksize; long _stksize = 256 * 1024L; }
#endif
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (defined(__MINGW32__) || defined(__MINGW64__))
extern "C" { extern int _dowildcard; int _dowildcard = -1; }
#endif
int __acc_cdecl_main main(int argc, char *argv[])
{
@@ -1357,9 +1417,12 @@ int __acc_cdecl_main main(int argc, char *argv[])
static char default_argv0[] = "upx";
// int cmdline_cmd = CMD_NONE;
#if 0 && defined(__DJGPP__)
#if 0 && (ACC_OS_DOS32) && defined(__DJGPP__)
// LFN=n may cause problems with 2.03's _rename and mkdir under WinME
putenv("LFN=y");
#endif
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_MSC) && defined(_WRITE_ABORT_MSG) && defined(_CALL_REPORTFAULT)
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
#endif
acc_wildargv(&argc, &argv);
@@ -1395,8 +1458,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
set_term(stderr);
#if defined(WITH_UCL)
if (ucl_init() != UCL_E_OK)
if (upx_ucl_init() != 0)
{
show_head();
fprintf(stderr,"ucl_init() failed - check your UCL installation !\n");
@@ -1405,17 +1467,10 @@ int __acc_cdecl_main main(int argc, char *argv[])
(long) UCL_VERSION, (long) ucl_version());
e_exit(EXIT_INIT);
}
#endif
#if defined(WITH_NRV)
if (nrv_init() != NRV_E_OK || NRV_VERSION != nrv_version())
{
show_head();
fprintf(stderr,"nrv_init() failed - check your NRV installation !\n");
if (NRV_VERSION != nrv_version())
fprintf(stderr,"library version conflict (%lx, %lx) - check your NRV installation !\n",
(long) NRV_VERSION, (long) nrv_version());
e_exit(EXIT_INIT);
}
assert(upx_lzma_init() == 0);
assert(upx_zlib_init() == 0);
#if (WITH_NRV)
assert(upx_nrv_init() == 0);
#endif
//srand((int) time(NULL));
@@ -1483,7 +1538,7 @@ int __acc_cdecl_main main(int argc, char *argv[])
set_term(stdout);
do_files(i,argc,argv);
#if 0 && (UPX_VERSION_HEX < 0x030000)
if (gitrev[0])
{
FILE *f = stdout;
int fg = con_fg(f,FG_RED);
@@ -1491,7 +1546,6 @@ int __acc_cdecl_main main(int argc, char *argv[])
fg = con_fg(f,fg);
UNUSED(fg);
}
#endif
#if 0 && defined(__GLIBC__)
//malloc_stats();
@@ -1499,10 +1553,6 @@ int __acc_cdecl_main main(int argc, char *argv[])
return exit_code;
}
#endif /* !defined(WITH_GUI) */
/*
vi:ts=4:et:nowrap
*/
#endif /* !(WITH_GUI) */
/* vim:set ts=4 sw=4 et: */
+52 -59
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -31,40 +31,37 @@
/*************************************************************************
//
// bool use_simple_mcheck()
**************************************************************************/
static int use_mcheck = -1;
static int mcheck_init()
{
if (use_mcheck < 0)
{
use_mcheck = 1;
#if defined(WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
if (RUNNING_ON_VALGRIND)
#if defined(__SANITIZE_ADDRESS__)
__acc_static_forceinline bool use_simple_mcheck() { return false; }
#elif (WITH_VALGRIND) && defined(RUNNING_ON_VALGRIND)
static int use_simple_mcheck_flag = -1;
__acc_static_noinline void use_simple_mcheck_init()
{
use_simple_mcheck_flag = 1;
if (RUNNING_ON_VALGRIND) {
use_simple_mcheck_flag = 0;
//fprintf(stderr, "upx: detected RUNNING_ON_VALGRIND\n");
use_mcheck = 0;
}
}
__acc_static_forceinline bool use_simple_mcheck()
{
if __acc_unlikely(use_simple_mcheck_flag < 0)
use_simple_mcheck_init();
return (bool) use_simple_mcheck_flag;
}
#else
__acc_static_forceinline bool use_simple_mcheck() { return true; }
#endif
}
return use_mcheck;
}
/*************************************************************************
//
**************************************************************************/
MemBuffer::MemBuffer() :
b(NULL), b_size(0)
{
if (use_mcheck < 0)
mcheck_init();
}
MemBuffer::MemBuffer(unsigned size) :
MemBuffer::MemBuffer(upx_uint64_t size) :
b(NULL), b_size(0)
{
alloc(size);
@@ -76,12 +73,24 @@ MemBuffer::~MemBuffer()
this->dealloc();
}
// similar to BoundedPtr, except checks only at creation
unsigned char *MemBuffer::subref(char const *errfmt, unsigned skip, unsigned take)
{
if ((take + skip) < take // wrap-around
|| (take + skip) > b_size // overrun
) {
char buf[100]; snprintf(buf, sizeof(buf), errfmt, skip, take);
throwCantPack(buf);
}
return &b[skip];
}
void MemBuffer::dealloc()
{
if (b)
if (b != NULL)
{
checkState();
if (use_mcheck)
if (use_simple_mcheck())
{
// remove magic constants
set_be32(b - 8, 0);
@@ -103,23 +112,19 @@ void MemBuffer::dealloc()
unsigned MemBuffer::getSizeForCompression(unsigned uncompressed_size, unsigned extra)
{
assert((int)uncompressed_size > 0);
assert((int)extra >= 0);
unsigned size = uncompressed_size + uncompressed_size/8 + 256 + extra;
return size;
size_t bytes = mem_size(1, uncompressed_size, extra);
bytes += uncompressed_size/8 + 256;
return ACC_ICONV(unsigned, bytes);
}
unsigned MemBuffer::getSizeForUncompression(unsigned uncompressed_size, unsigned extra)
{
assert((int)uncompressed_size > 0);
assert((int)extra >= 0);
unsigned size = uncompressed_size + extra;
// size += 512; // 512 safety bytes
size_t bytes = mem_size(1, uncompressed_size, extra);
// INFO: 3 bytes are the allowed overrun for the i386 asm_fast decompressors
#if (ACC_ARCH_I386)
size += 3;
bytes += 3;
#endif
return size;
return ACC_ICONV(unsigned, bytes);
}
@@ -154,7 +159,7 @@ void MemBuffer::fill(unsigned off, unsigned len, int value)
//
**************************************************************************/
#define PTR(p) ((unsigned) ((acc_uintptr_t)(p) & 0xffffffff))
#define PTR(p) ((unsigned) ((upx_uintptr_t)(p) & 0xffffffff))
#define MAGIC1(p) (PTR(p) ^ 0xfefdbeeb)
#define MAGIC2(p) (PTR(p) ^ 0xfefdbeeb ^ 0x80024001)
@@ -165,7 +170,7 @@ void MemBuffer::checkState() const
{
if (!b)
throwInternalError("block not allocated");
if (use_mcheck)
if (use_simple_mcheck())
{
if (get_be32(b - 4) != MAGIC1(b))
throwInternalError("memory clobbered before allocated block 1");
@@ -178,27 +183,19 @@ void MemBuffer::checkState() const
}
void MemBuffer::alloc(unsigned size)
void MemBuffer::alloc(upx_uint64_t size)
{
if (use_mcheck < 0)
mcheck_init();
// NOTE: we don't automatically free a used buffer
assert(b == NULL);
assert(b_size == 0);
//
assert((int)size > 0);
unsigned total = use_mcheck ? size + 32 : size;
assert((int)total > 0);
unsigned char *p = (unsigned char *) malloc(total);
assert(size > 0);
size_t bytes = mem_size(1, size, use_simple_mcheck() ? 32 : 0);
unsigned char *p = (unsigned char *) malloc(bytes);
if (!p)
{
//throw bad_alloc();
throw OutOfMemoryException("out of memory");
//exit(1);
}
b_size = size;
if (use_mcheck)
throwOutOfMemoryException();
b_size = ACC_ICONV(unsigned, size);
if (use_simple_mcheck())
{
b = p + 16;
// store magic constants to detect buffer overruns
@@ -213,8 +210,4 @@ void MemBuffer::alloc(unsigned size)
//fill(0, b_size, (rand() & 0xff) | 1); // debug
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+15 -13
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_MEM_H
#define __UPX_MEM_H
#define __UPX_MEM_H 1
/*************************************************************************
@@ -37,14 +37,14 @@
class MemBuffer
{
public:
MemBuffer();
explicit MemBuffer(unsigned size);
MemBuffer() : b(NULL), b_size(0) { }
explicit MemBuffer(upx_uint64_t size);
~MemBuffer();
static unsigned getSizeForCompression(unsigned uncompressed_size, unsigned extra=0);
static unsigned getSizeForUncompression(unsigned uncompressed_size, unsigned extra=0);
void alloc(unsigned size);
void alloc(upx_uint64_t size);
void allocForCompression(unsigned uncompressed_size, unsigned extra=0);
void allocForUncompression(unsigned uncompressed_size, unsigned extra=0);
@@ -55,7 +55,8 @@ public:
unsigned getSize() const { return b_size; }
operator unsigned char * () { return b; }
//operator const unsigned char * () const { return b; }
operator const unsigned char * () const { return b; }
void *getVoidPtr() { return (void *) b; }
const void *getVoidPtr() const { return (const void *) b; }
@@ -63,6 +64,11 @@ public:
void clear(unsigned off, unsigned len) { fill(off, len, 0); }
void clear() { fill(0, b_size, 0); }
// If the entire range [skip, take+skip) is inside the buffer,
// then return &b[skip]; else throwCantPack(sprintf(errfmt, skip, take)).
// This is similar to BoundedPtr, except only checks once.
unsigned char *subref(char const *errfmt, unsigned skip, unsigned take);
private:
unsigned char *b;
unsigned b_size;
@@ -79,8 +85,4 @@ private:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+3394 -2138
View File
File diff suppressed because it is too large Load Diff
+5 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -57,7 +57,7 @@ void printClearLine(FILE *f)
fflush(stdout); fflush(stderr);
if (f == NULL)
f = stdout;
con_fprintf(f,clear_line_msg);
con_fprintf(f, "%s", clear_line_msg);
fflush(f);
printSetNl(0);
}
@@ -253,8 +253,4 @@ void infoWriting(const char *what, long size)
info("Writing %s: %ld bytes", what, size);
}
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
-706
View File
@@ -1,706 +0,0 @@
/* Getopt for GNU.
NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu
before changing it!
Copyright (C) 1987, 88, 89, 90, 91, 92, 1993
Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, 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; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#undef PROGNAME
#if 0
#ifndef EOF
#include <stdio.h>
#include <string.h>
#endif
#define PROGNAME(x) (x)
#else
#include "conf.h"
static const char *my_progname(const char *argv0)
{
return progname ? progname : argv0;
}
#define PROGNAME(x) my_progname(x)
#endif
/* If GETOPT_COMPAT is defined, `+' as well as `--' can introduce a
long-named option. Because this is not POSIX.2 compliant, it is
being phased out. */
/* #define GETOPT_COMPAT */
#undef GETOPT_COMPAT
/* This version of `getopt' appears to the caller like standard Unix `getopt'
but it behaves differently for the user, since it allows the user
to intersperse the options with the other arguments.
As `getopt' works, it permutes the elements of ARGV so that,
when it is done, all the options precede everything else. Thus
all application programs are extended to handle flexible argument order.
Setting the environment variable POSIXLY_CORRECT disables permutation.
Then the behavior is completely standard.
GNU application programs can use a third alternative mode in which
they can distinguish the relative order of options and other arguments. */
#include "mygetopt.h"
#define option mfx_option
#define optarg mfx_optarg
#define optind mfx_optind
#define opterr mfx_opterr
#define optopt mfx_optopt
#undef BAD_OPTION
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
char *optarg = NULL;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
/* XXX 1003.2 says this must be 1 before any call. */
int optind = 0;
/* The next char to be scanned in the option-element
in which the last option character we returned was found.
This allows us to pick up the scan where we left off.
If this is zero, or a null string, it means resume the scan
by advancing to the next ARGV-element. */
static char *nextchar;
/* Callers store zero here to inhibit the error message
for unrecognized options. */
int opterr = 1;
/* Set to an option character which was unrecognized.
This must be initialized on some systems to avoid linking in the
system's own getopt implementation. */
#define BAD_OPTION '\0'
int optopt = BAD_OPTION;
/* Describe how to deal with options that follow non-option ARGV-elements.
If the caller did not specify anything,
the default is REQUIRE_ORDER if the environment variable
POSIXLY_CORRECT is defined, PERMUTE otherwise.
REQUIRE_ORDER means don't recognize them as options;
stop option processing when the first non-option is seen.
This is what Unix does.
This mode of operation is selected by either setting the environment
variable POSIXLY_CORRECT, or using `+' as the first character
of the list of option characters.
PERMUTE is the default. We permute the contents of ARGV as we scan,
so that eventually all the non-options are at the end. This allows options
to be given in any order, even with programs that were not written to
expect this.
RETURN_IN_ORDER is an option available to programs that were written
to expect options and other ARGV-elements in any order and that care about
the ordering of the two. We describe each non-option ARGV-element
as if it were the argument of an option with character code 1.
Using `-' as the first character of the list of option characters
selects this mode of operation.
The special argument `--' forces an end of option-scanning regardless
of the value of `ordering'. In the case of RETURN_IN_ORDER, only
`--' can cause `getopt' to return EOF with `optind' != ARGC. */
static enum
{
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
} ordering;
/* Handle permutation of arguments. */
/* Describe the part of ARGV that contains non-options that have
been skipped. `first_nonopt' is the index in ARGV of the first of them;
`last_nonopt' is the index after the last of them. */
static int first_nonopt;
static int last_nonopt;
/* Exchange two adjacent subsequences of ARGV.
One subsequence is elements [first_nonopt,last_nonopt)
which contains all the non-options that have been skipped so far.
The other is elements [last_nonopt,optind), which contains all
the options processed since those non-options were skipped.
`first_nonopt' and `last_nonopt' are relocated so that they describe
the new indices of the non-options in ARGV after they are moved.
To perform the swap, we first reverse the order of all elements. So
all options now come before all non options, but they are in the
wrong order. So we put back the options and non options in original
order by reversing them again. For example:
original input: a b c -x -y
reverse all: -y -x c b a
reverse options: -x -y c b a
reverse non options: -x -y a b c
*/
static void exchange (char **argv)
{
char *temp; char **first, **last;
/* Reverse all the elements [first_nonopt, optind) */
first = &argv[first_nonopt];
last = &argv[optind-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the options in order */
first = &argv[first_nonopt];
first_nonopt += (optind - last_nonopt);
last = &argv[first_nonopt - 1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
/* Put back the non options in order */
first = &argv[first_nonopt];
last_nonopt = optind;
last = &argv[last_nonopt-1];
while (first < last) {
temp = *first; *first = *last; *last = temp; first++; last--;
}
}
/* Scan elements of ARGV (whose length is ARGC) for option characters
given in OPTSTRING.
If an element of ARGV starts with '-', and is not exactly "-" or "--",
then it is an option element. The characters of this element
(aside from the initial '-') are option characters. If `getopt'
is called repeatedly, it returns successively each of the option characters
from each of the option elements.
If `getopt' finds another option character, it returns that character,
updating `optind' and `nextchar' so that the next call to `getopt' can
resume the scan with the following option character or ARGV-element.
If there are no more option characters, `getopt' returns `EOF'.
Then `optind' is the index in ARGV of the first ARGV-element
that is not an option. (The ARGV-elements have been permuted
so that those that are not options now come last.)
OPTSTRING is a string containing the legitimate option characters.
If an option character is seen that is not listed in OPTSTRING,
return BAD_OPTION after printing an error message. If you set `opterr' to
zero, the error message is suppressed but we still return BAD_OPTION.
If a char in OPTSTRING is followed by a colon, that means it wants an arg,
so the following text in the same ARGV-element, or the text of the following
ARGV-element, is returned in `optarg'. Two colons mean an option that
wants an optional arg; if there is text in the current ARGV-element,
it is returned in `optarg', otherwise `optarg' is set to zero.
If OPTSTRING starts with `-' or `+', it requests different methods of
handling the non-option ARGV-elements.
See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
Long-named options begin with `--' instead of `-'.
Their names may be abbreviated as long as the abbreviation is unique
or is an exact match for some defined option. If they have an
argument, it follows the option name in the same ARGV-element, separated
from the option name by a `=', or else the in next ARGV-element.
When `getopt' finds a long-named option, it returns 0 if that option's
`flag' field is nonzero, the value of the option's `val' field
if the `flag' field is zero.
LONGOPTS is a vector of `struct option' terminated by an
element containing a name which is zero.
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
If LONG_ONLY is nonzero, '-' as well as '--' can introduce
long-named options. */
static int _getopt_internal (int argc, char **argv, const char *optstring,
const struct option *longopts, int *longind,
int long_only)
{
static char empty_string[1];
int option_index;
if (longind != NULL)
*longind = -1;
optarg = 0;
/* Initialize the internal data when the first call is made.
Start processing options with ARGV-element 1 (since ARGV-element 0
is the program name); the sequence of previously skipped
non-option ARGV-elements is empty. */
if (optind == 0)
{
first_nonopt = last_nonopt = optind = 1;
nextchar = NULL;
/* Determine how to handle the ordering of options and nonoptions. */
if (optstring[0] == '-')
{
ordering = RETURN_IN_ORDER;
++optstring;
}
else if (optstring[0] == '+')
{
ordering = REQUIRE_ORDER;
++optstring;
}
#if 0
else if (getenv ("POSIXLY_CORRECT") != NULL)
ordering = REQUIRE_ORDER;
#endif
else
ordering = PERMUTE;
}
if (nextchar == NULL || *nextchar == '\0')
{
if (ordering == PERMUTE)
{
/* If we have just processed some options following some non-options,
exchange them so that the options come first. */
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange (argv);
else if (last_nonopt != optind)
first_nonopt = optind;
/* Now skip any additional non-options
and extend the range of non-options previously skipped. */
while (optind < argc
&& (argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
optind++;
last_nonopt = optind;
}
/* Special ARGV-element `--' means premature end of options.
Skip it like a null option,
then exchange with previous non-options as if it were an option,
then skip everything else like a non-option. */
if (optind != argc && !strcmp (argv[optind], "--"))
{
optind++;
if (first_nonopt != last_nonopt && last_nonopt != optind)
exchange (argv);
else if (first_nonopt == last_nonopt)
first_nonopt = optind;
last_nonopt = argc;
optind = argc;
}
/* If we have done all the ARGV-elements, stop the scan
and back over any non-options that we skipped and permuted. */
if (optind == argc)
{
/* Set the next-arg-index to point at the non-options
that we previously skipped, so the caller will digest them. */
if (first_nonopt != last_nonopt)
optind = first_nonopt;
return EOF;
}
/* If we have come to a non-option and did not permute it,
either stop the scan or describe it to the caller and pass it by. */
if ((argv[optind][0] != '-' || argv[optind][1] == '\0')
#ifdef GETOPT_COMPAT
&& (longopts == NULL
|| argv[optind][0] != '+' || argv[optind][1] == '\0')
#endif /* GETOPT_COMPAT */
)
{
if (ordering == REQUIRE_ORDER)
return EOF;
optarg = argv[optind++];
return 1;
}
/* We have found another option-ARGV-element.
Start decoding its characters. */
nextchar = (argv[optind] + 1
+ (longopts != NULL && argv[optind][1] == '-'));
}
if (longopts != NULL
&& ((argv[optind][0] == '-'
&& (argv[optind][1] == '-' || long_only))
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
))
{
const struct option *p;
char *s = nextchar;
int exact = 0;
int ambig = 0;
const struct option *pfound = NULL;
int indfound = 0;
int needexact = 0;
/* allow `--option#value' because you cannout assign a '='
to an environment variable under DOS command.com */
while (*s && *s != '=' && * s != '#')
s++;
/* Test all options for either exact match or abbreviated matches. */
for (p = longopts, option_index = 0; p->name;
p++, option_index++)
if (!strncmp (p->name, nextchar, (unsigned) (s - nextchar)))
{
if (p->has_arg & 0x10)
needexact = 1;
if ((unsigned) (s - nextchar) == strlen (p->name))
{
/* Exact match found. */
pfound = p;
indfound = option_index;
exact = 1;
break;
}
else if (pfound == NULL)
{
/* First nonexact match found. */
pfound = p;
indfound = option_index;
}
else
/* Second nonexact match found. */
ambig = 1;
}
/* don't allow nonexact longoptions */
if (needexact && !exact)
{
if (opterr)
fprintf (stderr, "%s: unrecognized option `%s'\n",
PROGNAME(argv[0]), argv[optind]);
nextchar += strlen (nextchar);
optind++;
return BAD_OPTION;
}
if (ambig && !exact)
{
if (opterr)
fprintf (stderr, "%s: option `%s' is ambiguous\n",
PROGNAME(argv[0]), argv[optind]);
nextchar += strlen (nextchar);
optind++;
return BAD_OPTION;
}
if (pfound != NULL)
{
int have_arg = (s[0] != '\0');
if (have_arg && (pfound->has_arg & 0xf))
have_arg = (s[1] != '\0');
option_index = indfound;
optind++;
if (have_arg)
{
/* Don't test has_arg with >, because some C compilers don't
allow it to be used on enums. */
if (pfound->has_arg & 0xf)
optarg = s + 1;
else
{
if (opterr)
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
"%s: option `--%s' doesn't allow an argument\n",
PROGNAME(argv[0]), pfound->name);
else
/* +option or -option */
fprintf (stderr,
"%s: option `%c%s' doesn't allow an argument\n",
PROGNAME(argv[0]), argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
return BAD_OPTION;
}
}
else if ((pfound->has_arg & 0xf) == 1)
{
#if 0
if (optind < argc)
#else
if (optind < argc && (pfound->has_arg & 0x20) == 0)
#endif
optarg = argv[optind++];
else
{
if (opterr)
fprintf (stderr, "%s: option `--%s%s' requires an argument\n",
PROGNAME(argv[0]), pfound->name,
(pfound->has_arg & 0x20) ? "=" : "");
nextchar += strlen (nextchar);
return optstring[0] == ':' ? ':' : BAD_OPTION;
}
}
nextchar += strlen (nextchar);
if (longind != NULL)
*longind = option_index;
if (pfound->flag)
{
*(pfound->flag) = pfound->val;
return 0;
}
return pfound->val;
}
/* Can't find it as a long option. If this is not getopt_long_only,
or the option starts with '--' or is not a valid short
option, then it's an error.
Otherwise interpret it as a short option. */
if (!long_only || argv[optind][1] == '-'
#ifdef GETOPT_COMPAT
|| argv[optind][0] == '+'
#endif /* GETOPT_COMPAT */
|| strchr (optstring, *nextchar) == NULL)
{
if (opterr)
{
if (argv[optind][1] == '-')
/* --option */
fprintf (stderr, "%s: unrecognized option `--%s'\n",
PROGNAME(argv[0]), nextchar);
else
/* +option or -option */
fprintf (stderr, "%s: unrecognized option `%c%s'\n",
PROGNAME(argv[0]), argv[optind][0], nextchar);
}
nextchar = empty_string;
optind++;
return BAD_OPTION;
}
(void) &ambig; /* UNUSED */
}
/* Look at and handle the next option-character. */
{
char c = *nextchar++;
const char *temp = strchr (optstring, c);
/* Increment `optind' when we start to process its last character. */
if (*nextchar == '\0')
++optind;
if (temp == NULL || c == ':')
{
if (opterr)
{
#if 0
if (c < 040 || c >= 0177)
fprintf (stderr, "%s: unrecognized option, character code 0%o\n",
PROGNAME(argv[0]), c);
else
fprintf (stderr, "%s: unrecognized option `-%c'\n", PROGNAME(argv[0]), c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: illegal option -- %c\n", PROGNAME(argv[0]), c);
#endif
}
optopt = c;
return BAD_OPTION;
}
if (temp[1] == ':')
{
if (temp[2] == ':')
{
/* This is an option that accepts an argument optionally. */
if (*nextchar != '\0')
{
optarg = nextchar;
optind++;
}
else
optarg = 0;
nextchar = NULL;
}
else
{
/* This is an option that requires an argument. */
if (*nextchar != '\0')
{
optarg = nextchar;
/* If we end this ARGV-element by taking the rest as an arg,
we must advance to the next element now. */
optind++;
}
else if (optind == argc)
{
if (opterr)
{
#if 0
fprintf (stderr, "%s: option `-%c' requires an argument\n",
PROGNAME(argv[0]), c);
#else
/* 1003.2 specifies the format of this message. */
fprintf (stderr, "%s: option requires an argument -- %c\n",
PROGNAME(argv[0]), c);
#endif
}
optopt = c;
if (optstring[0] == ':')
c = ':';
else
c = BAD_OPTION;
}
else
/* We already incremented `optind' once;
increment it again when taking next ARGV-elt as argument. */
optarg = argv[optind++];
nextchar = NULL;
}
}
return c;
}
}
int mfx_getopt(int argc, char **argv, const char *optstring)
{
return _getopt_internal (argc, argv, optstring,
(const struct option *) 0,
(int *) 0,
0);
}
int mfx_getopt_long(int argc, char **argv, const char *options,
const struct option *long_options, int *opt_index)
{
return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
}
#ifdef TEST
/* Compile with -DTEST to make an executable for use in testing
the above definition of `getopt'. */
int
main (argc, argv)
int argc;
char **argv;
{
int c;
int digit_optind = 0;
while (1)
{
int this_option_optind = optind ? optind : 1;
c = getopt (argc, argv, "abc:d:0123456789");
if (c == EOF)
break;
switch (c)
{
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
if (digit_optind != 0 && digit_optind != this_option_optind)
printf ("digits occur in two different argv-elements.\n");
digit_optind = this_option_optind;
printf ("option %c\n", c);
break;
case 'a':
printf ("option a\n");
break;
case 'b':
printf ("option b\n");
break;
case 'c':
printf ("option c with value `%s'\n", optarg);
break;
case BAD_OPTION:
break;
default:
printf ("?? getopt returned character code 0%o ??\n", c);
}
}
if (optind < argc)
{
printf ("non-option ARGV-elements: ");
while (optind < argc)
printf ("%s ", argv[optind++]);
printf ("\n");
}
exit (0);
}
#endif /* TEST */
/*
vi:ts=4:et:nowrap
*/
-102
View File
@@ -1,102 +0,0 @@
/* Declarations for getopt.
Copyright (C) 1989, 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, 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; if not, write to the Free Software
Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef __MFX_GETOPT_H
#define __MFX_GETOPT_H 1
#ifdef __cplusplus
/* extern "C" { */
#endif
/* For communication from `getopt' to the caller.
When `getopt' finds an option that takes an argument,
the argument value is returned here.
Also, when `ordering' is RETURN_IN_ORDER,
each non-option ARGV-element is returned here. */
extern char *mfx_optarg;
/* Index in ARGV of the next element to be scanned.
This is used for communication to and from the caller
and for communication between successive calls to `getopt'.
On entry to `getopt', zero means this is the first call; initialize.
When `getopt' returns EOF, this is the index of the first of the
non-option elements that the caller should itself scan.
Otherwise, `optind' communicates from one call to the next
how much of ARGV has been scanned so far. */
extern int mfx_optind;
/* Callers store zero here to inhibit the error message `getopt' prints
for unrecognized options. */
extern int mfx_opterr;
/* Set to an option character which was unrecognized. */
extern int mfx_optopt;
/* Describe the long-named options requested by the application.
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
of `struct option' terminated by an element containing a name which is
zero.
The field `has_arg' is:
no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument,
optional_argument (or 2) if the option takes an optional argument.
If the field `flag' is not NULL, it points to a variable that is set
to the value given in the field `val' when the option is found, but
left unchanged if the option is not found.
To have a long-named option do something other than set an `int' to
a compiled-in constant, such as set a value from `optarg', set the
option's `flag' field to zero and its `val' field to a nonzero
value (the equivalent single-letter option character, if there is
one). For long options that have a zero `flag' field, `getopt'
returns the contents of the `val' field. */
struct mfx_option
{
const char *name;
/* has_arg can't be an enum because some compilers complain about
type mismatches in all the code that assumes it is an int. */
int has_arg;
int *flag;
int val;
};
/* Names for the values of the `has_arg' field of `struct option'. */
#define mfx_no_argument 0
#define mfx_required_argument 1
#define mfx_optional_argument 2
#define mfx_exact_argument 0x10 /* no abbrev. */
int mfx_getopt(int argc, char **argv, const char *shortopts);
int mfx_getopt_long(int argc, char **argv, const char *shortopts,
const struct mfx_option *longopts, int *longind);
#ifdef __cplusplus
/* } */
#endif
#endif /* __MFX_GETOPT_H */
+19 -12
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_OPTIONS_H
#define __UPX_OPTIONS_H
#define __UPX_OPTIONS_H 1
/*************************************************************************
@@ -45,6 +45,11 @@ enum {
struct options_t {
int cmd;
// mp (meta) options
int mp_compress_task;
bool mp_query_format;
bool mp_query_num_tasks;
// compression options
int method;
bool method_lzma_seen;
@@ -58,6 +63,7 @@ struct options_t {
bool all_methods_use_lzma;
bool all_filters; // try all available filters ?
bool no_filter; // force no filter
bool prefer_ucl; // prefer UCL
bool exact; // user requires byte-identical decompression
// other options
@@ -69,6 +75,9 @@ struct options_t {
bool no_env;
bool no_progress;
const char *output_name;
bool preserve_mode;
bool preserve_ownership;
bool preserve_timestamp;
int small;
int verbose;
bool to_stdout;
@@ -126,7 +135,7 @@ struct options_t {
bool boot_only;
bool no_align;
bool do_8bit;
bool do_8mb;
bool do_8mib;
} ps1_exe;
struct {
unsigned blocksize;
@@ -134,9 +143,11 @@ struct options_t {
bool is_ptinterp; // is PT_INTERP, so don't adjust auxv_t
bool use_ptinterp; // use PT_INTERP /opt/upx/run
bool make_ptinterp; // make PT_INTERP [ignore current file!]
bool unmap_all_pages; // thus /proc/self/exe vanishes
unsigned char osabi0; // replacement if 0==.e_ident[EI_OSABI]
enum { SCRIPT_MAX = 32 };
const char *script_name;
bool preserve_build_id; // copy the build-id to the compressed binary
bool android_shlib; // keep some ElfXX_Shdr for dlopen()
bool force_pie; // choose DF_1_PIE instead of is_shlib
} o_unix;
struct {
bool le;
@@ -158,8 +169,4 @@ extern struct options_t *opt;
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+44 -932
View File
File diff suppressed because it is too large Load Diff
+22 -14
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,20 +22,21 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_P_ARMPE_H
#define __UPX_P_ARMPE_H
#define __UPX_P_ARMPE_H 1
/*************************************************************************
// arm/pe
**************************************************************************/
class PackArmPe : public PeFile
class PackArmPe : public PeFile32
{
typedef PeFile super;
typedef PeFile32 super;
public:
PackArmPe(InputFile *f);
@@ -45,19 +46,29 @@ public:
virtual const char *getFullName(const options_t *) const { return "arm-wince.pe"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
virtual void defineFilterSymbols(const Filter *) {}
virtual bool handleForceOption();
virtual void callCompressWithFilters(Filter &, int filter_strategy,
unsigned ih_codebase);
virtual void defineSymbols(unsigned ncsection, unsigned upxsection,
unsigned sizeof_oh, unsigned isize_isplit,
unsigned s1addr);
virtual void addNewRelocations(Reloc &, unsigned upxsection);
virtual unsigned getProcessImportParam(unsigned upxsection);
virtual void setOhDataBase(const pe_section_t *osection);
virtual void setOhHeaderSize(const pe_section_t *osection);
virtual void pack(OutputFile *fo);
virtual bool canPack();
virtual int canUnpack();
protected:
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
virtual unsigned processImports();
virtual void processImports(unsigned, unsigned);
virtual void rebuildImports(upx_byte *&);
virtual const char *kernelDll() const { return "COREDLL.dll"; }
virtual void processImports2(unsigned, unsigned);
virtual void addStubImports();
virtual void processTls(Interval *);
@@ -67,7 +78,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+5 -9
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -36,7 +36,7 @@
static const
#include "stub/i086-dos16.com.h"
//#define TESTING
//#define TESTING 1
/*************************************************************************
@@ -266,8 +266,4 @@ Linker* PackCom::newLinker() const
return new ElfLinkerX86();
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+7 -10
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_P_COM_H
#define __UPX_P_COM_H
#define __UPX_P_COM_H 1
/*************************************************************************
@@ -42,7 +42,8 @@ public:
virtual int getVersion() const { return 13; }
virtual int getFormat() const { return UPX_F_DOS_COM; }
virtual const char *getName() const { return "dos/com"; }
virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.com" : "i286-dos16.com"; }
//virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.com" : "i286-dos16.com"; }
virtual const char *getFullName(const options_t *) const { return "i086-dos16.com"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
@@ -65,8 +66,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+13 -16
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -76,10 +76,11 @@ const int *PackDjgpp2::getFilters() const
unsigned PackDjgpp2::findOverlapOverhead(const upx_bytep buf,
const upx_bytep tbuf,
unsigned range,
unsigned upper_limit) const
{
unsigned o = super::findOverlapOverhead(buf, range, upper_limit);
unsigned o = super::findOverlapOverhead(buf, tbuf, range, upper_limit);
o = (o + 0x3ff) &~ 0x1ff;
return o;
}
@@ -137,16 +138,16 @@ void PackDjgpp2::handleStub(OutputFile *fo)
}
static bool is_dlm(InputFile *fi, long coff_offset)
static bool is_dlm(InputFile *fi, unsigned coff_offset)
{
unsigned char buf[4];
long off;
unsigned off;
try {
fi->seek(coff_offset, SEEK_SET);
fi->readx(buf, 4);
off = get_le32(buf);
if (off < 0 || off > coff_offset + 4)
if (off > coff_offset + 4)
return false;
fi->seek(off, SEEK_SET);
fi->readx(buf, 4);
@@ -169,9 +170,9 @@ static void handle_allegropak(InputFile *fi, OutputFile *fo)
if (memcmp(buf, "slh+", 4) != 0)
return;
pfsize = get_be32_signed(buf+4);
if (pfsize <= 8 || (off_t) pfsize >= (off_t) fi->st.st_size)
if (pfsize <= 8 || pfsize >= (off_t) fi->st.st_size)
return;
fi->seek(-pfsize, SEEK_END);
fi->seek(-(off_t)pfsize, SEEK_END);
} catch (const IOException&) {
return;
}
@@ -302,7 +303,7 @@ void PackDjgpp2::pack(OutputFile *fo)
// compress
upx_compress_config_t cconf; cconf.reset();
// limit stack size needed for runtime decompression
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 512, &cconf);
// patch coff header #2
@@ -343,7 +344,7 @@ void PackDjgpp2::pack(OutputFile *fo)
// because of a feature (bug?) in stub.asm we need some padding
memcpy(obuf+data->size, "UPX", 3);
data->size = ALIGN_UP(data->size, 4);
data->size = ALIGN_UP(data->size, 4u);
linker->defineSymbol("DJ2MAIN1", coff_hdr.a_entry);
relocateLoader();
@@ -468,8 +469,4 @@ void PackDjgpp2::unpack(OutputFile *fo)
handle_allegropak(fi, fo);
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+12 -19
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_P_DJGPP2_H
#define __UPX_P_DJGPP2_H
#define __UPX_P_DJGPP2_H 1
/*************************************************************************
@@ -43,7 +43,7 @@ public:
virtual int getVersion() const { return 14; }
virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
virtual const char *getName() const { return "djgpp2/coff"; }
virtual const char *getFullName(const options_t *) const { return "i386-dos32.djgpp2"; }
virtual const char *getFullName(const options_t *) const { return "i386-dos32.djgpp2.coff"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
@@ -58,26 +58,24 @@ protected:
virtual int readFileHeader();
virtual unsigned findOverlapOverhead(const upx_bytep buf,
const upx_bytep tbuf,
unsigned range = 0,
unsigned upper_limit = ~0u) const;
virtual void buildLoader(const Filter *ft);
virtual Linker* newLinker() const;
long coff_offset;
unsigned coff_offset;
struct external_scnhdr_t
{
__packed_struct(external_scnhdr_t)
char _[12]; // name, paddr
LE32 vaddr;
LE32 size;
LE32 scnptr;
char misc[12]; // relptr, lnnoptr, nreloc, nlnno
char __[4]; // flags
}
__attribute_packed;
__packed_struct_end()
struct coff_header_t
{
__packed_struct(coff_header_t)
// ext_file_hdr
LE16 f_magic;
LE16 f_nscns;
@@ -98,8 +96,7 @@ protected:
// section headers
external_scnhdr_t sh[3];
}
__attribute_packed;
__packed_struct_end()
coff_header_t coff_hdr;
external_scnhdr_t *text,*data,*bss;
@@ -110,8 +107,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+82 -57
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_P_ELF_H
#define __UPX_P_ELF_H
#define __UPX_P_ELF_H 1
/*************************************************************************
@@ -52,8 +52,7 @@ struct ElfITypes
// The ELF file header. This appears at the start of every ELF file.
template <class TElfITypes>
struct Ehdr
{
__packed_struct(Ehdr)
typedef typename TElfITypes::Half Half;
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Addr Addr;
@@ -76,13 +75,11 @@ struct Ehdr
# define WANT_EHDR_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct Dyn
{
__packed_struct(Dyn)
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
@@ -91,13 +88,32 @@ struct Dyn
# define WANT_DYN_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct External_Note
{
__packed_struct(Rel)
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
Addr r_offset;
Xword r_info;
__packed_struct_end()
template <class TElfITypes>
__packed_struct(Rela)
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
Addr r_offset;
Xword r_info;
Xword r_addend;
__packed_struct_end()
template <class TElfITypes>
__packed_struct(External_Note)
typedef typename TElfITypes::Word Word;
Word xn_namesz; // includes terminating '\0'
@@ -105,8 +121,7 @@ struct External_Note
Word xn_type;
//char xn_name[N]; // terminate with '\0'
//char xn_data[M]; // aligned to 0 mod 4
}
__attribute_packed;
__packed_struct_end()
} // namespace N_Elf
@@ -119,8 +134,7 @@ __attribute_packed;
namespace N_Elf32 {
template <class TElfITypes>
struct Phdr
{
__packed_struct(Phdr)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Addr Addr;
typedef typename TElfITypes::Off Off;
@@ -136,13 +150,11 @@ struct Phdr
# define WANT_PHDR_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct Shdr
{
__packed_struct(Shdr)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Addr Addr;
typedef typename TElfITypes::Off Off;
@@ -160,13 +172,11 @@ struct Shdr
# define WANT_SHDR_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct Sym
{
__packed_struct(Sym)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Addr Addr;
typedef typename TElfITypes::Section Section;
@@ -183,9 +193,9 @@ struct Sym
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); }
}
__attribute_packed;
static unsigned char make_st_info(unsigned bind, unsigned type)
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
__packed_struct_end()
} // namespace N_Elf32
@@ -198,8 +208,7 @@ __attribute_packed;
namespace N_Elf64 {
template <class TElfITypes>
struct Phdr
{
__packed_struct(Phdr)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
@@ -216,13 +225,11 @@ struct Phdr
# define WANT_PHDR_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct Shdr
{
__packed_struct(Shdr)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
@@ -241,13 +248,11 @@ struct Shdr
# define WANT_SHDR_ENUM 1
# include "p_elf_enum.h"
}
__attribute_packed;
__packed_struct_end()
template <class TElfITypes>
struct Sym
{
__packed_struct(Sym)
typedef typename TElfITypes::Word Word;
typedef typename TElfITypes::Xword Xword;
typedef typename TElfITypes::Addr Addr;
@@ -265,9 +270,9 @@ struct Sym
static unsigned int get_st_bind(unsigned x) { return 0xf & (x>>4); }
static unsigned int get_st_type(unsigned x) { return 0xf & x ; }
static unsigned char make_st_info(unsigned bind, unsigned type) { return (bind<<4) + (0xf & type); }
}
__attribute_packed;
static unsigned char make_st_info(unsigned bind, unsigned type)
{ return (unsigned char) (((bind<<4) + (0xf & type)) & 0xff); }
__packed_struct_end()
} // namespace N_Elf64
@@ -284,17 +289,19 @@ struct ElfClass_32
{
typedef TP BeLePolicy;
// integral types
typedef typename TP::U16 U16;
typedef typename TP::U32 U32;
typedef typename TP::U64 U64;
typedef N_Elf::ElfITypes<U16, U32, U32, U32, U32> ElfITypes;
// integral types (target endianness)
typedef typename TP::U16 TE16;
typedef typename TP::U32 TE32;
typedef typename TP::U64 TE64;
typedef N_Elf::ElfITypes<TE16, TE32, TE32, TE32, TE32> ElfITypes;
// ELF types
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
typedef N_Elf32::Phdr<ElfITypes> Phdr;
typedef N_Elf32::Shdr<ElfITypes> Shdr;
typedef N_Elf ::Dyn <ElfITypes> Dyn;
typedef N_Elf ::Rel <ElfITypes> Rel;
typedef N_Elf ::Rela<ElfITypes> Rela;
typedef N_Elf32::Sym <ElfITypes> Sym;
typedef N_Elf ::External_Note<ElfITypes> External_Note;
@@ -304,11 +311,15 @@ struct ElfClass_32
COMPILE_TIME_ASSERT(sizeof(Phdr) == 32)
COMPILE_TIME_ASSERT(sizeof(Shdr) == 40)
COMPILE_TIME_ASSERT(sizeof(Dyn) == 8)
COMPILE_TIME_ASSERT(sizeof(Rel) == 8)
COMPILE_TIME_ASSERT(sizeof(Rela) == 12)
COMPILE_TIME_ASSERT(sizeof(Sym) == 16)
COMPILE_TIME_ASSERT_ALIGNED1(Ehdr)
COMPILE_TIME_ASSERT_ALIGNED1(Phdr)
COMPILE_TIME_ASSERT_ALIGNED1(Shdr)
COMPILE_TIME_ASSERT_ALIGNED1(Dyn)
COMPILE_TIME_ASSERT_ALIGNED1(Rel)
COMPILE_TIME_ASSERT_ALIGNED1(Rela)
COMPILE_TIME_ASSERT_ALIGNED1(Sym)
}
};
@@ -319,17 +330,19 @@ struct ElfClass_64
{
typedef TP BeLePolicy;
// integral types
typedef typename TP::U16 U16;
typedef typename TP::U32 U32;
typedef typename TP::U64 U64;
typedef N_Elf::ElfITypes<U16, U32, U64, U64, U64> ElfITypes;
// integral types (target endianness)
typedef typename TP::U16 TE16;
typedef typename TP::U32 TE32;
typedef typename TP::U64 TE64;
typedef N_Elf::ElfITypes<TE16, TE32, TE64, TE64, TE64> ElfITypes;
// ELF types
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
typedef N_Elf64::Phdr<ElfITypes> Phdr;
typedef N_Elf64::Shdr<ElfITypes> Shdr;
typedef N_Elf ::Dyn <ElfITypes> Dyn;
typedef N_Elf ::Rel <ElfITypes> Rel;
typedef N_Elf ::Rela<ElfITypes> Rela;
typedef N_Elf64::Sym <ElfITypes> Sym;
typedef N_Elf ::External_Note<ElfITypes> External_Note;
@@ -339,11 +352,15 @@ struct ElfClass_64
COMPILE_TIME_ASSERT(sizeof(Phdr) == 56)
COMPILE_TIME_ASSERT(sizeof(Shdr) == 64)
COMPILE_TIME_ASSERT(sizeof(Dyn) == 16)
COMPILE_TIME_ASSERT(sizeof(Rel) == 16)
COMPILE_TIME_ASSERT(sizeof(Rela) == 24)
COMPILE_TIME_ASSERT(sizeof(Sym) == 24)
COMPILE_TIME_ASSERT_ALIGNED1(Ehdr)
COMPILE_TIME_ASSERT_ALIGNED1(Phdr)
COMPILE_TIME_ASSERT_ALIGNED1(Shdr)
COMPILE_TIME_ASSERT_ALIGNED1(Dyn)
COMPILE_TIME_ASSERT_ALIGNED1(Rel)
COMPILE_TIME_ASSERT_ALIGNED1(Rela)
COMPILE_TIME_ASSERT_ALIGNED1(Sym)
}
};
@@ -368,6 +385,8 @@ typedef ElfClass_Host32::Ehdr Elf32_Ehdr;
typedef ElfClass_Host32::Phdr Elf32_Phdr;
typedef ElfClass_Host32::Shdr Elf32_Shdr;
typedef ElfClass_Host32::Dyn Elf32_Dyn;
typedef ElfClass_Host32::Rel Elf32_Rel;
typedef ElfClass_Host32::Rela Elf32_Rela;
typedef ElfClass_Host32::Sym Elf32_Sym;
typedef ElfClass_Host32::External_Note Elf32_External_Note;
@@ -375,6 +394,8 @@ typedef ElfClass_Host64::Ehdr Elf64_Ehdr;
typedef ElfClass_Host64::Phdr Elf64_Phdr;
typedef ElfClass_Host64::Shdr Elf64_Shdr;
typedef ElfClass_Host64::Dyn Elf64_Dyn;
typedef ElfClass_Host64::Rel Elf64_Rel;
typedef ElfClass_Host64::Rela Elf64_Rela;
typedef ElfClass_Host64::Sym Elf64_Sym;
typedef ElfClass_Host64::External_Note Elf64_External_Note;
@@ -382,6 +403,8 @@ typedef ElfClass_BE32::Ehdr Elf_BE32_Ehdr;
typedef ElfClass_BE32::Phdr Elf_BE32_Phdr;
typedef ElfClass_BE32::Shdr Elf_BE32_Shdr;
typedef ElfClass_BE32::Dyn Elf_BE32_Dyn;
typedef ElfClass_BE32::Rel Elf_BE32_Rel;
typedef ElfClass_BE32::Rela Elf_BE32_Rela;
typedef ElfClass_BE32::Sym Elf_BE32_Sym;
typedef ElfClass_BE32::External_Note Elf_BE32_External_Note;
@@ -389,6 +412,8 @@ typedef ElfClass_BE64::Ehdr Elf_BE64_Ehdr;
typedef ElfClass_BE64::Phdr Elf_BE64_Phdr;
typedef ElfClass_BE64::Shdr Elf_BE64_Shdr;
typedef ElfClass_BE64::Dyn Elf_BE64_Dyn;
typedef ElfClass_BE64::Rel Elf_BE64_Rel;
typedef ElfClass_BE64::Rela Elf_BE64_Rela;
typedef ElfClass_BE64::Sym Elf_BE64_Sym;
typedef ElfClass_BE64::External_Note Elf_BE64_External_Note;
@@ -396,6 +421,8 @@ typedef ElfClass_LE32::Ehdr Elf_LE32_Ehdr;
typedef ElfClass_LE32::Phdr Elf_LE32_Phdr;
typedef ElfClass_LE32::Shdr Elf_LE32_Shdr;
typedef ElfClass_LE32::Dyn Elf_LE32_Dyn;
typedef ElfClass_LE32::Rel Elf_LE32_Rel;
typedef ElfClass_LE32::Rela Elf_LE32_Rela;
typedef ElfClass_LE32::Sym Elf_LE32_Sym;
typedef ElfClass_LE32::External_Note Elf_LE32_External_Note;
@@ -403,14 +430,12 @@ typedef ElfClass_LE64::Ehdr Elf_LE64_Ehdr;
typedef ElfClass_LE64::Phdr Elf_LE64_Phdr;
typedef ElfClass_LE64::Shdr Elf_LE64_Shdr;
typedef ElfClass_LE64::Dyn Elf_LE64_Dyn;
typedef ElfClass_LE64::Rel Elf_LE64_Rel;
typedef ElfClass_LE64::Rela Elf_LE64_Rela;
typedef ElfClass_LE64::Sym Elf_LE64_Sym;
typedef ElfClass_LE64::External_Note Elf_LE64_External_Note;
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+118 -8
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -68,10 +68,14 @@
};
enum { // e_machine
EM_386 = 3,
EM_MIPS = 8,
EM_MIPS_RS3_LE = 10, /* MIPS R3000 little-endian */
EM_PPC = 20,
EM_PPC64 = 21,
EM_ARM = 40,
EM_X86_64 = 62
EM_X86_64 = 62,
EM_AARCH64 = 183
};
enum { // e_version
EV_CURRENT = 1
@@ -87,6 +91,7 @@
PT_INTERP = 3, /* Name of program interpreter */
PT_NOTE = 4, /* Auxiliary information (esp. OpenBSD) */
PT_PHDR = 6 /* Entry for header table itself */
, PT_GNU_STACK = 0x6474e551 /* Indicates stack executability */
};
enum { // p_flags
@@ -119,6 +124,10 @@
SHT_GROUP = 17, /* Section group */
SHT_SYMTAB_SHNDX = 18, /* Extended section indeces */
SHT_GNU_LIBLIST = 0x6ffffff7 /* Prelink library list */
, SHT_LOOS = 0x60000000 /* LOcal OS; SHT_ANDROID_REL{,A} is +1, +2 */
, SHT_LOPROC = 0x70000000/* Start of processor-specific */
, SHT_ARM_ATTRIBUTES = (SHT_LOPROC + 3) /* ARM attributes section. */
};
enum { // sh_flags
@@ -138,10 +147,39 @@
enum { // d_tag
DT_NULL = 0, /* End flag */
DT_NEEDED = 1, /* Name of needed library */
DT_PLTRELSZ = 2, /* Size in bytes of PLT relocs */
DT_PLTGOT = 3, /* Processor defined value */
DT_HASH = 4, /* Hash table of symbol names */
DT_STRTAB = 5, /* String table */
DT_SYMTAB = 6, /* Symbol table */
DT_STRSZ = 10 /* Sizeof string table */
DT_RELA = 7, /* Relocations which do contain an addend */
DT_RELASZ = 8, /* Total size of Rela relocs */
DT_RELAENT = 9, /* Size of one RELA relocation */
DT_INIT = 12, /* Address of init function */
DT_FINI = 13, /* Address of termination function */
DT_REL = 17, /* Relocations which contain no addend */
DT_RELSZ = 18, /* Total size of Rel relocs */
DT_RELENT = 19, /* Size of one Rel relocation */
DT_STRSZ = 10, /* Sizeof string table */
DT_PLTREL = 20, /* Type of reloc in PLT */
DT_TEXTREL = 22, /* Reloc might modify .text */
DT_JMPREL = 23, /* Address of PLT relocs */
DT_INIT_ARRAY = 25, /* Array with addresses of init fct */
DT_FINI_ARRAY = 26, /* Array with addresses of fini fct */
DT_INIT_ARRAYSZ= 27, /* size in bytes */
DT_FINI_ARRAYSZ= 28, /* size in bytes */
DT_PREINIT_ARRAY = 32, /* Array with addresses of preinit fct*/
DT_PREINIT_ARRAYSZ= 33, /* size in bytes */
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
DT_GNU_HASH = 0x6ffffef5, /* GNU-style hash table */
DT_VERSYM = 0x6ffffff0, /* version[] for each symbol */
DT_FLAGS_1 = 0x6ffffffb, /* DF_1_* */
DT_VERDEF = 0x6ffffffc, /* version definitions[] */
DT_VERNEEDED= 0x6ffffffe /* version[] needed */
};
enum { // DT_FLAGS_1
DF_1_NOW = 0x00000001, /* Set RTLD_NOW for this object. */
DF_1_PIE = 0x08000000 // Position-Independent Executable (main program)
};
#endif
@@ -179,7 +217,79 @@
#endif
/*
vi:ts=4:et
*/
#ifdef WANT_REL_ENUM //{
#undef WANT_REL_ENUM
static inline unsigned ELF32_R_TYPE(unsigned x) { return 0xff & x; }
static inline unsigned ELF64_R_TYPE(upx_uint64_t x) { return 0xffffffff & (unsigned)x; }
# undef R_PPC_RELATIVE
# undef R_PPC64_RELATIVE
# undef R_PPC_JMP_SLOT
# undef R_PPC64_JMP_SLOT
enum { // relocation types
R_386_RELATIVE = 8,
R_AARCH64_RELATIVE = 1027,
R_ARM_RELATIVE = 23,
R_PPC_RELATIVE = 22,
R_PPC64_RELATIVE = R_PPC_RELATIVE,
R_X86_64_RELATIVE = 8,
R_386_JMP_SLOT = 7,
R_AARCH64_JUMP_SLOT = 1026,
R_ARM_JUMP_SLOT = 22,
R_PPC_JMP_SLOT = 21,
R_PPC64_JMP_SLOT = R_PPC_JMP_SLOT,
R_X86_64_JUMP_SLOT = 7
};
#endif //}
#ifdef WANT_NHDR_ENUM
#undef WANT_NHDR_ENUM
enum { // ELF PT_NOTE types
#define ELF_NOTE_GNU_NAME "GNU\0"
NT_GNU_ABI_TAG = 1,
NT_GNU_HWCAP = 2,
NT_GNU_BUILD_ID = 3,
#define ELF_NOTE_OPENBSD_NAME "OpenBSD\0"
NHDR_OPENBSD_TAG = 1,
#define ELF_NOTE_NETBSD_NAME "NetBSD\0"
NHDR_NETBSD_TAG = 1,
NHDR_CHECKSUM_TAG = 2,
NHDR_PAX_TAG = 3
};
enum { // descsz descriptor sizes
GNU_ABI_DESCSZ = 16, // int GNU_OS, major, minor, subminor;
NETBSD_DESCSZ = 4, // major_ver * (10**8) + minor
OPENBSD_DESCSZ = 4, // 32-bit zero
// CHECKSUM_DESCSZ is 2*sizeof(short) + sizeof(checksum)
PAX_DESCSZ = 4 // 32-bit mask
};
enum { // GNU OS/version
GNU_OS_LINUX = 0,
GNU_OS_HURD = 1,
GNU_OS_SOLARIS = 2
};
enum { // NetBSD checksum methods
CHECKSUM_CRC32 = 1,
CHECKSUM_MD5 = 2,
CHECKSUM_SHA1 = 3,
CHECKSUM_SHA256 = 4
};
#define ELF_NOTE_PAX_NAME "PaX\0"
enum { // NetBSD PaX bit values
PAX_MPROTECT = (1<<0), /* force enable Mprotect */
PAX_NOMPROTECT = (1<<1), /* force disable Mprotect */
PAX_GUARD = (1<<2), /* force enable SEGVguard */
PAX_NOGUARD = (1<<3), /* force disable SEGVguard */
PAX_ASLR = (1<<4), /* force enable ASLR */
PAX_NOASLR = (1<<5) /* force disable ASLR */
};
#endif
/* vim:set ts=4 sw=4 et: */
-179
View File
@@ -1,179 +0,0 @@
/* p_elks.cpp --
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
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 ml1050@users.sourceforge.net
*/
#include "conf.h"
#if 0
#include "file.h"
#include "filter.h"
#include "packer.h"
#include "p_vmlinz.h"
// FIXME
static const
#include "stub/l_vmlinz.h"
// from elks-0.0.83/Documentation/boot.txt
static const unsigned kernel_entry = 0x100000;
static const unsigned stack_during_uncompression = 0x90000;
static const unsigned zimage_offset = 0x1000;
/*************************************************************************
//
**************************************************************************/
const int *PackElks8086::getCompressionMethods(int method, int level) const
{
return Packer::getDefaultCompressionMethods_8(method, level);
}
const int *PackElks8086::getFilters() const
{
return NULL;
}
/*************************************************************************
// common util routines
**************************************************************************/
int PackElks8086::decompressKernel()
{
// not used
return 0;
}
void PackElks8086::readKernel()
{
int klen = file_size - setup_size;
fi->seek(0, SEEK_SET);
setup_buf.alloc(setup_size);
fi->readx(setup_buf, setup_size);
ibuf.alloc(klen);
fi->readx(ibuf, klen);
obuf.allocForCompression(klen);
ph.u_len = klen;
ph.filter = 0;
}
/*************************************************************************
//
**************************************************************************/
void PackElks8086::buildLoader(const Filter *ft)
{
// prepare loader
initLoader(nrv_loader, sizeof(nrv_loader));
// FIXME
UNUSED(ft);
}
void PackElks8086::pack(OutputFile *fo)
{
readKernel();
// prepare filter
Filter ft(ph.level);
ft.buf_len = ph.u_len;
ft.addvalue = kernel_entry;
// compress
compressWithFilters(&ft, overlap_range, NULL_cconf);
const unsigned lsize = getLoaderSize();
MemBuffer loader(lsize);
memcpy(loader, getLoader(), lsize);
patchPackHeader(loader, lsize);
#if 0
// FIXME
defineFilterSymbols(&ft);
defineDecompressorSymbols();
//patch_le32(loader, lsize, "ESI1", zimage_offset + lsize);
//patch_le32(loader, lsize, "KEIP", kernel_entry);
//patch_le32(loader, lsize, "STAK", stack_during_uncompression);
#endif
boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf);
bs->sys_size = ALIGN_UP(lsize + ph.c_len, 16) / 16;
fo->write(setup_buf, setup_buf.getSize());
fo->write(loader, lsize);
fo->write(obuf, ph.c_len);
#if 0
printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize());
printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize);
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len);
#endif
// finally check the compression ratio
if (!checkFinalCompressionRatio(fo))
throwNotCompressible();
}
/*************************************************************************
// unpack
**************************************************************************/
int PackElks8086::canUnpack()
{
if (readFileHeader() != getFormat())
return false;
fi->seek(setup_size, SEEK_SET);
return readPackHeader(1024) ? 1 : -1;
}
void PackElks8086::unpack(OutputFile *)
{
// no uncompression support for this format yet
// FIXME: but we could write the uncompressed "Image" image
throwCantUnpack("build a new kernel instead :-)");
}
#endif /* if 0 */
/*
vi:ts=4:et
*/
+19 -18
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
@@ -51,20 +51,21 @@ PackExe::PackExe(InputFile *f) :
super(f)
{
bele = &N_BELE_RTP::le_policy;
COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 32);
COMPILE_TIME_ASSERT(sizeof(exe_header_t) == 32)
COMPILE_TIME_ASSERT_ALIGNED1(exe_header_t)
ih_exesize = ih_imagesize = ih_overlay = 0;
stack_for_lzma = 0;
use_clear_dirty_stack = false;
// disable lzma for "--brute" unless explicitly given "--lzma"
if (opt->all_methods_use_lzma && !opt->method_lzma_seen)
opt->all_methods_use_lzma = false;
}
const int *PackExe::getCompressionMethods(int method, int level) const
{
bool small = ih_imagesize <= 256*1024;
// disable lzma for "--brute" unless explicitly given "--lzma"
// WARNING: this side effect persists for later files!
if (opt->all_methods_use_lzma && !opt->method_lzma_seen)
opt->all_methods_use_lzma = false;
return Packer::getDefaultCompressionMethods_8(method, level, small);
}
@@ -280,9 +281,13 @@ int PackExe::readFileHeader()
if (ih.ident != 'M' + 'Z'*256 && ih.ident != 'Z' + 'M'*256)
return 0;
ih_exesize = ih.m512 + ih.p512*512 - (ih.m512 ? 512 : 0);
if (!ih_exesize) {
ih_exesize = file_size;
}
ih_imagesize = ih_exesize - ih.headsize16*16;
ih_overlay = file_size - ih_exesize;
if (ih.m512+ih.p512*512u < sizeof (ih))
if (file_size < (int)sizeof(ih)
|| ((ih.m512 | ih.p512) && ih.m512+ih.p512*512u < sizeof (ih)))
throwCantPack("illegal exe header");
if (file_size < (off_t)ih_exesize || ih_imagesize <= 0 || ih_imagesize > ih_exesize)
throwCantPack("exe header corrupted");
@@ -478,7 +483,7 @@ void PackExe::pack(OutputFile *fo)
for (ic = 0; ic < ih.relocs; ic++)
{
unsigned jc = get_le32(wr+4*ic);
set_le32(wr+4*ic, (jc>>16)*16+(jc&0xffff));
set_le32(wr+4*ic, ((jc>>16)*16+(jc&0xffff)) & 0xfffff);
}
qsort(wr,ih.relocs,4,le32_compare);
relocsize = optimize_relocs(ibuf, ih_imagesize, wr, ih.relocs, w, &has_9a);
@@ -506,14 +511,14 @@ void PackExe::pack(OutputFile *fo)
// compress (max_match = 8192)
upx_compress_config_t cconf; cconf.reset();
cconf.conf_ucl.max_match = MAXMATCH;
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, 32, &cconf);
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
if (ph.max_run_found + ph.max_match_found > 0x8000)
throwCantPack("decompressor limit exceeded, send a bugreport");
#ifdef TESTING
#if TESTING
if (opt->debug.debug_level)
{
printf("image+relocs %d -> %d\n",ih_imagesize+relocsize,ph.c_len);
@@ -630,7 +635,7 @@ void PackExe::pack(OutputFile *fo)
//fprintf(stderr,"\ne_len=%x d_len=%x c_len=%x oo=%x ulen=%x destp=%x copys=%x images=%x",e_len,d_len,packedsize,ph.overlap_overhead,ph.u_len,destpara,copysize,ih_imagesize);
// write header + write loader + compressed file
#ifdef TESTING
#if TESTING
if (opt->debug.debug_level)
printf("\n%d %d %d %d\n",(int)sizeof(oh),e_len,packedsize,d_len);
#endif
@@ -869,8 +874,4 @@ DDnneelllCCCCCCCCCCCCCCCCCCCCCCCCC
*/
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+9 -14
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,12 +22,12 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
markus@oberhumer.com ml1050@users.sourceforge.net
<markus@oberhumer.com> <ezerotven+github@gmail.com>
*/
#ifndef __UPX_P_EXE_H
#define __UPX_P_EXE_H
#define __UPX_P_EXE_H 1
/*************************************************************************
@@ -42,7 +42,8 @@ public:
virtual int getVersion() const { return 13; }
virtual int getFormat() const { return UPX_F_DOS_EXE; }
virtual const char *getName() const { return "dos/exe"; }
virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.exe" : "i286-dos16.exe"; }
//virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.exe" : "i286-dos16.exe"; }
virtual const char *getFullName(const options_t *) const { return "i086-dos16.exe"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
@@ -73,8 +74,7 @@ protected:
virtual Linker* newLinker() const;
void addLoaderEpilogue(int flag);
struct exe_header_t
{
__packed_struct(exe_header_t)
LE16 ident;
LE16 m512;
LE16 p512;
@@ -90,8 +90,7 @@ protected:
LE16 relocoffs;
char __[2]; // overlnum
LE32 firstreloc;
}
__attribute_packed;
__packed_struct_end()
exe_header_t ih, oh;
@@ -119,8 +118,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+3592 -658
View File
File diff suppressed because it is too large Load Diff
+315 -87
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -31,7 +31,7 @@
#ifndef __UPX_P_LX_ELF_H //{
#define __UPX_P_LX_ELF_H
#define __UPX_P_LX_ELF_H 1
class PackLinuxElf : public PackUnix
@@ -50,8 +50,8 @@ protected:
// because they depend on Elf32 or Elf64 data structures, which differ.
virtual void pack1(OutputFile *, Filter &) = 0; // generate executable header
virtual void pack2(OutputFile *, Filter &) = 0; // append compressed data
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
virtual int pack2(OutputFile *, Filter &) = 0; // append compressed data
virtual off_t pack3(OutputFile *, Filter &) = 0; // append loader
//virtual void pack4(OutputFile *, Filter &) = 0; // append pack header
virtual void generateElfHdr(
@@ -61,21 +61,48 @@ protected:
) = 0;
virtual void defineSymbols(Filter const *);
virtual void addStubEntrySections(Filter const *);
virtual void unpack(OutputFile *fo) = 0;
virtual void unpack(OutputFile *fo);
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const = 0;
static unsigned elf_hash(char const *) /*const*/;
static unsigned gnu_hash(char const *) /*const*/;
protected:
char *file_image; // if ET_DYN investigation
static unsigned int const asl_delta = (1u<<12); // --android-shlib extra page
unsigned e_type;
unsigned e_phnum; /* Program header table entry count */
unsigned e_shnum;
MemBuffer file_image; // if ET_DYN investigation
char const *dynstr; // from DT_STRTAB
unsigned sz_phdrs; // sizeof Phdr[]
unsigned sz_elf_hdrs; // all Elf headers
unsigned sz_pack2; // after pack2(), before loader
unsigned sz_pack2a; // after pack2() of all PT_LOAD
unsigned lg2_page; // log2(PAGE_SIZE)
unsigned page_size; // 1u<<lg2_page
bool is_pie; // is Position-Independent-Executable (ET_DYN main program)
unsigned xct_off; // shared library: file offset of SHT_EXECINSTR
unsigned hatch_off; // file offset of escape hatch
unsigned o_binfo; // offset to first b_info
upx_uint64_t load_va; // PT_LOAD[0].p_vaddr
upx_uint64_t xct_va; // minimum SHT_EXECINSTR virtual address
upx_uint64_t jni_onload_va; // runtime &JNI_OnLoad
upx_uint64_t user_init_va;
unsigned user_init_off; // within file_image
unsigned short e_machine;
upx_uint16_t e_machine;
unsigned char ei_class;
unsigned char ei_data;
unsigned char ei_osabi;
char const *osabi_note;
unsigned upx_dt_init; // DT_INIT, DT_PREINIT_ARRAY, DT_INIT_ARRAY
static unsigned const DT_NUM = 34; // elf.h
unsigned dt_table[DT_NUM]; // 1+ index in PT_DYNAMIC
unsigned char const *buildid_data;
int o_elf_shnum; // num output Shdrs
static unsigned char o_shstrtab[];
};
class PackLinuxElf32 : public PackLinuxElf
@@ -85,6 +112,7 @@ public:
PackLinuxElf32(InputFile *f);
virtual ~PackLinuxElf32();
protected:
virtual void PackLinuxElf32help1(InputFile *f);
virtual int checkEhdr(Elf32_Ehdr const *ehdr) const;
virtual bool canPack();
@@ -92,18 +120,22 @@ protected:
// but the class hierarchy splits after this class.
virtual void ARM_defineSymbols(Filter const *ft);
virtual void ARM_updateLoader(OutputFile *);
virtual int ARM_is_QNX(void);
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void pack2(OutputFile *, Filter &); // append compressed data
virtual void pack3(OutputFile *, Filter &); // append loader
virtual int pack2(OutputFile *, Filter &); // append compressed data
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append pack header
virtual void unpack(OutputFile *fo);
virtual void unRel32(unsigned dt_rel, Elf32_Rel *rel0, unsigned relsz,
MemBuffer &membuf, unsigned const load_off, OutputFile *fo);
virtual void generateElfHdr(
OutputFile *,
void const *proto,
unsigned const brka
);
virtual void defineSymbols(Filter const *);
virtual void buildLinuxLoader(
upx_byte const *const proto, // assembly-only sections
unsigned const szproto,
@@ -117,58 +149,94 @@ protected:
virtual unsigned find_LOAD_gap(Elf32_Phdr const *const phdri, unsigned const k,
unsigned const e_phnum);
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
bool calls_crt1(Elf32_Rel const *rel, int sz);
static unsigned elf_hash(char const *) /*const*/;
virtual void const *elf_find_dynamic(unsigned) const;
virtual Elf32_Sym const *elf_lookup(char const *) const;
virtual unsigned elf_get_offset_from_address(unsigned) const;
Elf32_Phdr const *elf_find_ptype(unsigned type, Elf32_Phdr const *phdr0, unsigned phnum);
Elf32_Shdr const *elf_find_section_name(char const *) const;
Elf32_Shdr const *elf_find_section_type(unsigned) const;
unsigned check_pt_dynamic(Elf32_Phdr const *);
void invert_pt_dynamic(Elf32_Dyn const *);
void const *elf_find_dynamic(unsigned) const;
Elf32_Dyn const *elf_has_dynamic(unsigned) const;
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
protected:
Elf32_Ehdr ehdri; // from input file
MemBuffer lowmem; // especially for shlib
Elf32_Phdr *phdri; // for input file
Elf32_Shdr *shdri; // from input file
Elf32_Phdr const *gnu_stack; // propagate NX
unsigned e_phoff;
unsigned e_shoff;
unsigned sz_dynseg; // PT_DYNAMIC.p_memsz
unsigned so_slide;
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
unsigned note_size; // total size of PT_NOTEs
unsigned n_jmp_slot;
unsigned plt_off;
unsigned page_mask; // AND clears the offset-within-page
Elf32_Dyn const *dynseg; // from PT_DYNAMIC
unsigned int const *hashtab; // from DT_HASH
unsigned int const *gashtab; // from DT_GNU_HASH
Elf32_Sym const *dynsym; // from DT_SYMTAB
Elf32_Sym const *jni_onload_sym;
char const *shstrtab; // via Elf32_Shdr
struct cprElfHdr1 {
Elf32_Shdr *sec_strndx;
Elf32_Shdr const *sec_dynsym;
Elf32_Shdr const *sec_dynstr;
__packed_struct(cprElfHdr1)
Elf32_Ehdr ehdr;
Elf32_Phdr phdr[1];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr2 {
__packed_struct(cprElfHdr2)
Elf32_Ehdr ehdr;
Elf32_Phdr phdr[2];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr3 {
__packed_struct(cprElfHdr3)
Elf32_Ehdr ehdr;
Elf32_Phdr phdr[3];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
cprElfHdr3 elfout;
__packed_struct(cprElfHdrNetBSD)
Elf32_Ehdr ehdr;
Elf32_Phdr phdr[4];
unsigned char notes[512];
__packed_struct_end()
struct Elf32_Note {
unsigned namesz; // 8
unsigned descsz; // 4
unsigned type; // 1
char text[0x18 - 4*4]; // "OpenBSD"
unsigned end; // 0
} elfnote;
cprElfHdrNetBSD elfout;
__packed_struct(cprElfShdr3)
Elf32_Shdr shdr[3];
__packed_struct_end()
cprElfShdr3 shdrout;
struct Elf32_Nhdr {
unsigned namesz;
unsigned descsz;
unsigned type;
//unsigned char body[0];
};
static void compileTimeAssertions() {
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 52 + 1*32 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 52 + 2*32 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 52 + 3*32 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdrNetBSD) == 52 + 4*32 + 512)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdrNetBSD)
}
};
@@ -182,19 +250,24 @@ public:
/*virtual void buildLoader(const Filter *);*/
protected:
virtual void PackLinuxElf64help1(InputFile *f);
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
virtual bool canPack();
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void pack2(OutputFile *, Filter &); // append compressed data
virtual void pack3(OutputFile *, Filter &); // append loader
virtual int pack2(OutputFile *, Filter &); // append compressed data
virtual off_t pack3(OutputFile *, Filter &); // append loader
virtual void pack4(OutputFile *, Filter &); // append pack header
virtual void unpack(OutputFile *fo);
virtual void unRela64(upx_uint64_t dt_rela, Elf64_Rela *rela0, unsigned relasz,
MemBuffer &membuf, upx_uint64_t const load_off, OutputFile *fo);
virtual void generateElfHdr(
OutputFile *,
void const *proto,
unsigned const brka
);
virtual void defineSymbols(Filter const *);
virtual void buildLinuxLoader(
upx_byte const *const proto, // assembly-only sections
unsigned const szproto,
@@ -207,41 +280,87 @@ protected:
virtual void updateLoader(OutputFile *fo);
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
unsigned const e_phnum);
bool calls_crt1(Elf64_Rela const *rela, int sz);
virtual Elf64_Sym const *elf_lookup(char const *) const;
virtual upx_uint64_t elf_get_offset_from_address(upx_uint64_t) const;
Elf64_Phdr const *elf_find_ptype(unsigned type, Elf64_Phdr const *phdr0, unsigned phnum);
Elf64_Shdr const *elf_find_section_name(char const *) const;
Elf64_Shdr const *elf_find_section_type(unsigned) const;
upx_uint64_t check_pt_dynamic(Elf64_Phdr const *);
void invert_pt_dynamic(Elf64_Dyn const *);
void const *elf_find_dynamic(unsigned) const;
Elf64_Dyn const *elf_has_dynamic(unsigned) const;
virtual upx_uint64_t elf_unsigned_dynamic(unsigned) const;
protected:
Elf64_Ehdr ehdri; // from input file
MemBuffer lowmem; // especially for shlib
Elf64_Phdr *phdri; // for input file
Elf64_Shdr *shdri; // from input file
Elf64_Phdr const *gnu_stack; // propagate NX
upx_uint64_t e_phoff;
upx_uint64_t e_shoff;
upx_uint64_t sz_dynseg; // PT_DYNAMIC.p_memsz
upx_uint64_t so_slide;
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
unsigned note_size; // total size of PT_NOTEs
unsigned n_jmp_slot;
upx_uint64_t plt_off;
upx_uint64_t page_mask; // AND clears the offset-within-page
struct cprElfHdr1 {
Elf64_Dyn const *dynseg; // from PT_DYNAMIC
unsigned int const *hashtab; // from DT_HASH
unsigned int const *gashtab; // from DT_GNU_HASH
Elf64_Sym const *dynsym; // from DT_SYMTAB
Elf64_Sym const *jni_onload_sym;
char const *shstrtab; // via Elf64_Shdr
Elf64_Shdr *sec_strndx;
Elf64_Shdr const *sec_dynsym;
Elf64_Shdr const *sec_dynstr;
__packed_struct(cprElfHdr1)
Elf64_Ehdr ehdr;
Elf64_Phdr phdr[1];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr2 {
__packed_struct(cprElfHdr2)
Elf64_Ehdr ehdr;
Elf64_Phdr phdr[2];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr3 {
__packed_struct(cprElfHdr3)
Elf64_Ehdr ehdr;
Elf64_Phdr phdr[3];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
cprElfHdr3 elfout;
__packed_struct(cprElfHdr4)
Elf64_Ehdr ehdr;
Elf64_Phdr phdr[4];
l_info linfo;
__packed_struct_end()
cprElfHdr4 elfout;
__packed_struct(cprElfShdr3)
Elf64_Shdr shdr[3];
__packed_struct_end()
cprElfShdr3 shdrout;
static void compileTimeAssertions() {
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 64 + 1*56 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 64 + 2*56 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 64 + 3*56 + 12)
COMPILE_TIME_ASSERT(sizeof(cprElfHdr4) == 64 + 4*56 + 12)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr4)
}
};
@@ -249,44 +368,47 @@ class PackLinuxElf32Be : public PackLinuxElf32
{
typedef PackLinuxElf32 super;
protected:
PackLinuxElf32Be(InputFile *f) : super(f) { bele = &N_BELE_RTP::be_policy; }
virtual acc_uint64l_t get_native64(const void *b) const { return get_be64(b); }
virtual unsigned get_native32(const void *b) const { return get_be32(b); }
virtual unsigned get_native16(const void *b) const { return get_be16(b); }
virtual void set_native64(void *b, acc_uint64l_t v) const { set_be64(b, v); }
virtual void set_native32(void *b, unsigned v) const { set_be32(b, v); }
virtual void set_native16(void *b, unsigned v) const { set_be16(b, v); }
PackLinuxElf32Be(InputFile *f) : super(f) {
bele = &N_BELE_RTP::be_policy;
PackLinuxElf32help1(f);
}
};
class PackLinuxElf32Le : public PackLinuxElf32
{
typedef PackLinuxElf32 super;
protected:
PackLinuxElf32Le(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; }
virtual acc_uint64l_t get_native64(const void *b) const { return get_le64(b); }
virtual unsigned get_native32(const void *b) const { return get_le32(b); }
virtual unsigned get_native16(const void *b) const { return get_le16(b); }
virtual void set_native64(void *b, acc_uint64l_t v) const { set_le64(b, v); }
virtual void set_native32(void *b, unsigned v) const { set_le32(b, v); }
virtual void set_native16(void *b, unsigned v) const { set_le16(b, v); }
PackLinuxElf32Le(InputFile *f) : super(f) {
bele = &N_BELE_RTP::le_policy;
PackLinuxElf32help1(f);
}
};
class PackLinuxElf64Le : public PackLinuxElf64
{
typedef PackLinuxElf64 super;
protected:
PackLinuxElf64Le(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; }
virtual acc_uint64l_t get_native64(const void *b) const { return get_le64(b); }
virtual unsigned get_native32(const void *b) const { return get_le32(b); }
virtual unsigned get_native16(const void *b) const { return get_le16(b); }
virtual void set_native64(void *b, acc_uint64l_t v) const { set_le64(b, v); }
virtual void set_native32(void *b, unsigned v) const { set_le32(b, v); }
virtual void set_native16(void *b, unsigned v) const { set_le16(b, v); }
PackLinuxElf64Le(InputFile *f) : super(f) {
lg2_page=16;
page_size=1u<<lg2_page;
bele = &N_BELE_RTP::le_policy;
PackLinuxElf64help1(f);
}
};
class PackLinuxElf64Be : public PackLinuxElf64
{
typedef PackLinuxElf64 super;
protected:
PackLinuxElf64Be(InputFile *f) : super(f) {
lg2_page=16;
page_size=1u<<lg2_page;
bele = &N_BELE_RTP::be_policy;
PackLinuxElf64help1(f);
}
};
/*************************************************************************
// linux/elf64amd
**************************************************************************/
@@ -298,18 +420,34 @@ public:
PackLinuxElf64amd(InputFile *f);
virtual ~PackLinuxElf64amd();
virtual int getFormat() const { return UPX_F_LINUX_ELF64_AMD; }
virtual const char *getName() const { return "linux/ElfAMD"; }
virtual const char *getName() const { return "linux/amd64"; }
virtual const char *getFullName(const options_t *) const { return "amd64-linux.elf"; }
virtual const int *getFilters() const;
virtual bool canPack();
protected:
virtual void pack1(OutputFile *, Filter &); // generate executable header
//virtual void pack3(OutputFile *, Filter &); // append loader
virtual void buildLoader(const Filter *);
virtual Linker* newLinker() const;
virtual void defineSymbols(Filter const *);
};
class PackLinuxElf64arm : public PackLinuxElf64Le
{
typedef PackLinuxElf64Le super;
public:
PackLinuxElf64arm(InputFile *f);
virtual ~PackLinuxElf64arm();
virtual int getFormat() const { return UPX_F_LINUX_ELF64_ARM; }
virtual const char *getName() const { return "linux/arm64"; }
virtual const char *getFullName(const options_t *) const { return "arm64-linux.elf"; }
virtual const int *getFilters() const;
protected:
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void buildLoader(const Filter *);
virtual Linker* newLinker() const;
virtual void defineSymbols(Filter const *);
};
/*************************************************************************
// linux/elf32ppc
**************************************************************************/
@@ -321,7 +459,7 @@ public:
PackLinuxElf32ppc(InputFile *f);
virtual ~PackLinuxElf32ppc();
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC32; }
virtual const char *getName() const { return "linux/ElfPPC"; }
virtual const char *getName() const { return "linux/ppc32"; }
virtual const char *getFullName(const options_t *) const { return "powerpc-linux.elf"; }
virtual const int *getFilters() const;
protected:
@@ -330,6 +468,48 @@ protected:
virtual Linker* newLinker() const;
};
/*************************************************************************
// linux/elf64ppcle
**************************************************************************/
class PackLinuxElf64ppcle : public PackLinuxElf64Le
{
typedef PackLinuxElf64Le super;
public:
PackLinuxElf64ppcle(InputFile *f);
virtual ~PackLinuxElf64ppcle();
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC64LE; }
virtual const char *getName() const { return "linux/ppc64le"; }
virtual const char *getFullName(const options_t *) const { return "powerpc64le-linux.elf"; }
virtual const int *getFilters() const;
protected:
unsigned lg2_page; // log2(PAGE_SIZE)
unsigned page_size; // 1u<<lg2_page
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void buildLoader(const Filter *);
virtual Linker* newLinker() const;
};
class PackLinuxElf64ppc : public PackLinuxElf64Be
{
typedef PackLinuxElf64Be super;
public:
PackLinuxElf64ppc(InputFile *f);
virtual ~PackLinuxElf64ppc();
virtual int getFormat() const { return UPX_F_LINUX_ELFPPC64; }
virtual const char *getName() const { return "linux/ppc64"; }
virtual const char *getFullName(const options_t *) const { return "powerpc64-linux.elf"; }
virtual const int *getFilters() const;
protected:
unsigned lg2_page; // log2(PAGE_SIZE)
unsigned page_size; // 1u<<lg2_page
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void buildLoader(const Filter *);
virtual Linker* newLinker() const;
};
/*************************************************************************
// linux/elf386
**************************************************************************/
@@ -341,12 +521,10 @@ public:
PackLinuxElf32x86(InputFile *f);
virtual ~PackLinuxElf32x86();
virtual int getFormat() const { return UPX_F_LINUX_ELF_i386; }
virtual const char *getName() const { return "linux/elf386"; }
virtual const char *getName() const { return "linux/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf"; }
virtual const int *getFilters() const;
virtual void unpack(OutputFile *fo);
protected:
virtual void pack1(OutputFile *, Filter &); // generate executable header
@@ -362,8 +540,9 @@ class PackBSDElf32x86 : public PackLinuxElf32x86
public:
PackBSDElf32x86(InputFile *f);
virtual ~PackBSDElf32x86();
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
virtual const char *getName() const { return "BSD/elf386"; }
virtual int getFormat() const = 0;
virtual const char *getName() const = 0;
virtual const char *getFullName(const options_t *) const = 0;
protected:
virtual void pack1(OutputFile *, Filter &); // generate executable header
@@ -377,16 +556,27 @@ class PackFreeBSDElf32x86 : public PackBSDElf32x86
public:
PackFreeBSDElf32x86(InputFile *f);
virtual ~PackFreeBSDElf32x86();
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
virtual const char *getName() const { return "freebsd/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-freebsd.elf"; }
};
class PackNetBSDElf32x86 : public PackBSDElf32x86
class PackNetBSDElf32x86 : public PackLinuxElf32x86
{
typedef PackBSDElf32x86 super;
typedef PackLinuxElf32x86 super;
public:
PackNetBSDElf32x86(InputFile *f);
virtual ~PackNetBSDElf32x86();
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
virtual const char *getName() const { return "netbsd/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; }
protected:
virtual void buildLoader(const Filter *ft);
virtual void generateElfHdr(
OutputFile *,
void const *proto,
unsigned const brka
);
};
class PackOpenBSDElf32x86 : public PackBSDElf32x86
@@ -395,6 +585,8 @@ class PackOpenBSDElf32x86 : public PackBSDElf32x86
public:
PackOpenBSDElf32x86(InputFile *f);
virtual ~PackOpenBSDElf32x86();
virtual int getFormat() const { return UPX_F_BSD_ELF_i386; }
virtual const char *getName() const { return "openbsd/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-openbsd.elf"; }
protected:
@@ -406,6 +598,7 @@ protected:
);
};
/*************************************************************************
// linux/elfarm
**************************************************************************/
@@ -416,8 +609,8 @@ class PackLinuxElf32armLe : public PackLinuxElf32Le
public:
PackLinuxElf32armLe(InputFile *f);
virtual ~PackLinuxElf32armLe();
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMLE; }
virtual const char *getName() const { return "linux/armLE"; }
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMEL; }
virtual const char *getName() const { return "linux/arm"; }
virtual const char *getFullName(const options_t *) const { return "arm-linux.elf"; }
virtual const int *getFilters() const;
@@ -436,8 +629,8 @@ class PackLinuxElf32armBe : public PackLinuxElf32Be
public:
PackLinuxElf32armBe(InputFile *f);
virtual ~PackLinuxElf32armBe();
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMBE; }
virtual const char *getName() const { return "linux/armBE"; }
virtual int getFormat() const { return UPX_F_LINUX_ELF32_ARMEB; }
virtual const char *getName() const { return "linux/armeb"; }
virtual const char *getFullName(const options_t *) const { return "armeb-linux.elf"; }
virtual const int *getFilters() const;
@@ -450,10 +643,45 @@ protected:
virtual void defineSymbols(Filter const *);
};
class PackLinuxElf32mipseb : public PackLinuxElf32Be
{
typedef PackLinuxElf32Be super;
public:
PackLinuxElf32mipseb(InputFile *f);
virtual ~PackLinuxElf32mipseb();
virtual int getFormat() const { return UPX_F_LINUX_ELF32_MIPSEB; }
virtual const char *getName() const { return "linux/mips"; }
virtual const char *getFullName(const options_t *) const { return "mips-linux.elf"; }
virtual const int *getFilters() const;
protected:
virtual Linker* newLinker() const;
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void buildLoader(const Filter *);
virtual void updateLoader(OutputFile *);
virtual void defineSymbols(Filter const *);
};
class PackLinuxElf32mipsel : public PackLinuxElf32Le
{
typedef PackLinuxElf32Le super;
public:
PackLinuxElf32mipsel(InputFile *f);
virtual ~PackLinuxElf32mipsel();
virtual int getFormat() const { return UPX_F_LINUX_ELF32_MIPSEL; }
virtual const char *getName() const { return "linux/mipsel"; }
virtual const char *getFullName(const options_t *) const { return "mipsel-linux.elf"; }
virtual const int *getFilters() const;
protected:
virtual Linker* newLinker() const;
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void buildLoader(const Filter *);
virtual void updateLoader(OutputFile *);
virtual void defineSymbols(Filter const *);
};
#endif /*} already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+25 -26
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2001-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2001-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -132,8 +132,8 @@ PackLinuxI386::generateElfHdr(
unsigned const brka
)
{
cprElfHdr2 *const h2 = (cprElfHdr2 *)&elfout;
cprElfHdr3 *const h3 = (cprElfHdr3 *)&elfout;
cprElfHdr2 *const h2 = (cprElfHdr2 *)(void *)&elfout;
cprElfHdr3 *const h3 = (cprElfHdr3 *)(void *)&elfout;
memcpy(h3, proto, sizeof(*h3)); // reads beyond, but OK
assert(h2->ehdr.e_phoff == sizeof(Elf32_Ehdr));
@@ -375,7 +375,7 @@ PackLinuxI386::buildLinuxLoader(
addLoader("FOLDEXEC", NULL);
if (M_IS_LZMA(ph.method)) {
const lzma_compress_result_t *res = &ph.compress_result.result_lzma;
acc_uint32e_t properties = // lc, lp, pb, dummy
upx_uint32_t properties = // lc, lp, pb, dummy
(res->lit_context_bits << 0) |
(res->lit_pos_bits << 8) |
(res->pos_bits << 16);
@@ -449,7 +449,7 @@ int PackLinuxI386::getLoaderPrefixSize() const
// some ELF utitlity functions
**************************************************************************/
// basic check of an Linux ELF Ehdr
// basic check of a Linux ELF Ehdr
int PackLinuxI386::checkEhdr(const Elf_LE32_Ehdr *ehdr) const
{
const unsigned char * const buf = ehdr->e_ident;
@@ -526,28 +526,31 @@ bool PackLinuxI386::canPack()
ei_osabi = osabi0; // Proudly declares its osabi in Ehdr.
break;
default:
unsigned const e_phnum = get_native16(&ehdr.e_phnum);
unsigned const e_phnum = get_te16(&ehdr.e_phnum);
if (e_phnum<=(512/sizeof(Elf32_Phdr))) {
char buf2[512];
fi->seek(get_native32(&ehdr.e_phoff), SEEK_SET);
fi->readx(buf2, sizeof(buf2));
union {
unsigned char buf2[512];
//Elf32_Phdr phdr;
} u;
fi->seek(get_te32(&ehdr.e_phoff), SEEK_SET);
fi->readx(u.buf2, sizeof(u.buf2));
fi->seek(0, SEEK_SET);
Elf32_Phdr const *phdr = (Elf32_Phdr const *)buf2;
Elf32_Phdr const *phdr = (Elf32_Phdr *) u.buf2;
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
if (phdr->PT_NOTE == get_native32(&phdr->p_type)) {
unsigned const offset = get_native32(&phdr->p_offset);
if (phdr->PT_NOTE == get_te32(&phdr->p_type)) {
unsigned const offset = get_te32(&phdr->p_offset);
struct Elf32_Note note; memset(&note, 0, sizeof(note));
fi->seek(offset, SEEK_SET);
fi->readx(&note, sizeof(note));
fi->seek(0, SEEK_SET);
if (4==get_native32(&note.descsz)
&& 1==get_native32(&note.type)
if (4==get_te32(&note.descsz)
&& 1==get_te32(&note.type)
&& 0==note.end ) {
if (0==strcmp("NetBSD", (char const *)&note.text)) {
if (0==strcmp("NetBSD", (char const *)note.text)) {
ei_osabi = Elf32_Ehdr::ELFOSABI_NETBSD;
break;
}
if (0==strcmp("OpenBSD", (char const *)&note.text)) {
if (0==strcmp("OpenBSD", (char const *)note.text)) {
ei_osabi = Elf32_Ehdr::ELFOSABI_OPENBSD;
break;
}
@@ -598,11 +601,11 @@ void PackLinuxI386::patchLoaderChecksum()
// checksum for loader + p_info
lp->l_checksum = 0;
lp->l_magic = UPX_ELF_MAGIC;
lp->l_lsize = (unsigned short) lsize;
set_te16(&lp->l_lsize, (upx_uint16_t) lsize);
lp->l_version = (unsigned char) ph.version;
lp->l_format = (unsigned char) ph.format;
// INFO: lp->l_checksum is currently unused
lp->l_checksum = upx_adler32(ptr, lsize);
set_te32(&lp->l_checksum, upx_adler32(ptr, lsize));
}
@@ -611,8 +614,4 @@ void PackLinuxI386::updateLoader(OutputFile *fo)
elfout.ehdr.e_entry = fo->getBytesWritten() + elfout.phdr[0].p_vaddr;
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+13 -20
View File
@@ -2,8 +2,8 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -22,7 +22,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -30,7 +30,7 @@
#ifndef __UPX_P_LX_EXC_H
#define __UPX_P_LX_EXC_H
#define __UPX_P_LX_EXC_H 1
/*************************************************************************
@@ -48,7 +48,7 @@ public:
unsigned const brka
);
virtual int getFormat() const { return UPX_F_LINUX_i386; }
virtual const char *getName() const { return "linux/386"; }
virtual const char *getName() const { return "linux.exec/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.execve"; }
virtual const int *getCompressionMethods(int method, int level) const;
virtual const int *getFilters() const;
@@ -87,26 +87,23 @@ protected:
unsigned n_mru;
struct cprElfHdr1 {
__packed_struct(cprElfHdr1)
Elf_LE32_Ehdr ehdr;
Elf_LE32_Phdr phdr[1];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr2 {
__packed_struct(cprElfHdr2)
Elf_LE32_Ehdr ehdr;
Elf_LE32_Phdr phdr[2];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
struct cprElfHdr3 {
__packed_struct(cprElfHdr3)
Elf_LE32_Ehdr ehdr;
Elf_LE32_Phdr phdr[3];
l_info linfo;
}
__attribute_packed;
__packed_struct_end()
cprElfHdr3 elfout;
@@ -138,7 +135,7 @@ class PackBSDI386 : public PackLinuxI386
public:
PackBSDI386(InputFile *f);
virtual int getFormat() const { return UPX_F_BSD_i386; }
virtual const char *getName() const { return "*BSD/386"; }
virtual const char *getName() const { return "bsd.exec/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-bsd.elf.execve"; }
protected:
@@ -148,8 +145,4 @@ protected:
};
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+25 -25
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -82,7 +82,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
assert(ehdri.e_phoff == sizeof(Elf32_Ehdr)); // checked by canPack()
sz_phdrs = ehdri.e_phnum * ehdri.e_phentsize;
phdri = new Elf32_Phdr[(unsigned)ehdri.e_phnum];
phdri = New(Elf32_Phdr, ehdri.e_phnum);
fi->seek(ehdri.e_phoff, SEEK_SET);
fi->readx(phdri, sz_phdrs);
@@ -114,7 +114,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
h3.phdr[2].p_align = 1;
if (opt->o_unix.make_ptinterp) { // unusual "once per release"
elfout = h3;
*(cprElfHdr3 *)(void *)&elfout = h3;
elfout.ehdr.e_phnum = 1;
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
}
@@ -124,18 +124,18 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
#undef E
}
void PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
int PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
{
if (opt->o_unix.make_ptinterp) {
return; // ignore current input file!
return 1; // ignore current input file!
}
super::pack2(fo, ft);
return super::pack2(fo, ft);
}
#undef PAGE_MASK
#define PAGE_MASK (~0u<<12)
void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
off_t PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
{
unsigned base = getbase(phdri, ehdri.e_phnum);
unsigned sz = PAGE_MASK & (~PAGE_MASK + elfout.phdr[0].p_filesz);
@@ -191,21 +191,25 @@ void PackLinuxElf32x86interp::pack3(OutputFile *fo, Filter &/*ft*/)
else {
updateLoader(fo);
}
return fo->getBytesWritten();
}
void PackLinuxElf32x86interp::unpack(OutputFile *fo)
{
#define MAX_INTERP_HDR 512
char bufehdr[MAX_INTERP_HDR];
Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)bufehdr;
Elf32_Phdr const *phdr = (Elf32_Phdr *)(1+ehdr);
union {
unsigned char buf[MAX_INTERP_HDR];
//struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e;
} u;
Elf32_Ehdr *const ehdr = (Elf32_Ehdr *) u.buf;
Elf32_Phdr const *phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr));
unsigned szb_info = sizeof(b_info);
{
fi->seek(0, SEEK_SET);
fi->readx(bufehdr, MAX_INTERP_HDR);
unsigned const e_entry = get_native32(&ehdr->e_entry);
fi->readx(u.buf, MAX_INTERP_HDR);
unsigned const e_entry = get_te32(&ehdr->e_entry);
if (e_entry < 0x401180) { /* old style, 8-byte b_info */
szb_info = 2*sizeof(unsigned);
}
@@ -214,16 +218,16 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
fi->seek(overlay_offset, SEEK_SET);
p_info hbuf;
fi->readx(&hbuf, sizeof(hbuf));
unsigned orig_file_size = get_native32(&hbuf.p_filesize);
blocksize = get_native32(&hbuf.p_blocksize);
unsigned orig_file_size = get_te32(&hbuf.p_filesize);
blocksize = get_te32(&hbuf.p_blocksize);
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
throwCantUnpack("file header corrupted");
ibuf.alloc(blocksize + OVERHEAD);
b_info bhdr; memset(&bhdr, 0, sizeof(bhdr));
fi->readx(&bhdr, szb_info);
ph.u_len = get_native32(&bhdr.sz_unc);
ph.c_len = get_native32(&bhdr.sz_cpr);
ph.u_len = get_te32(&bhdr.sz_unc);
ph.c_len = get_te32(&bhdr.sz_cpr);
ph.filter_cto = bhdr.b_cto8;
// Uncompress Ehdr and Phdrs.
@@ -277,7 +281,7 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
// check for end-of-file
fi->readx(&bhdr, szb_info);
unsigned const sz_unc = ph.u_len = get_native32(&bhdr.sz_unc);
unsigned const sz_unc = ph.u_len = get_te32(&bhdr.sz_unc);
if (sz_unc == 0) { // uncompressed size 0 -> EOF
// note: magic is always stored le32
@@ -303,8 +307,4 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
#undef MAX_INTERP_HDR
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+8 -12
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -31,7 +31,7 @@
#ifndef __UPX_P_LX_INTERP_H //{
#define __UPX_P_LX_INTERP_H
#define __UPX_P_LX_INTERP_H 1
/*************************************************************************
@@ -54,15 +54,11 @@ public:
protected:
virtual void pack1(OutputFile *, Filter &); // generate executable header
virtual void pack2(OutputFile *, Filter &); // append compressed data
virtual void pack3(OutputFile *, Filter &); // build loader
virtual int pack2(OutputFile *, Filter &); // append compressed data
virtual off_t pack3(OutputFile *, Filter &); // build loader
};
#endif /*} already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+8 -12
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -91,7 +91,7 @@ PackLinuxI386sh::buildLoader(Filter const *ft)
// filter
optimizeFilter(&fold_ft, buf, sz_fold);
unsigned fold_hdrlen = sizeof(l_info) + sizeof(Elf32_Ehdr) +
sizeof(Elf32_Phdr) * get_native32(&((Elf32_Ehdr const *)(void *)buf)->e_phnum);
sizeof(Elf32_Phdr) * get_te32(&((Elf32_Ehdr const *)(void *)buf)->e_phnum);
if (0 == get_le32(fold_hdrlen + buf)) {
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
fold_hdrlen = umax(0x80, fold_hdrlen);
@@ -161,14 +161,10 @@ PackLinuxI386sh::pack1(OutputFile *fo, Filter &)
generateElfHdr(fo, stub_i386_linux_elf_shell_fold, 0x08048000);
}
void
off_t
PackLinuxI386sh::pack3(OutputFile *fo, Filter &ft)
{
super::pack3(fo,ft);
elfout.phdr[0].p_filesz = fo->getBytesWritten();
return elfout.phdr[0].p_filesz = super::pack3(fo,ft);
}
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+8 -12
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2000-2007 John F. Reiser
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2000-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
@@ -31,7 +31,7 @@
#ifndef __UPX_P_LX_SH_H //{
#define __UPX_P_LX_SH_H
#define __UPX_P_LX_SH_H 1
/*************************************************************************
@@ -46,13 +46,13 @@ public:
virtual ~PackLinuxI386sh();
virtual int getVersion() const { return 13; }
virtual int getFormat() const { return UPX_F_LINUX_SH_i386; }
virtual const char *getName() const { return "linux/sh386"; }
virtual const char *getName() const { return "linux.sh/i386"; }
virtual const char *getFullName(const options_t *) const { return "i386-linux.elf.shell"; }
virtual const int *getFilters() const { return NULL; }
virtual void buildLoader(const Filter *);
virtual void pack1(OutputFile *fo, Filter &ft);
virtual void pack3(OutputFile *fo, Filter &ft);
virtual off_t pack3(OutputFile *fo, Filter &ft);
virtual bool canPack();
// virtual void unpack(OutputFile *fo) { super::unpack(fo); }
@@ -71,8 +71,4 @@ protected:
#endif /*} already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+1830 -218
View File
File diff suppressed because it is too large Load Diff
+902 -155
View File
File diff suppressed because it is too large Load Diff
+79 -19
View File
@@ -2,7 +2,7 @@
This file is part of the UPX executable compressor.
Copyright (C) 2007 John F. Reiser
Copyright (C) 2007-2018 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -35,31 +35,82 @@
#ifdef WANT_MACH_HEADER_ENUM /*{*/
#undef WANT_MACH_HEADER_ENUM
# if 0
enum { // magic
MH_MAGIC = 0xfeedface
};
# else
static const unsigned MH_MAGIC = 0xfeedface;
# endif
enum { // cputype
CPU_TYPE_I386 = 7,
CPU_TYPE_X86_64 = 0x01000007,
CPU_TYPE_ARM = 0x0000000c,
CPU_TYPE_ARM64 = 0x0100000c,
CPU_TYPE_POWERPC = 0x00000012,
CPU_TYPE_POWERPC64 = 0x01000012
CPU_TYPE_POWERPC64 = 0x01000012,
CPU_TYPE_POWERPC64LE = 0x01000021
};
enum { // cpusubtype
CPU_SUBTYPE_ARM_ALL = 0,
CPU_SUBTYPE_ARM_V4T = 5,
CPU_SUBTYPE_ARM_V6 = 6
};
enum { // filetype
MH_EXECUTE = 2
MH_EXECUTE = 2,
MH_PRELOAD = 5, /* preloaded executable */
MH_DYLIB = 6, /* dynamically bound shared library */
MH_DYLINKER= 7, /* /usr/bin/dyld */
MH_BUNDLE = 8 /* dynamically bound bundle file */
};
enum { // flags
MH_NOUNDEFS = 1
MH_NOUNDEFS = 1,
MH_DYLDLINK = 4, /* code signing demands this */
MH_BINDATLOAD = 0x8, // DT_BIND_NOW
MH_TWOLEVEL = 0x80,
MH_PIE = 0x200000 // ASLR
};
#endif /*}*/
#ifdef WANT_MACH_SEGMENT_ENUM /*{*/
#undef WANT_MACH_SEGMENT_ENUM
enum { // cmd
LC_REQ_DYLD = 0x80000000, // OR'ed ==> must not ignore
LC_SEGMENT = 0x1,
LC_SYMTAB = 0x2,
LC_THREAD = 0x4,
LC_UNIXTHREAD = 0x5,
LC_DYSYMTAB = 0xb,
LC_LOAD_DYLIB = 0xc,
LC_ID_DYLIB = 0xd,
LC_LOAD_DYLINKER = 0xe,
LC_SEGMENT_64 = 0x19
LC_ROUTINES = 0x11,
LC_TWOLEVEL_HINTS= 0x16,
LC_LOAD_WEAK_DYLIB= (0x18 | LC_REQ_DYLD),
LC_SEGMENT_64 = 0x19,
LC_ROUTINES_64 = 0x1a,
LC_UUID = 0x1b,
LC_RPATH = 0x1c,
LC_CODE_SIGNATURE = 0x1d,
LC_SEGMENT_SPLIT_INFO = 0x1e,
LC_REEXPORT_DYLIB = (0x1f | LC_REQ_DYLD),
LC_LAZY_LOAD_DYLIB= 0x20,
LC_ENCRYPTION_INFO= 0x21,
LC_DYLD_INFO = 0x22, // compressed dyld information (10.6.x)
LC_DYLD_INFO_ONLY = (0x22|LC_REQ_DYLD),
LC_VERSION_MIN_MACOSX= 0x24,
LC_VERSION_MIN_IPHONEOS= 0x25,
LC_FUNCTION_STARTS= 0x26,
LC_DYLD_ENVIRONMENT= 0x27, // string as environment variable
LC_MAIN = (0x28|LC_REQ_DYLD),
LC_DATA_IN_CODE = 0x29,
LC_SOURCE_VERSION = 0x2a,
LC_DYLIB_CODE_SIGN_DRS= 0x2B,
LC_ENCRYPTION_INFO_64= 0x2C,
LC_VERSION_MIN_TVOS= 0x2F,
LC_VERSION_MIN_WATCHOS= 0x30,
};
enum { // maxprot
VM_PROT_READ = 1,
VM_PROT_WRITE = 2,
@@ -69,24 +120,33 @@
#ifdef WANT_MACH_SECTION_ENUM /*{*/
#undef WANT_MACH_SECTION_ENUM
enum { // section flags
enum { // section type (low byte only)
S_REGULAR = 0,
S_ZEROFILL,
S_CSTRING_LITERALS,
S_4BYTE_LITERALS,
S_8BYTE_LITERALS,
S_LITERAL_POINTERS,
S_NON_LAZY_SYMBOL_POINTERS,
S_LAZY_SYMBOL_POINTERS,
S_NON_LAZY_SYMBOL_POINTERS, // sectname __nl_symbol_ptr
S_LAZY_SYMBOL_POINTERS, // sectname __la_symbol_ptr
S_SYMBOL_STUBS,
S_MOD_INIT_FUNC_POINTERS,
S_MOD_TERM_FNC_POINTERS,
S_COALESCED
S_MOD_INIT_FUNC_POINTERS, // sectname __mod_init_func
S_MOD_TERM_FUNC_POINTERS,
S_COALESCED,
S_GB_ZEROFILL,
S_INTERPOSING,
S_16BYTE_LITERALS,
S_DTRACE_DOF
};
enum {
S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
static const unsigned S_ATTR_PURE_INSTRUCTIONS = 0x80000000;
enum { // section flags (high 24 bits)
//S_ATTR_PURE_INSTRUCTIONS = 0x80000000,
S_ATTR_NO_TOC = 0x40000000,
S_ATTR_STRIP_STATIC_SYMS = 0x20000000,
S_ATTR_NO_DEAD_STRIP = 0x10000000,
S_ATTR_LIVE_SUPPORT = 0x08000000,
S_ATTR_SELF_MODIFYING_CODE = 0x04000000,
S_ATTR_DEBUG = 0x02000000,
S_ATTR_SOME_INSTRUCTIONS = 0x00000400,
S_ATTR_EXT_RELOC = 0x00000200,
S_ATTR_LOC_RELOC = 0x00000100
@@ -97,12 +157,12 @@
#undef WANT_MACH_THREAD_ENUM
enum { // thread flavor
PPC_THREAD_STATE = 1,
i386_THREAD_STATE = 1,
i386_OLD_THREAD_STATE = -1
PPC_THREAD_STATE64 = 5,
x86_THREAD_STATE32 = 1,
x86_THREAD_STATE64 = 4,
i386_OLD_THREAD_STATE = -1,
ARM_THREAD_STATE = 1
};
#endif /*}*/
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */
+44 -30
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2002-2007 Jens Medoch
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2002-2018 Jens Medoch
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
Jens Medoch
<jssg@users.sourceforge.net>
@@ -95,7 +95,7 @@ PackPs1::PackPs1(InputFile *f) :
COMPILE_TIME_ASSERT(SZ_IH_BKUP == 40)
fdata_size = file_size - PS_HDR_SIZE;
ram_size = !opt->ps1_exe.do_8mb ? 0x200000 : 0x800000;
ram_size = !opt->ps1_exe.do_8mib ? 0x200000 : 0x800000;
}
const int *PackPs1::getCompressionMethods(int method, int level) const
@@ -127,8 +127,8 @@ int PackPs1::readFileHeader()
{
fi->seek(0, SEEK_SET);
fi->readx(&ih, sizeof(ih));
if (memcmp(&ih.id, "PS-X EXE", 8) != 0 &&
memcmp(&ih.id, "EXE X-SP", 8) != 0)
if (memcmp(&ih.id[0], "PS-X EXE", 8) != 0 &&
memcmp(&ih.id[0], "EXE X-SP", 8) != 0)
return 0;
if (ih.text != 0 || ih.data != 0)
return 0;
@@ -160,7 +160,7 @@ void PackPs1::putBkupHeader(const unsigned char *src, unsigned char *dst, unsign
if (src && dst)
{
unsigned char *cpr_bh = new unsigned char[sz_cbh];
unsigned char *cpr_bh = New(unsigned char, sz_cbh);
memset(cpr_bh, 0, sizeof(bh));
ps1_exe_chb_t * p = (ps1_exe_chb_t * )cpr_bh;
@@ -189,11 +189,13 @@ bool PackPs1::getBkupHeader(unsigned char *p, unsigned char *dst)
if (src && (src->id == '1' && src->len < SZ_IH_BKUP) && dst)
{
unsigned char *unc_bh = new unsigned char[MemBuffer::getSizeForUncompression(SZ_IH_BKUP)];
unsigned char *unc_bh = New(unsigned char, MemBuffer::getSizeForUncompression(SZ_IH_BKUP));
unsigned sz_bh = SZ_IH_BKUP;
int r = upx_decompress((const unsigned char *)&src->ih_bkup, src->len,
unc_bh, &sz_bh, M_NRV2E_8, NULL );
if (r == UPX_E_OUT_OF_MEMORY)
throwOutOfMemoryException();
if (r != UPX_E_OK || sz_bh != SZ_IH_BKUP)
throwInternalError("header decompression failed");
unsigned ad = upx_adler32(unc_bh, SZ_IH_BKUP);
@@ -254,8 +256,9 @@ bool PackPs1::canPack()
fi->readx(buf, sizeof(buf));
checkAlreadyPacked(buf, sizeof(buf));
for (unsigned i = 0; i < sizeof(buf); i++)
for (size_t i = 0; i < sizeof(buf); i++)
if (buf[i] != 0)
{
if (!opt->force)
throwCantPack("unknown data in header (try --force)");
else
@@ -265,6 +268,7 @@ bool PackPs1::canPack()
opt->backup = 1;
break;
}
}
if (!checkFileHeader())
throwCantPack("unsupported header flags (try --force)");
if (!opt->force && file_size < PS_MIN_SIZE)
@@ -318,6 +322,7 @@ void PackPs1::buildLoader(const Filter *)
sa_tmp += overlap = ALIGN_UP((ph.overlap_overhead - sa_tmp), 4u);
}
if (isCon || M_IS_LZMA(ph.method))
foundBss = findBssSection();
if (M_IS_LZMA(ph.method) && !buildPart2)
@@ -333,7 +338,7 @@ void PackPs1::buildLoader(const Filter *)
if (M_IS_LZMA(ph.method) && buildPart2)
{
sz_lcpr = MemBuffer::getSizeForCompression(sz_lunc);
unsigned char *cprLoader = new unsigned char[sz_lcpr];
unsigned char *cprLoader = New(unsigned char, sz_lcpr);
int r = upx_compress(getLoader(), sz_lunc, cprLoader, &sz_lcpr,
NULL, M_NRV2B_8, 10, NULL, NULL );
if (r != UPX_E_OK || sz_lcpr >= sz_lunc)
@@ -370,16 +375,20 @@ void PackPs1::buildLoader(const Filter *)
else
{
if (M_IS_LZMA(ph.method))
addLoader("cdb.start.lzma", "pad.code", "cdb.entry.lzma", method, "cdb.lzma.cpr",
addLoader(!foundBss ? "cdb.start.lzma" : "bss.cdb.start.lzma", "pad.code",
!foundBss ? "cdb.entry.lzma" : "bss.cdb.entry.lzma",
method, "cdb.lzma.cpr",
ih.tx_ptr & 0xffff ? "dec.ptr" : "dec.ptr.hi",
"lzma.exec", NULL);
else
{
assert(foundBss != true);
addLoader("cdb.start", "pad.code", "cdb.entry",
ih.tx_ptr & 0xffff ? "cdb.dec.ptr" : "cdb.dec.ptr.hi",
method,
sa_cnt ? sa_cnt > (0x10000 << 2) ? "memset.long" : "memset.short" : "",
!foundBss ? "cdb.exit" : "bss.exit",
"pad.code", NULL);
"cdb.exit", NULL);
}
}
addLoader("UPX1HEAD", "IDENTSTR", NULL);
}
@@ -409,7 +418,7 @@ void PackPs1::buildLoader(const Filter *)
bool PackPs1::findBssSection()
{
unsigned char reg;
LE32 *p1 = (LE32 *)(ibuf + (ih.epc - ih.tx_ptr));
const LE32 * const p1 = ACC_CCAST(const LE32 *, ibuf + (ih.epc - ih.tx_ptr));
if ((ih.epc - ih.tx_ptr + (BSS_CHK_LIMIT * 4)) > fdata_size)
return false;
@@ -417,15 +426,15 @@ bool PackPs1::findBssSection()
// check 18 opcodes for sw zero,0(x)
for (signed i = BSS_CHK_LIMIT; i >= 0; i--)
{
unsigned short op = p1[i] >> 16;
upx_uint16_t op = p1[i] >> 16;
if (IS_SW_ZERO(op))
{
// found! get reg (x) for bss_start
reg = REG1(op);
for (; i >= 0; i--)
{
bss_nfo *p = (bss_nfo *)&p1[i];
unsigned short op1 = p->op1, op2 = p->op2;
const bss_nfo * const p = ACC_CCAST(const bss_nfo *, &p1[i]);
upx_uint16_t op1 = p->op1, op2 = p->op2;
// check for la (x),bss_start
if ((IS_LUI(op1) && REG2(op1) == reg) &&
@@ -491,7 +500,7 @@ void PackPs1::pack(OutputFile *fo)
// compress (max_match = 65535)
upx_compress_config_t cconf; cconf.reset();
cconf.conf_ucl.max_match = 65535;
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28KB stack
cconf.conf_lzma.max_num_probs = 1846 + (768 << 4); // ushort: ~28 KiB stack
compressWithFilters(&ft, sa_cnt, &cconf);
if (overlap)
@@ -538,7 +547,7 @@ void PackPs1::pack(OutputFile *fo)
const int lsize = getLoaderSize();
unsigned filelen = ALIGN_UP(ih.tx_len, 4);
unsigned filelen = ALIGN_UP(ih.tx_len, 4u);
const unsigned decomp_data_start = ih.tx_ptr;
const unsigned comp_data_start = (decomp_data_start + filelen + overlap) - ph.c_len;
@@ -554,7 +563,9 @@ void PackPs1::pack(OutputFile *fo)
}
else
{
d_len = (lsize - h_len) - getLoaderSectionStart(M_IS_LZMA(ph.method) ? "cdb.entry.lzma" : "cdb.entry");
const char* entry_lzma = !foundBss ? "cdb.entry.lzma" : "bss.cdb.entry.lzma";
d_len = (lsize - h_len) - getLoaderSectionStart(M_IS_LZMA(ph.method) ? entry_lzma : "cdb.entry");
e_len = (lsize - d_len) - h_len;
}
@@ -565,11 +576,13 @@ void PackPs1::pack(OutputFile *fo)
linker->defineSymbol("ldr_sz", M_IS_LZMA(ph.method) ? sz_lunc + 16 : (d_len-pad_code));
if (foundBss)
{
if (M_IS_LZMA(ph.method))
linker->defineSymbol("wrkmem", bss_end - 160 - getDecompressorWrkmemSize()
- (sz_lunc + 16));
else
linker->defineSymbol("wrkmem", bss_end - 16 - (d_len - pad_code));
}
const unsigned entry = comp_data_start - e_len;
@@ -578,10 +591,10 @@ void PackPs1::pack(OutputFile *fo)
unsigned pad = 0;
if (!opt->ps1_exe.no_align)
if (!opt->ps1_exe.no_align || !isCon)
{
pad = oh.tx_len;
oh.tx_len = ALIGN_UP(oh.tx_len, CD_SEC);
oh.tx_len = ALIGN_UP(oh.tx_len, CD_SEC+0u);
pad = oh.tx_len - pad;
oh.tx_ptr -= pad;
}
@@ -611,8 +624,12 @@ void PackPs1::pack(OutputFile *fo)
linker->defineSymbol("PSVR", FIX_PSVR);
linker->defineSymbol("CPDO", comp_data_start);
if (M_IS_LZMA(ph.method))
linker->defineSymbol("lzma_cpr", getLoaderSectionStart("lzma.exec")
- getLoaderSectionStart("cdb.entry.lzma"));
{
unsigned entry_lzma = getLoaderSectionStart( !foundBss ? "cdb.entry.lzma" :
"bss.cdb.entry.lzma");
linker->defineSymbol("lzma_cpr", getLoaderSectionStart("lzma.exec") - entry_lzma);
}
}
relocateLoader();
@@ -692,7 +709,7 @@ void PackPs1::unpack(OutputFile *fo)
{
// restore orig exec hdr
memcpy(&oh, &ih, sizeof(ih));
memcpy(&oh.epc, &bh, SZ_IH_BKUP);
memcpy((void *) &oh.epc, &bh, SZ_IH_BKUP);
// check for removed sector alignment
assert(oh.tx_len >= ph.u_len);
@@ -721,7 +738,4 @@ void PackPs1::unpack(OutputFile *fo)
}
}
/*
vi:ts=4:et:nowrap
*/
/* vim:set ts=4 sw=4 et: */
+14 -25
View File
@@ -2,9 +2,9 @@
This file is part of the UPX executable compressor.
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2007 Laszlo Molnar
Copyright (C) 2002-2007 Jens Medoch
Copyright (C) 1996-2018 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2018 Laszlo Molnar
Copyright (C) 2002-2018 Jens Medoch
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
@@ -23,7 +23,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
<markus@oberhumer.com> <ezerotven+github@gmail.com>
Jens Medoch
<jssg@users.sourceforge.net>
@@ -31,7 +31,7 @@
#ifndef __UPX_P_PS1_H
#define __UPX_P_PS1_H
#define __UPX_P_PS1_H 1
/*************************************************************************
@@ -67,8 +67,7 @@ protected:
virtual int readFileHeader();
virtual bool checkFileHeader();
struct ps1_exe_t
{
__packed_struct(ps1_exe_t)
// ident string
char id[8];
// is NULL
@@ -91,33 +90,26 @@ protected:
char origin[60];
// backup of the original header (epc - is_len)
// id & the upx header ...
}
__attribute_packed;
__packed_struct_end()
// for unpack
struct ps1_exe_hb_t
{
__packed_struct(ps1_exe_hb_t)
LE32 ih_bkup[10];
// plus checksum for the backup
LE32 ih_csum;
}
__attribute_packed;
__packed_struct_end()
struct ps1_exe_chb_t
{
__packed_struct(ps1_exe_chb_t)
unsigned char id;
unsigned char len;
LE16 ih_csum;
unsigned char ih_bkup;
}
__attribute_packed;
__packed_struct_end()
struct bss_nfo
{
__packed_struct(bss_nfo)
LE16 hi1, op1, lo1, op2;
LE16 hi2, op3, lo2, op4;
}
__attribute_packed;
__packed_struct_end()
ps1_exe_t ih, oh;
ps1_exe_hb_t bh;
@@ -138,7 +130,4 @@ protected:
#endif /* already included */
/*
vi:ts=4:et
*/
/* vim:set ts=4 sw=4 et: */

Some files were not shown because too many files have changed in this diff Show More