Compare commits
147 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1e38bbfbc1 | |||
| 1c62e95812 | |||
| d453cc27a3 | |||
| 2c3e841d8a | |||
| 50668c462f | |||
| 8d1192e832 | |||
| 4a8e2e9ed4 | |||
| 12fc45220a | |||
| 6bce68fbe7 | |||
| d54f947c98 | |||
| 6c8bb3a22e | |||
| ed29ce5183 | |||
| a51d269b7c | |||
| 8283e4e6d6 | |||
| 23ce91eb55 | |||
| 545ac7fcfa | |||
| 3926ccccad | |||
| f431307ef2 | |||
| ca368e0f9b | |||
| 8afeb56c11 | |||
| 2a6f90c5f3 | |||
| 271031128e | |||
| b991f954d0 | |||
| f12bb3f80d | |||
| 6dc978e8d8 | |||
| 9f05a873bc | |||
| 703d498772 | |||
| ed3b9543bb | |||
| fc7efba7d8 | |||
| b3178fe8f4 | |||
| e36798a993 | |||
| a143605465 | |||
| d3ad35b21e | |||
| 68134941bf | |||
| 54d0fef559 | |||
| 7f9c47176a | |||
| 9060ac7897 | |||
| d9073e4a17 | |||
| de1c1d7cc2 | |||
| 6ff1bd5917 | |||
| a6b04f426e | |||
| fa49dbe2cb | |||
| 682eb04a52 | |||
| 77064fb09e | |||
| be8d93563a | |||
| d4a6a5216d | |||
| 1cb1427050 | |||
| e4f4eace1c | |||
| 30a98b7e8c | |||
| d36c8d95ad | |||
| 506bd0abcf | |||
| 8dd810c41d | |||
| d9d0dc5201 | |||
| 72880d9e03 | |||
| 6c7ec6eb1b | |||
| 705fc5d116 | |||
| d20b575b9b | |||
| c949beab9c | |||
| 3fb857c435 | |||
| 0a4f999ade | |||
| f0b7147881 | |||
| b36a42cd0a | |||
| 000309b47f | |||
| 5cb12988f0 | |||
| 50c4b749ec | |||
| 5db2734e6f | |||
| e9e5507483 | |||
| d63dc7adfb | |||
| 27db44a8db | |||
| 1a035e2866 | |||
| 887aa20116 | |||
| 5e03d86695 | |||
| 95075aa28e | |||
| 0260f0790a | |||
| 34d65ba292 | |||
| 27a77a15ed | |||
| 76025bfae1 | |||
| 4957faf482 | |||
| 0d8e16d5c8 | |||
| 07baed1581 | |||
| eab5da075a | |||
| 0d1bbb19ce | |||
| 58d6cbc6ac | |||
| 4d3b627839 | |||
| 49455c99ad | |||
| 31bb6bedbd | |||
| 8d54678ea1 | |||
| 590767c299 | |||
| ec1bd342b8 | |||
| b031c9e7f6 | |||
| ea0dfe83b7 | |||
| bdd90f2c57 | |||
| 288dac5d70 | |||
| 9d22e1c35e | |||
| ace2359e7b | |||
| 617e6510a5 | |||
| 26024770b8 | |||
| d556f58e34 | |||
| b6f302dfc0 | |||
| 8e9b5f14af | |||
| 3635c00143 | |||
| abc71baaa6 | |||
| 959aaebede | |||
| d17f8c5049 | |||
| 42a7201a70 | |||
| 1f1744a49a | |||
| fd7dbe5bd9 | |||
| 984549400d | |||
| cf0c49277e | |||
| 16c3f9fa9c | |||
| 2f2539cf34 | |||
| e66823d017 | |||
| 881c32a3df | |||
| ea0a361c35 | |||
| dc60f8bb7b | |||
| 9e92c9ea12 | |||
| a503a54240 | |||
| 265957712a | |||
| c26962bb71 | |||
| a428eddf93 | |||
| dc4f7eb2f9 | |||
| d54ac1ba91 | |||
| a3d46b18ac | |||
| e81dd05666 | |||
| 29394935e3 | |||
| df8acc4ed7 | |||
| 81928d4ab1 | |||
| 3ebf93e03d | |||
| 59e4032f1f | |||
| 8f15777427 | |||
| 748c4bf780 | |||
| befcf6d2b3 | |||
| 48236ecd3c | |||
| f340f84de7 | |||
| 40e19293f9 | |||
| f252f824a4 | |||
| 1d7e5a8130 | |||
| cb2ff92c2f | |||
| ef373ab54f | |||
| 9141a78c29 | |||
| 10a6370738 | |||
| 573009eeb6 | |||
| c3363712d9 | |||
| faa33d89a2 | |||
| f347458c53 | |||
| 530e6d9196 | |||
| b398e18e12 |
@@ -1,8 +1,10 @@
|
|||||||
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
|
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
|
||||||
|
1931f4f28074970ec53b4cd21c7fc181b4da8e5e RELEASE_301
|
||||||
223ac5b23f9731ceac9ff8d65167df4900776e36 RELEASE_190
|
223ac5b23f9731ceac9ff8d65167df4900776e36 RELEASE_190
|
||||||
2c753c5bf38e7322715e2a5c6c5381111bd7a61a RELEASE_194
|
2c753c5bf38e7322715e2a5c6c5381111bd7a61a RELEASE_194
|
||||||
2ee65b77f9117651e2e5517b2edede23698d73ca RELEASE_196
|
2ee65b77f9117651e2e5517b2edede23698d73ca RELEASE_196
|
||||||
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
|
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
|
||||||
|
46f3a6cca02603000fadc16637b02e30caddd909 RELEASE_302
|
||||||
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
|
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
|
||||||
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
|
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
|
||||||
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
|
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
|
||||||
@@ -13,4 +15,5 @@ c2e0cd4d621b047f254f2def42132a03683ff52c RELEASE_192
|
|||||||
d276aa09033c24d0981bc3f4fee5628aecc988ad RELEASE_290
|
d276aa09033c24d0981bc3f4fee5628aecc988ad RELEASE_290
|
||||||
eb1ce56dce7dd1835964362470610925963b9043 RELEASE_110
|
eb1ce56dce7dd1835964362470610925963b9043 RELEASE_110
|
||||||
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
|
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
|
||||||
|
ef9c7f2c9658d73a9b5ab2ed291483d2bbcd8bc7 RELEASE_300
|
||||||
efa52753e366300c0e0ebe20631adcb24ed3c15b RELEASE_293
|
efa52753e366300c0e0ebe20631adcb24ed3c15b RELEASE_293
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ dos/exe
|
|||||||
watcom/le
|
watcom/le
|
||||||
---------
|
---------
|
||||||
* 16-bit selector alias fixups
|
* 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
|
* 16:16 fixups
|
||||||
|
|
||||||
If you need any of the above (they're very rare), send us an URL of a
|
If you need any of the above (they're very rare), send us an URL of a
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ endif
|
|||||||
$(MAKE) -C doc $@
|
$(MAKE) -C doc $@
|
||||||
|
|
||||||
|
|
||||||
ifneq ($(wildcard .hg/data/.),)
|
ifneq ($(wildcard .hg/.),)
|
||||||
# automatically generate ChangeLog from local Mercurial repo
|
# automatically generate ChangeLog from local Mercurial repo
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
hg log --style=changelog > $@
|
hg log --style=changelog > $@
|
||||||
|
|||||||
@@ -2,6 +2,26 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
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):
|
Changes in 3.00 (27 Apr 2007):
|
||||||
* watcom/le & tmt/adam: fixed a problem when using certain filters
|
* watcom/le & tmt/adam: fixed a problem when using certain filters
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ THE FUTURE
|
|||||||
COPYRIGHT
|
COPYRIGHT
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
@@ -129,7 +129,7 @@ Markus & Laszlo
|
|||||||
|
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-9
@@ -8,18 +8,10 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
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.
|
|
||||||
|
|
||||||
|
|
||||||
MAJOR NEWS IN UPX 3
|
MAJOR NEWS IN UPX 3
|
||||||
===================
|
===================
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -69,7 +69,7 @@ Tools needed to build/modify the UPX sources
|
|||||||
- A C++ compiler supporting inner classes, templates, exceptions
|
- A C++ compiler supporting inner classes, templates, exceptions
|
||||||
and RTTI.
|
and RTTI.
|
||||||
|
|
||||||
- GNU make 3.80 or better (GNU make 3.81 recommened).
|
- GNU make 3.81 or better
|
||||||
|
|
||||||
|
|
||||||
To compile the packer sources
|
To compile the packer sources
|
||||||
@@ -94,9 +94,6 @@ To compile the packer sources
|
|||||||
If you want to modify the stub sources you'll also need
|
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
|
- Perl & Python
|
||||||
|
|
||||||
- A number of cross-assemblers and cross-compilers - precompiled
|
- A number of cross-assemblers and cross-compilers - precompiled
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
Decompressing ELF Directly to Memory on Linux/x86
|
Decompressing ELF Directly to Memory on Linux/x86
|
||||||
Copyright (C) 2000-2007 John F. Reiser jreiser@BitWagon.com
|
Copyright (C) 2000-2008 John F. Reiser jreiser@BitWagon.com
|
||||||
|
|
||||||
References:
|
References:
|
||||||
<elf.h> definitions for the ELF file format
|
<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
|
The address 0x00400000 was chosen to be out of the way of the usual
|
||||||
load address 0x08048000, and to minimize fragmentation in kernel
|
load address 0x08048000, and to minimize fragmentation in kernel
|
||||||
page tables; one page of page tables covers 4MB. The address
|
page tables; one page of page tables covers 4 MiB. The address
|
||||||
0x00401000 was chosen as 1 page up from a 64KB boundary, to
|
0x00401000 was chosen as 1 page up from a 64 KiB boundary, to
|
||||||
make the startup code and its constants smaller.
|
make the startup code and its constants smaller.
|
||||||
|
|
||||||
Decompression of the executable begins by decompressing the Elf32_Ehdr
|
Decompression of the executable begins by decompressing the Elf32_Ehdr
|
||||||
|
|||||||
+2
-2
@@ -108,14 +108,14 @@ then skip another one - the unfiltering process needs some information
|
|||||||
to be able to reverse the filtering.
|
to be able to reverse the filtering.
|
||||||
|
|
||||||
UPX uses the following idea, which works nicely. First we assume that
|
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
|
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
|
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
|
were not found following 0xE8. These bytes are our candidates to be
|
||||||
used as markers.
|
used as markers.
|
||||||
|
|
||||||
Do you still remember that we assumed that the size of scanned area is
|
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
|
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
|
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
|
reverse the byte order in the resulting offset - so this marker will
|
||||||
|
|||||||
+19
-15
@@ -13,7 +13,7 @@ B<upx> S<[ I<command> ]> S<[ I<options> ]> I<filename>...
|
|||||||
=head1 ABSTRACT
|
=head1 ABSTRACT
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2007 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2008 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -51,8 +51,8 @@ B<UPX> is a versatile executable packer with the following features:
|
|||||||
- excellent compression ratio: compresses better than zip/gzip,
|
- excellent compression ratio: compresses better than zip/gzip,
|
||||||
use UPX to decrease the size of your distribution !
|
use UPX to decrease the size of your distribution !
|
||||||
|
|
||||||
- very fast decompression: about 10 MB/sec on an ancient Pentium 133,
|
- very fast decompression: about 10 MiB/sec on an ancient Pentium 133,
|
||||||
about 200 MB/sec on an Athlon XP 2000+.
|
about 200 MiB/sec on an Athlon XP 2000+.
|
||||||
|
|
||||||
- no memory overhead for your compressed executables for most of the
|
- no memory overhead for your compressed executables for most of the
|
||||||
supported formats
|
supported formats
|
||||||
@@ -139,7 +139,11 @@ B<--help>: prints the help
|
|||||||
B<--version>: print the version of B<UPX>
|
B<--version>: print the version of B<UPX>
|
||||||
|
|
||||||
B<--exact>: when compressing, require to be able to get a byte-identical file
|
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 ]
|
[ ...to be written... - type `B<upx --help>' for now ]
|
||||||
|
|
||||||
@@ -149,7 +153,7 @@ after decompression with option B<-d>
|
|||||||
|
|
||||||
B<UPX> offers ten different compression levels from B<-1> to B<-9>,
|
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
|
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
|
=over 4
|
||||||
|
|
||||||
@@ -345,7 +349,7 @@ Extra options available for this executable format:
|
|||||||
First of all, it is recommended to use B<UPX> *instead* of B<strip>. strip has
|
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.
|
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
|
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
|
B<UPX> includes the full functionality of stubify. This means it will
|
||||||
automatically stubify your COFF files. Use the option B<--coff> to
|
automatically stubify your COFF files. Use the option B<--coff> to
|
||||||
@@ -656,8 +660,8 @@ Specific drawbacks:
|
|||||||
|
|
||||||
- Because of temporary decompression to disk the decompression speed
|
- Because of temporary decompression to disk the decompression speed
|
||||||
is not as fast as with the other executable formats. Still, I can see
|
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
|
no noticeable delay when starting programs like my ~3 MiB emacs (which
|
||||||
is less than 1 MB when compressed :-).
|
is less than 1 MiB when compressed :-).
|
||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
|
|
||||||
@@ -677,7 +681,7 @@ nostalgic feelings of one of the authors.
|
|||||||
Packed programs will be byte-identical to the original after uncompression,
|
Packed programs will be byte-identical to the original after uncompression,
|
||||||
until further notice.
|
until further notice.
|
||||||
|
|
||||||
Maximum uncompressed size: ~1.89 / ~7.60 Mbytes.
|
Maximum uncompressed size: ~1.89 / ~7.60 MiB.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
|
|
||||||
@@ -704,7 +708,7 @@ Extra options available for this executable format:
|
|||||||
|
|
||||||
--8-bit Uses 8 bit size compression [default: 32 bit]
|
--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 !
|
--boot-only This format is for main exes and CD-Mastering only !
|
||||||
It may slightly improve the compression ratio,
|
It may slightly improve the compression ratio,
|
||||||
@@ -834,7 +838,7 @@ must end with ".scr" (as screensavers are handled slightly different
|
|||||||
than normal exe files).
|
than normal exe files).
|
||||||
|
|
||||||
UPX compressed PE files have some minor memory overhead (usually in the
|
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.
|
line switch during compression.
|
||||||
|
|
||||||
Extra options available for this executable format:
|
Extra options available for this executable format:
|
||||||
@@ -929,13 +933,13 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2007 Jens Medoch
|
Copyright (C) 2002-2008 Jens Medoch
|
||||||
|
|
||||||
This program may be used freely, and you are welcome to
|
This program may be used freely, and you are welcome to
|
||||||
redistribute it under certain conditions.
|
redistribute it under certain conditions.
|
||||||
|
|||||||
+9
-5
@@ -55,9 +55,10 @@ INCLUDES += -I$(UPX_UCLDIR)/include
|
|||||||
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
|
LIBS += $(addprefix -L,$(dir $(wildcard $(UPX_UCLDIR)/libucl$(libext) $(UPX_UCLDIR)/src/.libs/libucl$(libext))))
|
||||||
endif
|
endif
|
||||||
LIBS += -lucl -lz
|
LIBS += -lucl -lz
|
||||||
# you should set envvar UPX_LZMADIR to point to your unpacked lzma443.tar.bz2
|
# you should set envvar UPX_LZMADIR to point to your unpacked LZMA SDK
|
||||||
ifneq ($(wildcard $(UPX_LZMADIR)/C/7zip/.),)
|
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
||||||
DEFS += -DWITH_LZMA=1
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
|
DEFS += -DWITH_LZMA=$(UPX_LZMA_VERSION)
|
||||||
INCLUDES += -I$(UPX_LZMADIR)
|
INCLUDES += -I$(UPX_LZMADIR)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@@ -86,10 +87,13 @@ endif
|
|||||||
ifeq ($(USE_GNUC),1)
|
ifeq ($(USE_GNUC),1)
|
||||||
##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer
|
##compress_lzma$(objext) : CXXFLAGS += -O3 -fomit-frame-pointer
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-cast-qual
|
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-shadow
|
||||||
|
ifeq ($(UPX_LZMA_VERSION),0x443)
|
||||||
|
compress_lzma$(objext) : CXXFLAGS += -Wno-non-virtual-dtor
|
||||||
compress_lzma$(objext) : CXXFLAGS += -Wno-unused
|
compress_lzma$(objext) : CXXFLAGS += -Wno-unused
|
||||||
##compress_lzma$(objext) : CXXFLAGS += -Wno-error
|
endif
|
||||||
|
# needed for gcc-4.3:
|
||||||
|
compress_lzma$(objext) : CXXFLAGS += -Wno-error
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -591,7 +591,7 @@ int __acc_cdecl_qsort le64_compare_signed(const void *, const void *);
|
|||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Provide namespaces and classes to abtract endianness policies.
|
// Provide namespaces and classes to abstract endianness policies.
|
||||||
//
|
//
|
||||||
// CTP - Compile-Time Polymorphism (templates)
|
// CTP - Compile-Time Polymorphism (templates)
|
||||||
// RTP - Run-Time Polymorphism (virtual functions)
|
// RTP - Run-Time Polymorphism (virtual functions)
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+58
-25
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -102,9 +102,15 @@ int compress_lzma_dummy = 0;
|
|||||||
#undef _WIN32_WCE
|
#undef _WIN32_WCE
|
||||||
#undef COMPRESS_MF_MT
|
#undef COMPRESS_MF_MT
|
||||||
#undef _NO_EXCEPTIONS
|
#undef _NO_EXCEPTIONS
|
||||||
#include "C/Common/MyInitGuid.h"
|
#if (WITH_LZMA >= 0x449)
|
||||||
//#include "C/7zip/Compress/LZMA/LZMADecoder.h"
|
# define INITGUID 1
|
||||||
#include "C/7zip/Compress/LZMA/LZMAEncoder.h"
|
//# include "CPP/7zip/Compress/LZMA/LZMADecoder.h"
|
||||||
|
# include "CPP/7zip/Compress/LZMA/LZMAEncoder.h"
|
||||||
|
#else
|
||||||
|
# include "C/Common/MyInitGuid.h"
|
||||||
|
//# include "C/7zip/Compress/LZMA/LZMADecoder.h"
|
||||||
|
# include "C/7zip/Compress/LZMA/LZMAEncoder.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace MyLzma {
|
namespace MyLzma {
|
||||||
|
|
||||||
@@ -174,16 +180,29 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
|
|||||||
# pragma warning(disable: 424) // #424: extra ";" ignored
|
# pragma warning(disable: 424) // #424: extra ";" ignored
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "C/Common/Alloc.cpp"
|
#if (WITH_LZMA >= 0x449)
|
||||||
#include "C/Common/CRC.cpp"
|
# include "C/Alloc.c"
|
||||||
//#include "C/7zip/Common/InBuffer.cpp"
|
# include "C/7zCrc.c"
|
||||||
#include "C/7zip/Common/OutBuffer.cpp"
|
# include "C/Compress/Lz/MatchFinder.c"
|
||||||
#include "C/7zip/Common/StreamUtils.cpp"
|
//# include "CPP/7zip/Common/InBuffer.cpp"
|
||||||
#include "C/7zip/Compress/LZ/LZInWindow.cpp"
|
# include "CPP/7zip/Common/OutBuffer.cpp"
|
||||||
//#include "C/7zip/Compress/LZ/LZOutWindow.cpp"
|
# include "CPP/7zip/Common/StreamUtils.cpp"
|
||||||
//#include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
|
//# include "CPP/7zip/Compress/LZ/LZOutWindow.cpp"
|
||||||
#include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
//# include "CPP/7zip/Compress/LZMA/LZMADecoder.cpp"
|
||||||
#include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
# include "CPP/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
||||||
|
# include "CPP/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
||||||
|
#else
|
||||||
|
# include "C/Common/Alloc.cpp"
|
||||||
|
# include "C/Common/CRC.cpp"
|
||||||
|
//# include "C/7zip/Common/InBuffer.cpp"
|
||||||
|
# include "C/7zip/Common/OutBuffer.cpp"
|
||||||
|
# include "C/7zip/Common/StreamUtils.cpp"
|
||||||
|
# include "C/7zip/Compress/LZ/LZInWindow.cpp"
|
||||||
|
//# include "C/7zip/Compress/LZ/LZOutWindow.cpp"
|
||||||
|
//# include "C/7zip/Compress/LZMA/LZMADecoder.cpp"
|
||||||
|
# include "C/7zip/Compress/LZMA/LZMAEncoder.cpp"
|
||||||
|
# include "C/7zip/Compress/RangeCoder/RangeCoderBit.cpp"
|
||||||
|
#endif
|
||||||
#undef RC_NORMALIZE
|
#undef RC_NORMALIZE
|
||||||
|
|
||||||
|
|
||||||
@@ -224,7 +243,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
PROPVARIANT pr[8];
|
PROPVARIANT pr[8];
|
||||||
pr[0].vt = pr[1].vt = pr[2].vt = pr[3].vt = VT_UI4;
|
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[4].vt = pr[5].vt = pr[6].vt = VT_UI4;
|
||||||
pr[7].vt = VT_BSTR;
|
unsigned nprops = 7;
|
||||||
|
|
||||||
// setup defaults
|
// setup defaults
|
||||||
pr[0].uintVal = 2; // 0 .. 4
|
pr[0].uintVal = 2; // 0 .. 4
|
||||||
@@ -236,9 +255,11 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
pr[6].uintVal = 0;
|
pr[6].uintVal = 0;
|
||||||
#ifdef COMPRESS_MF_BT4
|
#ifdef COMPRESS_MF_BT4
|
||||||
static wchar_t matchfinder[] = L"BT4";
|
static wchar_t matchfinder[] = L"BT4";
|
||||||
#endif
|
|
||||||
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
assert(NCompress::NLZMA::FindMatchFinder(matchfinder) >= 0);
|
||||||
pr[7].bstrVal = matchfinder;
|
pr[nprops].vt = VT_BSTR;
|
||||||
|
pr[nprops].bstrVal = matchfinder;
|
||||||
|
nprops++;
|
||||||
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
pr[0].uintVal = lzma_compress_config_t::pos_bits_t::default_value_c;
|
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[1].uintVal = lzma_compress_config_t::lit_pos_bits_t::default_value_c;
|
||||||
@@ -255,7 +276,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
#if 0
|
#if 0
|
||||||
// DEBUG - set sizes so that we use a maxmimum amount of stack.
|
// DEBUG - set sizes so that we use a maxmimum amount of stack.
|
||||||
// These settings cause res->num_probs == 3147574, i.e. we will
|
// These settings cause res->num_probs == 3147574, i.e. we will
|
||||||
// need about 6 MB of stack during runtime decompression.
|
// need about 6 MiB of stack during runtime decompression.
|
||||||
pr[1].uintVal = 4;
|
pr[1].uintVal = 4;
|
||||||
pr[2].uintVal = 8;
|
pr[2].uintVal = 8;
|
||||||
#endif
|
#endif
|
||||||
@@ -349,7 +370,7 @@ int upx_lzma_compress ( const upx_bytep src, unsigned src_len,
|
|||||||
# error
|
# error
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (enc.SetCoderProperties(propIDs, pr, 8) != S_OK)
|
if (enc.SetCoderProperties(propIDs, pr, nprops) != S_OK)
|
||||||
goto error;
|
goto error;
|
||||||
if (enc.WriteCoderProperties(&os) != S_OK)
|
if (enc.WriteCoderProperties(&os) != S_OK)
|
||||||
goto error;
|
goto error;
|
||||||
@@ -407,8 +428,13 @@ error:
|
|||||||
#undef _LZMA_OUT_READ
|
#undef _LZMA_OUT_READ
|
||||||
#undef _LZMA_PROB32
|
#undef _LZMA_PROB32
|
||||||
#undef _LZMA_LOC_OPT
|
#undef _LZMA_LOC_OPT
|
||||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
#if (WITH_LZMA >= 0x449)
|
||||||
#include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
# include "C/Compress/Lzma/LzmaDecode.h"
|
||||||
|
# include "C/Compress/Lzma/LzmaDecode.c"
|
||||||
|
#else
|
||||||
|
# include "C/7zip/Compress/LZMA_C/LzmaDecode.h"
|
||||||
|
# include "C/7zip/Compress/LZMA_C/LzmaDecode.c"
|
||||||
|
#endif
|
||||||
|
|
||||||
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
int upx_lzma_decompress ( const upx_bytep src, unsigned src_len,
|
||||||
upx_bytep dst, unsigned* dst_len,
|
upx_bytep dst, unsigned* dst_len,
|
||||||
@@ -519,9 +545,16 @@ int upx_lzma_test_overlap ( const upx_bytep buf,
|
|||||||
|
|
||||||
const char *upx_lzma_version_string(void)
|
const char *upx_lzma_version_string(void)
|
||||||
{
|
{
|
||||||
// FIXME
|
#if (WITH_LZMA + 0 == 0x457)
|
||||||
// return NULL;
|
return "4.57";
|
||||||
|
#elif (WITH_LZMA + 0 == 0x449)
|
||||||
|
return "4.49";
|
||||||
|
#elif (WITH_LZMA + 0 == 0x443)
|
||||||
return "4.43";
|
return "4.43";
|
||||||
|
#else
|
||||||
|
# error "unknown WITH_LZMA version"
|
||||||
|
return NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+12
-7
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -379,12 +379,14 @@ inline unsigned UPX_MIN(unsigned a, unsigned b) { return a < b ? a : b; }
|
|||||||
|
|
||||||
#define ByteArray(var, size) Array(unsigned char, var, size)
|
#define ByteArray(var, size) Array(unsigned char, var, size)
|
||||||
|
|
||||||
struct nocopy
|
struct noncopyable
|
||||||
{
|
{
|
||||||
inline nocopy() {}
|
protected:
|
||||||
|
inline noncopyable() {}
|
||||||
|
inline ~noncopyable() {}
|
||||||
private:
|
private:
|
||||||
nocopy(const nocopy &); // undefined
|
noncopyable(const noncopyable &); // undefined
|
||||||
nocopy& operator=(const nocopy &); // undefined
|
const noncopyable& operator=(const noncopyable &); // undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -456,6 +458,7 @@ private:
|
|||||||
#define UPX_F_VMLINUX_AMD64 27
|
#define UPX_F_VMLINUX_AMD64 27
|
||||||
#define UPX_F_VMLINUX_ARMEL 28
|
#define UPX_F_VMLINUX_ARMEL 28
|
||||||
#define UPX_F_MACH_i386 29
|
#define UPX_F_MACH_i386 29
|
||||||
|
#define UPX_F_LINUX_ELF32_MIPSEL 30
|
||||||
|
|
||||||
#define UPX_F_PLAIN_TEXT 127
|
#define UPX_F_PLAIN_TEXT 127
|
||||||
|
|
||||||
@@ -466,6 +469,8 @@ private:
|
|||||||
#define UPX_F_LINUX_ELF32_ARMEB 133
|
#define UPX_F_LINUX_ELF32_ARMEB 133
|
||||||
#define UPX_F_MACH_FAT 134
|
#define UPX_F_MACH_FAT 134
|
||||||
#define UPX_F_VMLINUX_ARMEB 135
|
#define UPX_F_VMLINUX_ARMEB 135
|
||||||
|
#define UPX_F_VMLINUX_PPC32 136
|
||||||
|
#define UPX_F_LINUX_ELF32_MIPSEB 137
|
||||||
|
|
||||||
|
|
||||||
// compression methods
|
// compression methods
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+11
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -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)
|
void throwIOException(const char *msg, int e)
|
||||||
{
|
{
|
||||||
throw IOException(msg, e);
|
throw IOException(msg, e);
|
||||||
|
|||||||
+4
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -220,6 +220,7 @@ void throwBadLoader() NORET;
|
|||||||
void throwChecksumError() NORET;
|
void throwChecksumError() NORET;
|
||||||
void throwCompressedDataViolation() NORET;
|
void throwCompressedDataViolation() NORET;
|
||||||
void throwInternalError(const char *msg) 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 throwIOException(const char *msg = NULL, int e = 0) NORET;
|
||||||
void throwEOFException(const char *msg = NULL, int e = 0) NORET;
|
void throwEOFException(const char *msg = NULL, int e = 0) NORET;
|
||||||
|
|
||||||
|
|||||||
+20
-15
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ FileBase::~FileBase()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FileBase::sopen()
|
bool FileBase::do_sopen()
|
||||||
{
|
{
|
||||||
if (_shflags < 0)
|
if (_shflags < 0)
|
||||||
_fd = ::open(_name, _flags, _mode);
|
_fd = ::open(_name, _flags, _mode);
|
||||||
@@ -101,13 +101,15 @@ void FileBase::sopen()
|
|||||||
#elif defined(SH_DENYRW)
|
#elif defined(SH_DENYRW)
|
||||||
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
_fd = ::sopen(_name, _flags, _shflags, _mode);
|
||||||
#else
|
#else
|
||||||
assert(0);
|
throwInternalError("bad usage of do_sopen()");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
if (!(_fd < 0)) {
|
if (_fd < 0)
|
||||||
::fstat(_fd, &st);
|
return false;
|
||||||
|
if (::fstat(_fd, &st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
_length = st.st_size;
|
_length = st.st_size;
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -232,8 +234,7 @@ void InputFile::sopen(const char *name, int flags, int shflags)
|
|||||||
_mode = 0;
|
_mode = 0;
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
_length = 0;
|
_length = 0;
|
||||||
FileBase::sopen();
|
if (!FileBase::do_sopen())
|
||||||
if (!isOpen())
|
|
||||||
{
|
{
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
throw FileNotFoundException(_name, errno);
|
throw FileNotFoundException(_name, errno);
|
||||||
@@ -318,8 +319,7 @@ void OutputFile::sopen(const char *name, int flags, int shflags, int mode)
|
|||||||
_mode = mode;
|
_mode = mode;
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
_length = 0;
|
_length = 0;
|
||||||
FileBase::sopen();
|
if (!FileBase::do_sopen())
|
||||||
if (!isOpen())
|
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
// don't throw FileNotFound here -- this is confusing
|
// don't throw FileNotFound here -- this is confusing
|
||||||
@@ -366,7 +366,8 @@ off_t OutputFile::st_size() const
|
|||||||
return bytes_written; // too big if seek()+write() instead of rewrite()
|
return bytes_written; // too big if seek()+write() instead of rewrite()
|
||||||
}
|
}
|
||||||
struct stat my_st;
|
struct stat my_st;
|
||||||
::fstat(_fd, &my_st);
|
if (::fstat(_fd, &my_st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
return my_st.st_size;
|
return my_st.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,15 +403,19 @@ void OutputFile::set_extent(off_t offset, off_t length)
|
|||||||
super::set_extent(offset, length);
|
super::set_extent(offset, length);
|
||||||
bytes_written = 0;
|
bytes_written = 0;
|
||||||
if (0==offset && (off_t)~0u==length) {
|
if (0==offset && (off_t)~0u==length) {
|
||||||
::fstat(_fd, &st);
|
if (::fstat(_fd, &st) != 0)
|
||||||
|
throwIOException(_name, errno);
|
||||||
_length = st.st_size - offset;
|
_length = st.st_size - offset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
off_t OutputFile::unset_extent()
|
off_t OutputFile::unset_extent()
|
||||||
{
|
{
|
||||||
|
off_t l = ::lseek(_fd, 0, SEEK_END);
|
||||||
|
if (l < 0)
|
||||||
|
throwIOException("lseek error", errno);
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
_length = ::lseek(_fd, 0, SEEK_END);
|
_length = l;
|
||||||
bytes_written = _length;
|
bytes_written = _length;
|
||||||
return _length;
|
return _length;
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ public:
|
|||||||
virtual void set_extent(off_t offset, off_t length);
|
virtual void set_extent(off_t offset, off_t length);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void sopen();
|
bool do_sopen();
|
||||||
virtual int read(void *buf, int len);
|
virtual int read(void *buf, int len);
|
||||||
virtual int readx(void *buf, int len);
|
virtual int readx(void *buf, int len);
|
||||||
virtual void write(const void *buf, int len);
|
virtual void write(const void *buf, int len);
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 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];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
@@ -126,7 +126,7 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
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);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+6
-6
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -51,7 +51,7 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 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];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
@@ -125,7 +125,7 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
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);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+8
-8
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -123,8 +123,8 @@ static int F(Filter *f)
|
|||||||
N_MRU : 0;
|
N_MRU : 0;
|
||||||
#endif //}
|
#endif //}
|
||||||
|
|
||||||
// FIXME: We must fit into 8MB because we steal one bit.
|
// FIXME: We must fit into 8 MiB because we steal one bit.
|
||||||
// find a 16MB large empty address space
|
// find a 16 MiB large empty address space
|
||||||
{
|
{
|
||||||
int which;
|
int which;
|
||||||
unsigned char buf[256];
|
unsigned char buf[256];
|
||||||
@@ -249,11 +249,11 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
/*#ifdef TESTING*/
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",
|
||||||
calls,noncalls,noncalls2,size,cto8);
|
calls,noncalls,noncalls2,size,cto8);
|
||||||
printf("CALL/JMP/JCC %d %d %d\n",wtally[0],wtally[1],wtally[2]);
|
printf("CALL/JMP/JCC %d %d %d\n",wtally[0],wtally[1],wtally[2]);
|
||||||
/*#endif*/
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -52,7 +52,7 @@ static int F(Filter *f)
|
|||||||
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
unsigned calls = 0, noncalls = 0, noncalls2 = 0;
|
||||||
unsigned lastnoncall = size, lastcall = 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];
|
unsigned char buf[256];
|
||||||
memset(buf,0,256);
|
memset(buf,0,256);
|
||||||
@@ -126,7 +126,7 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
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);
|
printf("\ncalls=%d noncalls=%d noncalls2=%d text_size=%x calltrickoffset=%x\n",calls,noncalls,noncalls2,size,cto);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2004-2007 John F. Reiser
|
Copyright (C) 2004-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -106,7 +106,7 @@ static int F(Filter *f)
|
|||||||
f->noncalls = noncalls;
|
f->noncalls = noncalls;
|
||||||
f->lastcall = lastcall;
|
f->lastcall = lastcall;
|
||||||
|
|
||||||
#if 0
|
#if 0 || defined(TESTING)
|
||||||
printf("\ncalls=%d noncalls=%d text_size=%x calltrickoffset=%x\n",
|
printf("\ncalls=%d noncalls=%d text_size=%x calltrickoffset=%x\n",
|
||||||
calls,noncalls,size,cto8);
|
calls,noncalls,size,cto8);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+17
-46
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ void show_head(void)
|
|||||||
fg = con_fg(f,FG_GREEN);
|
fg = con_fg(f,FG_GREEN);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" Ultimate Packer for eXecutables\n"
|
" Ultimate Packer for eXecutables\n"
|
||||||
" Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007\n"
|
" Copyright (C) 1996 - 2008\n"
|
||||||
"UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
"UPX %-10s Markus Oberhumer, Laszlo Molnar & John Reiser %14s\n\n",
|
||||||
#if (ACC_OS_DOS16 || ACC_OS_DOS32)
|
#if (ACC_OS_DOS16 || ACC_OS_DOS32)
|
||||||
V("d"),
|
V("d"),
|
||||||
@@ -97,14 +97,14 @@ struct PackerNames
|
|||||||
const char* fname;
|
const char* fname;
|
||||||
const char* sname;
|
const char* sname;
|
||||||
};
|
};
|
||||||
Entry names[32];
|
Entry names[64];
|
||||||
size_t names_count;
|
size_t names_count;
|
||||||
const options_t *o;
|
const options_t *o;
|
||||||
PackerNames() : names_count(0), o(NULL) { }
|
PackerNames() : names_count(0), o(NULL) { }
|
||||||
void add(const Packer *p)
|
void add(const Packer *p)
|
||||||
{
|
{
|
||||||
p->assertPacker();
|
p->assertPacker();
|
||||||
assert(names_count < 32);
|
assert(names_count < 64);
|
||||||
names[names_count].fname = p->getFullName(o);
|
names[names_count].fname = p->getFullName(o);
|
||||||
names[names_count].sname = p->getName();
|
names[names_count].sname = p->getName();
|
||||||
names_count++;
|
names_count++;
|
||||||
@@ -140,15 +140,16 @@ static void show_all_packers(FILE *f, int verbose)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
size_t fl = strlen(fn);
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
con_fprintf(f, " %s", fn);
|
con_fprintf(f, " %s", fn);
|
||||||
pos = 2 + strlen(fn);
|
pos = 2 + fl;
|
||||||
} else if (pos + 1 + strlen(fn) > 80) {
|
} else if (pos + 1 + fl > 80) {
|
||||||
con_fprintf(f, "\n %s", fn);
|
con_fprintf(f, "\n %s", fn);
|
||||||
pos = 2 + strlen(fn);
|
pos = 2 + fl;
|
||||||
} else {
|
} else {
|
||||||
con_fprintf(f, " %s", fn);
|
con_fprintf(f, " %s", fn);
|
||||||
pos += 1 + strlen(fn);
|
pos += 1 + fl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,26 +225,16 @@ void show_help(int verbose)
|
|||||||
" --overlay=skip don't compress a file with an overlay\n"
|
" --overlay=skip don't compress a file with an overlay\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
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");
|
con_fprintf(f,"Options for djgpp2/coff:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --coff produce COFF output [default: EXE]\n"
|
" --coff produce COFF output [default: EXE]\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --all-filters try all available preprocessing filters\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/com:\n");
|
con_fprintf(f,"Options for dos/com:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed com work on any 8086\n"
|
" --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");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/exe:\n");
|
con_fprintf(f,"Options for dos/exe:\n");
|
||||||
@@ -251,15 +242,12 @@ void show_help(int verbose)
|
|||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed exe work on any 8086\n"
|
" --8086 make compressed exe work on any 8086\n"
|
||||||
" --no-reloc put no relocations in to the exe header\n"
|
" --no-reloc put no relocations in to the exe header\n"
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
con_fprintf(f,"Options for dos/sys:\n");
|
con_fprintf(f,"Options for dos/sys:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --8086 make compressed sys work on any 8086\n"
|
" --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");
|
"\n");
|
||||||
#if 0
|
#if 0
|
||||||
fg = con_fg(f,FG_YELLOW);
|
fg = con_fg(f,FG_YELLOW);
|
||||||
@@ -274,27 +262,12 @@ void show_help(int verbose)
|
|||||||
con_fprintf(f,"Options for ps1/exe:\n");
|
con_fprintf(f,"Options for ps1/exe:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
" --all-methods try all available compression methods\n"
|
|
||||||
" --8-bit uses 8 bit size compression [default: 32 bit]\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"
|
" --boot-only disables client/host transfer compatibility\n"
|
||||||
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
|
" --no-align don't align to 2048 bytes [enables: --console-run]\n"
|
||||||
"\n");
|
"\n");
|
||||||
fg = con_fg(f,FG_YELLOW);
|
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");
|
con_fprintf(f,"Options for watcom/le:\n");
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
@@ -314,8 +287,6 @@ void show_help(int verbose)
|
|||||||
" --keep-resource=list do not compress resources specified by list\n"
|
" --keep-resource=list do not compress resources specified by list\n"
|
||||||
" --strip-relocs=0 do not strip relocations\n"
|
" --strip-relocs=0 do not strip relocations\n"
|
||||||
" --strip-relocs=1 strip relocations [default]\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");
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -387,7 +358,7 @@ void show_license(void)
|
|||||||
con_fprintf(f,
|
con_fprintf(f,
|
||||||
"\n"
|
"\n"
|
||||||
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
" Markus F.X.J. Oberhumer Laszlo Molnar\n"
|
||||||
" <mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>\n"
|
" <markus@oberhumer.com> <ml1050@users.sourceforge.net>\n"
|
||||||
);
|
);
|
||||||
fg = con_fg(f,fg);
|
fg = con_fg(f,fg);
|
||||||
|
|
||||||
@@ -427,10 +398,10 @@ void show_version(int x)
|
|||||||
if (v != NULL && v[0])
|
if (v != NULL && v[0])
|
||||||
fprintf(fp, "LZMA SDK version %s\n", v);
|
fprintf(fp, "LZMA SDK version %s\n", v);
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(fp, "Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(fp, "Copyright (C) 1996-2007 Laszlo Molnar\n");
|
fprintf(fp, "Copyright (C) 1996-2008 Laszlo Molnar\n");
|
||||||
fprintf(fp, "Copyright (C) 2000-2007 John F. Reiser\n");
|
fprintf(fp, "Copyright (C) 2000-2008 John F. Reiser\n");
|
||||||
fprintf(fp, "Copyright (C) 2002-2007 Jens Medoch\n");
|
fprintf(fp, "Copyright (C) 2002-2008 Jens Medoch\n");
|
||||||
#if defined(WITH_ZLIB)
|
#if defined(WITH_ZLIB)
|
||||||
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
fprintf(fp, "Copyright (C) 1995" "-2005 Jean-loup Gailly and Mark Adler\n");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+45
-5
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -159,7 +159,9 @@ void ElfLinker::init(const void *pdata_v, int plen)
|
|||||||
input = new upx_byte[inputlen + 1];
|
input = new upx_byte[inputlen + 1];
|
||||||
unsigned new_len = u_len;
|
unsigned new_len = u_len;
|
||||||
int r = upx_decompress(pdata, c_len, input, &new_len, method, NULL);
|
int r = upx_decompress(pdata, c_len, input, &new_len, method, NULL);
|
||||||
if (r != 0 || new_len != u_len)
|
if (r == UPX_E_OUT_OF_MEMORY)
|
||||||
|
throwOutOfMemoryException();
|
||||||
|
if (r != UPX_E_OK || new_len != u_len)
|
||||||
throwBadLoader();
|
throwBadLoader();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -238,7 +240,8 @@ void ElfLinker::preprocessSymbols(char *start, char *end)
|
|||||||
#if 0
|
#if 0
|
||||||
else if (sscanf(start, "%x%*8c %1023s %*x %1023s",
|
else if (sscanf(start, "%x%*8c %1023s %*x %1023s",
|
||||||
#else
|
#else
|
||||||
// work around broken scanf implementations
|
// work around broken scanf() implementations
|
||||||
|
// http://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58)
|
||||||
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s",
|
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s",
|
||||||
#endif
|
#endif
|
||||||
&offset, section, symbol) == 3)
|
&offset, section, symbol) == 3)
|
||||||
@@ -763,6 +766,37 @@ void ElfLinkerM68k::relocate1(const Relocation *rel, upx_byte *location,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ElfLinkerMipsBE::relocate1(const Relocation *rel, upx_byte *location,
|
||||||
|
unsigned value, const char *type)
|
||||||
|
{
|
||||||
|
#define MIPS_HI(a) (((a) >> 16) + (((a) & 0x8000) >> 15))
|
||||||
|
#define MIPS_LO(a) ((a) & 0xffff)
|
||||||
|
#define MIPS_PC16(a) ((a) >> 2)
|
||||||
|
#define MIPS_PC26(a) (((a) & 0x0fffffff) >> 2)
|
||||||
|
|
||||||
|
if (strcmp(type, "R_MIPS_HI16") == 0)
|
||||||
|
set_be16(2+location, get_be16(2+location) + MIPS_HI(value));
|
||||||
|
else if (strcmp(type, "R_MIPS_LO16") == 0)
|
||||||
|
set_be16(2+location, get_be16(2+location) + MIPS_LO(value));
|
||||||
|
else if (strcmp(type, "R_MIPS_PC16") == 0)
|
||||||
|
{
|
||||||
|
value -= rel->section->offset + rel->offset;
|
||||||
|
set_be16(2+location, get_be16(2+location) + MIPS_PC16(value));
|
||||||
|
}
|
||||||
|
else if (strcmp(type, "R_MIPS_26") == 0)
|
||||||
|
set_be32(location, get_be32(location) + MIPS_PC26(value));
|
||||||
|
else if (strcmp(type, "R_MIPS_32") == 0)
|
||||||
|
set_be32(location, get_be32(location) + value);
|
||||||
|
else
|
||||||
|
super::relocate1(rel, location, value, type);
|
||||||
|
|
||||||
|
#undef MIPS_HI
|
||||||
|
#undef MIPS_LO
|
||||||
|
#undef MIPS_PC16
|
||||||
|
#undef MIPS_PC26
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ElfLinkerMipsLE::relocate1(const Relocation *rel, upx_byte *location,
|
void ElfLinkerMipsLE::relocate1(const Relocation *rel, upx_byte *location,
|
||||||
unsigned value, const char *type)
|
unsigned value, const char *type)
|
||||||
{
|
{
|
||||||
@@ -801,6 +835,12 @@ void ElfLinkerPpc32::relocate1(const Relocation *rel, upx_byte *location,
|
|||||||
return super::relocate1(rel, location, value, type);
|
return super::relocate1(rel, location, value, type);
|
||||||
type += 6;
|
type += 6;
|
||||||
|
|
||||||
|
if (strcmp(type, "ADDR32") == 0)
|
||||||
|
{
|
||||||
|
set_be32(location, get_be32(location) + value);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (strncmp(type, "REL", 3) == 0)
|
if (strncmp(type, "REL", 3) == 0)
|
||||||
{
|
{
|
||||||
value -= rel->section->offset + rel->offset;
|
value -= rel->section->offset + rel->offset;
|
||||||
|
|||||||
+27
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -34,11 +34,11 @@
|
|||||||
// ElfLinker
|
// ElfLinker
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
class ElfLinker : private nocopy
|
class ElfLinker : private noncopyable
|
||||||
{
|
{
|
||||||
friend class Packer;
|
friend class Packer;
|
||||||
public:
|
public:
|
||||||
const N_BELE_RTP::AbstractPolicy *bele;
|
const N_BELE_RTP::AbstractPolicy *bele; // target endianness
|
||||||
protected:
|
protected:
|
||||||
struct Section;
|
struct Section;
|
||||||
struct Symbol;
|
struct Symbol;
|
||||||
@@ -107,10 +107,18 @@ protected:
|
|||||||
virtual void relocate();
|
virtual void relocate();
|
||||||
virtual void relocate1(const Relocation *, upx_byte *location,
|
virtual void relocate1(const Relocation *, upx_byte *location,
|
||||||
unsigned value, const char *type);
|
unsigned 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); }
|
||||||
|
acc_uint64l_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, acc_uint64l_t v) const { bele->set64(p, v); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ElfLinker::Section : private nocopy
|
struct ElfLinker::Section : private noncopyable
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
void *input;
|
void *input;
|
||||||
@@ -125,7 +133,7 @@ struct ElfLinker::Section : private nocopy
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ElfLinker::Symbol : private nocopy
|
struct ElfLinker::Symbol : private noncopyable
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
Section *section;
|
Section *section;
|
||||||
@@ -136,7 +144,7 @@ struct ElfLinker::Symbol : private nocopy
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct ElfLinker::Relocation : private nocopy
|
struct ElfLinker::Relocation : private noncopyable
|
||||||
{
|
{
|
||||||
const Section *section;
|
const Section *section;
|
||||||
unsigned offset;
|
unsigned offset;
|
||||||
@@ -195,6 +203,17 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ElfLinkerMipsLE : public ElfLinker
|
class ElfLinkerMipsLE : public ElfLinker
|
||||||
{
|
{
|
||||||
typedef ElfLinker super;
|
typedef ElfLinker super;
|
||||||
|
|||||||
+43
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -56,6 +56,9 @@ void options_t::reset()
|
|||||||
|
|
||||||
o->backup = -1;
|
o->backup = -1;
|
||||||
o->overlay = -1;
|
o->overlay = -1;
|
||||||
|
o->preserve_mode = true;
|
||||||
|
o->preserve_ownership = true;
|
||||||
|
o->preserve_timestamp = true;
|
||||||
|
|
||||||
o->console = CON_FILE;
|
o->console = CON_FILE;
|
||||||
#if defined(__DJGPP__)
|
#if defined(__DJGPP__)
|
||||||
@@ -630,6 +633,17 @@ static int do_option(int optc, const char *arg)
|
|||||||
opt->debug.disable_random_id = true;
|
opt->debug.disable_random_id = true;
|
||||||
break;
|
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
|
// misc
|
||||||
case 512:
|
case 512:
|
||||||
opt->console = CON_FILE;
|
opt->console = CON_FILE;
|
||||||
@@ -646,6 +660,15 @@ static int do_option(int optc, const char *arg)
|
|||||||
case 519:
|
case 519:
|
||||||
opt->no_env = true;
|
opt->no_env = true;
|
||||||
break;
|
break;
|
||||||
|
case 526:
|
||||||
|
opt->preserve_mode = false;
|
||||||
|
break;
|
||||||
|
case 527:
|
||||||
|
opt->preserve_ownership = false;
|
||||||
|
break;
|
||||||
|
case 528:
|
||||||
|
opt->preserve_timestamp = false;
|
||||||
|
break;
|
||||||
// compression settings
|
// compression settings
|
||||||
case 520: // --small
|
case 520: // --small
|
||||||
if (opt->small < 0)
|
if (opt->small < 0)
|
||||||
@@ -858,7 +881,7 @@ static int do_option(int optc, const char *arg)
|
|||||||
opt->ps1_exe.do_8bit = true;
|
opt->ps1_exe.do_8bit = true;
|
||||||
break;
|
break;
|
||||||
case 673:
|
case 673:
|
||||||
opt->ps1_exe.do_8mb = false;
|
opt->ps1_exe.do_8mib = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '\0':
|
case '\0':
|
||||||
@@ -900,7 +923,10 @@ static const struct mfx_option longopts[] =
|
|||||||
{"force-compress", 0, 0, 'f'}, // and compression of suspicious files
|
{"force-compress", 0, 0, 'f'}, // and compression of suspicious files
|
||||||
{"info", 0, 0, 'i'}, // info mode
|
{"info", 0, 0, 'i'}, // info mode
|
||||||
{"no-env", 0x10, 0, 519}, // no environment var
|
{"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-progress", 0, 0, 516}, // no progress bar
|
||||||
|
{"no-time", 0x10, 0, 528}, // do not preserve timestamp
|
||||||
{"output", 0x21, 0, 'o'},
|
{"output", 0x21, 0, 'o'},
|
||||||
{"quiet", 0, 0, 'q'}, // quiet mode
|
{"quiet", 0, 0, 'q'}, // quiet mode
|
||||||
{"silent", 0, 0, 'q'}, // quiet mode
|
{"silent", 0, 0, 'q'}, // quiet mode
|
||||||
@@ -1019,8 +1045,14 @@ static const struct mfx_option longopts[] =
|
|||||||
{"boot-only", 0x10, 0, 670},
|
{"boot-only", 0x10, 0, 670},
|
||||||
{"no-align", 0x10, 0, 671},
|
{"no-align", 0x10, 0, 671},
|
||||||
{"8-bit", 0x10, 0, 672},
|
{"8-bit", 0x10, 0, 672},
|
||||||
|
{"8mib-ram", 0x10, 0, 673},
|
||||||
{"8mb-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 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1091,6 +1123,13 @@ static const struct mfx_option longopts[] =
|
|||||||
// compression settings
|
// compression settings
|
||||||
{"exact", 0x10, 0, 525}, // user requires byte-identical decompression
|
{"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)
|
||||||
|
// compression settings
|
||||||
// compression runtime parameters
|
// compression runtime parameters
|
||||||
|
|
||||||
// win32/pe
|
// win32/pe
|
||||||
|
|||||||
+4
-8
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -192,11 +192,7 @@ void MemBuffer::alloc(unsigned size)
|
|||||||
assert((int)total > 0);
|
assert((int)total > 0);
|
||||||
unsigned char *p = (unsigned char *) malloc(total);
|
unsigned char *p = (unsigned char *) malloc(total);
|
||||||
if (!p)
|
if (!p)
|
||||||
{
|
throwOutOfMemoryException();
|
||||||
//throw bad_alloc();
|
|
||||||
throw OutOfMemoryException("out of memory");
|
|
||||||
//exit(1);
|
|
||||||
}
|
|
||||||
b_size = size;
|
b_size = size;
|
||||||
if (use_mcheck)
|
if (use_mcheck)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+65
-226
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||||
@@ -38,7 +39,7 @@
|
|||||||
|
|
||||||
#ifndef __ACC_H_INCLUDED
|
#ifndef __ACC_H_INCLUDED
|
||||||
#define __ACC_H_INCLUDED 1
|
#define __ACC_H_INCLUDED 1
|
||||||
#define ACC_VERSION 20070113L
|
#define ACC_VERSION 20080102L
|
||||||
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
||||||
# define __CYGWIN__ __CYGWIN32__
|
# define __CYGWIN__ __CYGWIN32__
|
||||||
#endif
|
#endif
|
||||||
@@ -419,6 +420,9 @@
|
|||||||
# elif defined(__NT__) && (__WATCOMC__ < 1100)
|
# elif defined(__NT__) && (__WATCOMC__ < 1100)
|
||||||
# define ACC_OS_WIN32 1
|
# define ACC_OS_WIN32 1
|
||||||
# define ACC_INFO_OS "win32"
|
# define ACC_INFO_OS "win32"
|
||||||
|
# elif defined(__linux__) || defined(__LINUX__)
|
||||||
|
# define ACC_OS_POSIX 1
|
||||||
|
# define ACC_INFO_OS "posix"
|
||||||
# else
|
# else
|
||||||
# error "please specify a target using the -bt compiler option"
|
# error "please specify a target using the -bt compiler option"
|
||||||
# endif
|
# endif
|
||||||
@@ -464,7 +468,7 @@
|
|||||||
# elif defined(__IRIX__) || defined(__irix__)
|
# elif defined(__IRIX__) || defined(__irix__)
|
||||||
# define ACC_OS_POSIX_IRIX 1
|
# define ACC_OS_POSIX_IRIX 1
|
||||||
# define ACC_INFO_OS_POSIX "irix"
|
# define ACC_INFO_OS_POSIX "irix"
|
||||||
# elif defined(__linux__) || defined(__linux)
|
# elif defined(__linux__) || defined(__linux) || defined(__LINUX__)
|
||||||
# define ACC_OS_POSIX_LINUX 1
|
# define ACC_OS_POSIX_LINUX 1
|
||||||
# define ACC_INFO_OS_POSIX "linux"
|
# define ACC_INFO_OS_POSIX "linux"
|
||||||
# elif defined(__APPLE__) || defined(__MACOS__)
|
# elif defined(__APPLE__) || defined(__MACOS__)
|
||||||
@@ -896,7 +900,7 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__ACC_MM_OVERRIDE)
|
#if !defined(__ACC_MM_OVERRIDE)
|
||||||
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
#if (ACC_ARCH_I086)
|
||||||
#if (UINT_MAX != ACC_0xffffL)
|
#if (UINT_MAX != ACC_0xffffL)
|
||||||
# error "this should not happen"
|
# error "this should not happen"
|
||||||
#endif
|
#endif
|
||||||
@@ -927,6 +931,7 @@
|
|||||||
#else
|
#else
|
||||||
# error "unknown memory model"
|
# error "unknown memory model"
|
||||||
#endif
|
#endif
|
||||||
|
#if (ACC_OS_DOS16 || ACC_OS_OS216 || ACC_OS_WIN16)
|
||||||
#define ACC_HAVE_MM_HUGE_PTR 1
|
#define ACC_HAVE_MM_HUGE_PTR 1
|
||||||
#define ACC_HAVE_MM_HUGE_ARRAY 1
|
#define ACC_HAVE_MM_HUGE_ARRAY 1
|
||||||
#if (ACC_MM_TINY)
|
#if (ACC_MM_TINY)
|
||||||
@@ -979,6 +984,7 @@ extern "C" {
|
|||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#elif (ACC_ARCH_C166)
|
#elif (ACC_ARCH_C166)
|
||||||
#if !defined(__MODEL__)
|
#if !defined(__MODEL__)
|
||||||
# error "FIXME - C166 __MODEL__"
|
# error "FIXME - C166 __MODEL__"
|
||||||
@@ -1148,6 +1154,8 @@ extern "C" {
|
|||||||
# if (ACC_CC_GNUC >= 0x030300ul)
|
# if (ACC_CC_GNUC >= 0x030300ul)
|
||||||
# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0)
|
# if ((__LONG_MAX__)+0 == (__LONG_LONG_MAX__)+0)
|
||||||
# define ACC_SIZEOF_LONG_LONG ACC_SIZEOF_LONG
|
# define ACC_SIZEOF_LONG_LONG ACC_SIZEOF_LONG
|
||||||
|
# elif (__ACC_LSR(__LONG_LONG_MAX__,30) == 1)
|
||||||
|
# define ACC_SIZEOF_LONG_LONG 4
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
@@ -1396,6 +1404,7 @@ extern "C" {
|
|||||||
# define ACC_INFO_LIBC "default"
|
# define ACC_INFO_LIBC "default"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__acc_gnuc_extension__)
|
||||||
#if (ACC_CC_GNUC >= 0x020800ul)
|
#if (ACC_CC_GNUC >= 0x020800ul)
|
||||||
# define __acc_gnuc_extension__ __extension__
|
# define __acc_gnuc_extension__ __extension__
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
@@ -1403,6 +1412,7 @@ extern "C" {
|
|||||||
#else
|
#else
|
||||||
# define __acc_gnuc_extension__
|
# define __acc_gnuc_extension__
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if !defined(__acc_ua_volatile)
|
#if !defined(__acc_ua_volatile)
|
||||||
# define __acc_ua_volatile volatile
|
# define __acc_ua_volatile volatile
|
||||||
#endif
|
#endif
|
||||||
@@ -1707,6 +1717,8 @@ extern "C" {
|
|||||||
# else
|
# else
|
||||||
# define __acc_cdecl_sighandler __cdecl
|
# define __acc_cdecl_sighandler __cdecl
|
||||||
# endif
|
# endif
|
||||||
|
#elif (ACC_ARCH_I386) && (ACC_CC_WATCOMC)
|
||||||
|
# define __acc_cdecl __cdecl
|
||||||
#elif (ACC_ARCH_M68K && ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
#elif (ACC_ARCH_M68K && ACC_OS_TOS && (ACC_CC_PUREC || ACC_CC_TURBOC))
|
||||||
# define __acc_cdecl cdecl
|
# define __acc_cdecl cdecl
|
||||||
#endif
|
#endif
|
||||||
@@ -1728,6 +1740,7 @@ extern "C" {
|
|||||||
#if !defined(__acc_cdecl_va)
|
#if !defined(__acc_cdecl_va)
|
||||||
# define __acc_cdecl_va __acc_cdecl
|
# define __acc_cdecl_va __acc_cdecl
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(ACC_CFG_NO_WINDOWS_H)
|
||||||
#if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64)
|
#if (ACC_OS_CYGWIN || (ACC_OS_EMX && defined(__RSXNT__)) || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
|
# if (ACC_CC_WATCOMC && (__WATCOMC__ < 1000))
|
||||||
# elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
# elif (ACC_OS_WIN32 && ACC_CC_GNUC) && defined(__PW32__)
|
||||||
@@ -1736,6 +1749,7 @@ extern "C" {
|
|||||||
# define ACC_HAVE_WINDOWS_H 1
|
# define ACC_HAVE_WINDOWS_H 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if (ACC_ARCH_ALPHA)
|
#if (ACC_ARCH_ALPHA)
|
||||||
# define ACC_OPT_AVOID_UINT_INDEX 1
|
# define ACC_OPT_AVOID_UINT_INDEX 1
|
||||||
# define ACC_OPT_AVOID_SHORT 1
|
# define ACC_OPT_AVOID_SHORT 1
|
||||||
@@ -2143,6 +2157,7 @@ extern "C" {
|
|||||||
#define HAVE_DIFFTIME 1
|
#define HAVE_DIFFTIME 1
|
||||||
#define HAVE_FILENO 1
|
#define HAVE_FILENO 1
|
||||||
#define HAVE_FSTAT 1
|
#define HAVE_FSTAT 1
|
||||||
|
#define HAVE_GETENV 1
|
||||||
#define HAVE_GETTIMEOFDAY 1
|
#define HAVE_GETTIMEOFDAY 1
|
||||||
#define HAVE_GMTIME 1
|
#define HAVE_GMTIME 1
|
||||||
#define HAVE_ISATTY 1
|
#define HAVE_ISATTY 1
|
||||||
@@ -2285,7 +2300,7 @@ extern "C" {
|
|||||||
# if (_MSC_VER < 700)
|
# if (_MSC_VER < 700)
|
||||||
# undef HAVE_SNPRINTF
|
# undef HAVE_SNPRINTF
|
||||||
# undef HAVE_VSNPRINTF
|
# undef HAVE_VSNPRINTF
|
||||||
# else
|
# elif (_MSC_VER < 1500)
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
# define vsnprintf _vsnprintf
|
# define vsnprintf _vsnprintf
|
||||||
# endif
|
# endif
|
||||||
@@ -2704,6 +2719,9 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
# elif (ACC_SIZEOF_LONG >= 4)
|
# elif (ACC_SIZEOF_LONG >= 4)
|
||||||
# define ACC_INT32_C(c) c##L
|
# define ACC_INT32_C(c) c##L
|
||||||
# define ACC_UINT32_C(c) c##UL
|
# define ACC_UINT32_C(c) c##UL
|
||||||
|
# elif (ACC_SIZEOF_LONG_LONG >= 4)
|
||||||
|
# define ACC_INT32_C(c) c##LL
|
||||||
|
# define ACC_UINT32_C(c) c##ULL
|
||||||
# else
|
# else
|
||||||
# error "ACC_INT32_C"
|
# error "ACC_INT32_C"
|
||||||
# endif
|
# endif
|
||||||
@@ -2799,7 +2817,7 @@ typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(acc_signo_t);
|
|||||||
# define ACC_UA_GET_LE16(p) ACC_UA_GET16(p)
|
# define ACC_UA_GET_LE16(p) ACC_UA_GET16(p)
|
||||||
# define ACC_UA_SET_LE16(p,v) ACC_UA_SET16(p,v)
|
# define ACC_UA_SET_LE16(p,v) ACC_UA_SET16(p,v)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_forceinline)
|
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_HAVE_forceinline)
|
||||||
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
||||||
#if !defined(ACC_UA_GET_LE16)
|
#if !defined(ACC_UA_GET_LE16)
|
||||||
extern __acc_forceinline unsigned long __ACC_UA_GET_LE16(__acc_ua_volatile const void* pp);
|
extern __acc_forceinline unsigned long __ACC_UA_GET_LE16(__acc_ua_volatile const void* pp);
|
||||||
@@ -2835,7 +2853,7 @@ extern __acc_forceinline void __ACC_UA_SET_LE16(__acc_ua_volatile void* pp, unsi
|
|||||||
# define ACC_UA_GET_LE32(p) ACC_UA_GET32(p)
|
# define ACC_UA_GET_LE32(p) ACC_UA_GET32(p)
|
||||||
# define ACC_UA_SET_LE32(p,v) ACC_UA_SET32(p,v)
|
# define ACC_UA_SET_LE32(p,v) ACC_UA_SET32(p,v)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_forceinline)
|
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_HAVE_forceinline)
|
||||||
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
||||||
#if !defined(ACC_UA_GET_LE32)
|
#if !defined(ACC_UA_GET_LE32)
|
||||||
extern __acc_forceinline unsigned long __ACC_UA_GET_LE32(__acc_ua_volatile const void* pp);
|
extern __acc_forceinline unsigned long __ACC_UA_GET_LE32(__acc_ua_volatile const void* pp);
|
||||||
@@ -3129,6 +3147,9 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
# elif (ACC_SIZEOF_LONG >= 4)
|
# elif (ACC_SIZEOF_LONG >= 4)
|
||||||
# define ACC_INT32_C(c) c##L
|
# define ACC_INT32_C(c) c##L
|
||||||
# define ACC_UINT32_C(c) c##UL
|
# define ACC_UINT32_C(c) c##UL
|
||||||
|
# elif (ACC_SIZEOF_LONG_LONG >= 4)
|
||||||
|
# define ACC_INT32_C(c) c##LL
|
||||||
|
# define ACC_UINT32_C(c) c##ULL
|
||||||
# else
|
# else
|
||||||
# error "ACC_INT32_C"
|
# error "ACC_INT32_C"
|
||||||
# endif
|
# endif
|
||||||
@@ -3223,7 +3244,7 @@ typedef void (__acc_cdecl_sighandler *acc_sighandler_t)(acc_signo_t);
|
|||||||
# define ACC_UA_GET_LE16(p) ACC_UA_GET16(p)
|
# define ACC_UA_GET_LE16(p) ACC_UA_GET16(p)
|
||||||
# define ACC_UA_SET_LE16(p,v) ACC_UA_SET16(p,v)
|
# define ACC_UA_SET_LE16(p,v) ACC_UA_SET16(p,v)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_forceinline)
|
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_HAVE_forceinline)
|
||||||
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
||||||
#if !defined(ACC_UA_GET_LE16)
|
#if !defined(ACC_UA_GET_LE16)
|
||||||
extern __acc_forceinline unsigned long __ACC_UA_GET_LE16(__acc_ua_volatile const void* pp);
|
extern __acc_forceinline unsigned long __ACC_UA_GET_LE16(__acc_ua_volatile const void* pp);
|
||||||
@@ -3259,7 +3280,7 @@ extern __acc_forceinline void __ACC_UA_SET_LE16(__acc_ua_volatile void* pp, unsi
|
|||||||
# define ACC_UA_GET_LE32(p) ACC_UA_GET32(p)
|
# define ACC_UA_GET_LE32(p) ACC_UA_GET32(p)
|
||||||
# define ACC_UA_SET_LE32(p,v) ACC_UA_SET32(p,v)
|
# define ACC_UA_SET_LE32(p,v) ACC_UA_SET32(p,v)
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_forceinline)
|
#if !defined(ACC_CFG_NO_INLINE_ASM) && defined(__acc_HAVE_forceinline)
|
||||||
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
#if (ACC_ARCH_POWERPC && ACC_ABI_BIG_ENDIAN) && (ACC_CC_GNUC)
|
||||||
#if !defined(ACC_UA_GET_LE32)
|
#if !defined(ACC_UA_GET_LE32)
|
||||||
extern __acc_forceinline unsigned long __ACC_UA_GET_LE32(__acc_ua_volatile const void* pp);
|
extern __acc_forceinline unsigned long __ACC_UA_GET_LE32(__acc_ua_volatile const void* pp);
|
||||||
@@ -3835,6 +3856,7 @@ ACCLIB_EXTERN(int, acc_closedir) (acc_dir_p);
|
|||||||
# define acc_stackavail() _chkstack()
|
# define acc_stackavail() _chkstack()
|
||||||
#endif
|
#endif
|
||||||
ACCLIB_EXTERN(acclib_handle_t, acc_get_osfhandle) (int);
|
ACCLIB_EXTERN(acclib_handle_t, acc_get_osfhandle) (int);
|
||||||
|
ACCLIB_EXTERN(const char *, acc_getenv) (const char *);
|
||||||
ACCLIB_EXTERN(int, acc_isatty) (int);
|
ACCLIB_EXTERN(int, acc_isatty) (int);
|
||||||
ACCLIB_EXTERN(int, acc_mkdir) (const char*, unsigned);
|
ACCLIB_EXTERN(int, acc_mkdir) (const char*, unsigned);
|
||||||
ACCLIB_EXTERN(int, acc_rmdir) (const char*);
|
ACCLIB_EXTERN(int, acc_rmdir) (const char*);
|
||||||
@@ -3849,7 +3871,8 @@ ACCLIB_EXTERN_NOINLINE(void, acc_debug_break) (void);
|
|||||||
ACCLIB_EXTERN_NOINLINE(void, acc_debug_nop) (void);
|
ACCLIB_EXTERN_NOINLINE(void, acc_debug_nop) (void);
|
||||||
ACCLIB_EXTERN_NOINLINE(int, acc_debug_align_check_query) (void);
|
ACCLIB_EXTERN_NOINLINE(int, acc_debug_align_check_query) (void);
|
||||||
ACCLIB_EXTERN_NOINLINE(int, acc_debug_align_check_enable) (int);
|
ACCLIB_EXTERN_NOINLINE(int, acc_debug_align_check_enable) (int);
|
||||||
ACCLIB_EXTERN_NOINLINE(int, acc_debug_running_on_valgrind) (void);
|
ACCLIB_EXTERN_NOINLINE(unsigned, acc_debug_running_on_qemu) (void);
|
||||||
|
ACCLIB_EXTERN_NOINLINE(unsigned, acc_debug_running_on_valgrind) (void);
|
||||||
#if !defined(acc_int64l_t) || defined(ACC_CFG_NO_DOUBLE)
|
#if !defined(acc_int64l_t) || defined(ACC_CFG_NO_DOUBLE)
|
||||||
# undef __ACCLIB_PCLOCK_USE_RDTSC
|
# undef __ACCLIB_PCLOCK_USE_RDTSC
|
||||||
# undef __ACCLIB_PCLOCK_USE_PERFCTR
|
# undef __ACCLIB_PCLOCK_USE_PERFCTR
|
||||||
@@ -4603,10 +4626,6 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mode, const char* fn, const char* const * a
|
|||||||
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
||||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
|
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 4)
|
||||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
||||||
#elif (ACC_ARCH_AMD64)
|
|
||||||
ACCCHK_ASSERT(sizeof(size_t) == 8)
|
|
||||||
ACCCHK_ASSERT(sizeof(ptrdiff_t) == 8)
|
|
||||||
ACCCHK_ASSERT(sizeof(acc_intptr_t) == sizeof(void *))
|
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32)
|
#if (ACC_OS_DOS32 || ACC_OS_OS2 || ACC_OS_WIN32)
|
||||||
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
ACCCHK_ASSERT(sizeof(size_t) == 4)
|
||||||
@@ -5277,213 +5296,6 @@ ACCLIB_PUBLIC(int, acc_dos_free) (void __far* p)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(ACC_WANT_ACCLIB_GETOPT)
|
|
||||||
# undef ACC_WANT_ACCLIB_GETOPT
|
|
||||||
#define __ACCLIB_GETOPT_CH_INCLUDED 1
|
|
||||||
#if !defined(ACCLIB_PUBLIC)
|
|
||||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
|
||||||
#endif
|
|
||||||
ACCLIB_PUBLIC(void, acc_getopt_init) (acc_getopt_p g,
|
|
||||||
int start_argc, int argc, char** argv)
|
|
||||||
{
|
|
||||||
memset(g, 0, sizeof(*g));
|
|
||||||
g->argc = argc;
|
|
||||||
g->argv = argv;
|
|
||||||
g->pending_rotate_first = g->pending_rotate_middle = g->optind = start_argc;
|
|
||||||
}
|
|
||||||
static int __ACCLIB_FUNCNAME(acc_getopt_rotate) (char **p, int first, int middle, int last)
|
|
||||||
{
|
|
||||||
char** a; char** b;
|
|
||||||
if (first >= middle || middle >= last) return 0;
|
|
||||||
for (a = p + first, b = p + middle - 1; a < b; ++a, --b) {
|
|
||||||
char* t = *a; *a = *b; *b = t;
|
|
||||||
}
|
|
||||||
for (a = p + middle, b = p + last - 1; a < b; ++a, --b) {
|
|
||||||
char* t = *a; *a = *b; *b = t;
|
|
||||||
}
|
|
||||||
for (a = p + first, b = p + last - 1; a < b; ++a, --b) {
|
|
||||||
char* t = *a; *a = *b; *b = t;
|
|
||||||
}
|
|
||||||
return middle - first;
|
|
||||||
}
|
|
||||||
static int __acc_getopt_x(acc_getopt_p g, int ret, int oo, int flags, const char *f, ...)
|
|
||||||
{
|
|
||||||
if (oo >= 0)
|
|
||||||
g->optopt = oo;
|
|
||||||
if (flags & 1)
|
|
||||||
{
|
|
||||||
if (g->shortpos == 0)
|
|
||||||
g->optind++;
|
|
||||||
else if (!g->argv[g->optind][++g->shortpos])
|
|
||||||
g->optind++, g->shortpos = 0;
|
|
||||||
}
|
|
||||||
if (f == NULL)
|
|
||||||
return ret;
|
|
||||||
if (g->opterr)
|
|
||||||
{
|
|
||||||
#if !defined(HAVE_STDARG_H)
|
|
||||||
g->opterr(g, f, NULL);
|
|
||||||
#else
|
|
||||||
va_list ap;
|
|
||||||
va_start(ap, f);
|
|
||||||
g->opterr(g, f, &ap);
|
|
||||||
va_end(ap);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
g->errcount++;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
ACCLIB_PUBLIC(int, acc_getopt) (acc_getopt_p g,
|
|
||||||
const char* shortopts,
|
|
||||||
const acc_getopt_longopt_p longopts,
|
|
||||||
int* longind)
|
|
||||||
{
|
|
||||||
int ordering = ACC_GETOPT_PERMUTE;
|
|
||||||
char *a;
|
|
||||||
int has_arg = 0;
|
|
||||||
char *arg;
|
|
||||||
unsigned char sc;
|
|
||||||
int i;
|
|
||||||
if (shortopts && (*shortopts == '-' || *shortopts == '+'))
|
|
||||||
ordering = *shortopts++ == '-' ? ACC_GETOPT_RETURN_IN_ORDER : ACC_GETOPT_REQUIRE_ORDER;
|
|
||||||
g->optarg = NULL;
|
|
||||||
g->optopt = '?';
|
|
||||||
if (longind != NULL)
|
|
||||||
*longind = -1;
|
|
||||||
if (g->eof || g->optind >= g->argc || g->argv == NULL)
|
|
||||||
goto acc_label_eof;
|
|
||||||
if (g->shortpos)
|
|
||||||
goto acc_label_next_shortopt;
|
|
||||||
g->optind -= __ACCLIB_FUNCNAME(acc_getopt_rotate)(g->argv, g->pending_rotate_first, g->pending_rotate_middle, g->optind);
|
|
||||||
g->pending_rotate_first = g->pending_rotate_middle = g->optind;
|
|
||||||
if (ordering == ACC_GETOPT_PERMUTE)
|
|
||||||
{
|
|
||||||
while (g->optind < g->argc && !(g->argv[g->optind][0] == '-' && g->argv[g->optind][1]))
|
|
||||||
g->optind++;
|
|
||||||
g->pending_rotate_middle = g->optind;
|
|
||||||
}
|
|
||||||
if (g->optind >= g->argc)
|
|
||||||
{
|
|
||||||
g->optind = g->pending_rotate_first;
|
|
||||||
acc_label_eof:
|
|
||||||
g->optind -= __ACCLIB_FUNCNAME(acc_getopt_rotate)(g->argv, g->pending_rotate_first, g->pending_rotate_middle, g->optind);
|
|
||||||
g->pending_rotate_first = g->pending_rotate_middle = g->optind;
|
|
||||||
g->eof = 1;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
a = g->argv[g->optind];
|
|
||||||
if (strcmp(a, "--") == 0)
|
|
||||||
{
|
|
||||||
g->optind++;
|
|
||||||
goto acc_label_eof;
|
|
||||||
}
|
|
||||||
if (!(a[0] == '-' && a[1]))
|
|
||||||
{
|
|
||||||
if (ordering == ACC_GETOPT_REQUIRE_ORDER)
|
|
||||||
goto acc_label_eof;
|
|
||||||
if (ordering == ACC_GETOPT_RETURN_IN_ORDER)
|
|
||||||
{
|
|
||||||
g->optarg = a;
|
|
||||||
g->optind++;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
__acc_getopt_x(g, -1, -1, 0, "invalid ordering %d", ordering);
|
|
||||||
goto acc_label_eof;
|
|
||||||
}
|
|
||||||
if (a[1] == '-')
|
|
||||||
{
|
|
||||||
const acc_getopt_longopt_p lo = NULL;
|
|
||||||
size_t match_chars;
|
|
||||||
for (arg = a + 2; *arg && *arg != '=' && *arg != '#'; )
|
|
||||||
++arg;
|
|
||||||
match_chars = (size_t) (arg - (a + 2));
|
|
||||||
for (i = 0; longopts && longopts[i].name; ++i)
|
|
||||||
{
|
|
||||||
size_t n = match_chars;
|
|
||||||
size_t l = strlen(longopts[i].name);
|
|
||||||
if (longopts[i].has_arg & ACC_GETOPT_EXACT_ARG) n = l;
|
|
||||||
if (strncmp(a, longopts[i].name, n) != 0)
|
|
||||||
continue;
|
|
||||||
if (match_chars == l)
|
|
||||||
{
|
|
||||||
lo = &longopts[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if (lo == NULL)
|
|
||||||
lo = &longopts[i];
|
|
||||||
else
|
|
||||||
return __acc_getopt_x(g, '?', 0, 1, "option '%s' is ambiguous (could be '--%s' or '--%s')",
|
|
||||||
a, lo->name, longopts[i].name);
|
|
||||||
}
|
|
||||||
if (lo == NULL)
|
|
||||||
return __acc_getopt_x(g, '?', 0, 1, "unrecognized option '%s'", a);
|
|
||||||
switch (lo->has_arg & 0x2f)
|
|
||||||
{
|
|
||||||
case ACC_GETOPT_OPTIONAL_ARG:
|
|
||||||
break;
|
|
||||||
case ACC_GETOPT_REQUIRED_ARG:
|
|
||||||
if (*arg)
|
|
||||||
g->optarg = arg + 1;
|
|
||||||
else if (g->optind + 1 < g->argc)
|
|
||||||
g->optarg = g->argv[++g->optind];
|
|
||||||
else
|
|
||||||
return __acc_getopt_x(g, '?', 0, 1, "option '%s' requires an argument", lo->name);
|
|
||||||
g->optind++;
|
|
||||||
break;
|
|
||||||
case ACC_GETOPT_REQUIRED_ARG | 0x20:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (*arg)
|
|
||||||
return __acc_getopt_x(g, '?', lo->val, 1, "option '%s' doesn't allow an argument", lo->name);
|
|
||||||
g->optind++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (longind != NULL)
|
|
||||||
*longind = (int) (lo - longopts);
|
|
||||||
if (lo->flag != NULL)
|
|
||||||
{
|
|
||||||
*lo->flag = lo->val;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return lo->val;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const char *sp;
|
|
||||||
g->shortpos = 1;
|
|
||||||
acc_label_next_shortopt:
|
|
||||||
a = g->argv[g->optind] + g->shortpos;
|
|
||||||
sp = NULL; sc = (unsigned char) *a;
|
|
||||||
if (shortopts)
|
|
||||||
sp = strchr(shortopts, sc);
|
|
||||||
if (!sp)
|
|
||||||
return __acc_getopt_x(g, '?', sc, 1, "invalid option '-%c'", sc);
|
|
||||||
if (sp[1] == ':') { has_arg++; if (sp[2] == ':') has_arg++; }
|
|
||||||
arg = a + 1;
|
|
||||||
switch (has_arg)
|
|
||||||
{
|
|
||||||
case ACC_GETOPT_OPTIONAL_ARG:
|
|
||||||
if (*arg)
|
|
||||||
g->optarg = arg + 1;
|
|
||||||
g->optind++, g->shortpos = 0;
|
|
||||||
break;
|
|
||||||
case ACC_GETOPT_REQUIRED_ARG:
|
|
||||||
if (*arg)
|
|
||||||
g->optarg = arg + 1;
|
|
||||||
else if (g->optind + 1 < g->argc)
|
|
||||||
g->optarg = g->argv[++g->optind];
|
|
||||||
else
|
|
||||||
return __acc_getopt_x(g, '?', 0, 1, "option '-%c' requires an argument", sc);
|
|
||||||
g->optind++, g->shortpos = 0;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
__acc_getopt_x(g, 0, -1, 1, NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return sc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#if defined(ACC_WANT_ACCLIB_HALLOC)
|
#if defined(ACC_WANT_ACCLIB_HALLOC)
|
||||||
# undef ACC_WANT_ACCLIB_HALLOC
|
# undef ACC_WANT_ACCLIB_HALLOC
|
||||||
#define __ACCLIB_HALLOC_CH_INCLUDED 1
|
#define __ACCLIB_HALLOC_CH_INCLUDED 1
|
||||||
@@ -6374,6 +6186,18 @@ ACCLIB_PUBLIC(int, acc_uclock_flush_cpu_cache) (acc_uclock_handle_p h, unsigned
|
|||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline r __ACCLIB_FUNCNAME(f)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
#if (ACC_OS_WIN32 && ACC_CC_PELLESC && (__POCC__ >= 290))
|
||||||
|
# pragma warn(push)
|
||||||
|
# pragma warn(disable:2007)
|
||||||
|
#endif
|
||||||
|
ACCLIB_PUBLIC(const char *, acc_getenv) (const char *s)
|
||||||
|
{
|
||||||
|
#if defined(HAVE_GETENV)
|
||||||
|
return getenv(s);
|
||||||
|
#else
|
||||||
|
ACC_UNUSED(s); return (const char *) 0;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
ACCLIB_PUBLIC(acclib_handle_t, acc_get_osfhandle) (int fd)
|
ACCLIB_PUBLIC(acclib_handle_t, acc_get_osfhandle) (int fd)
|
||||||
{
|
{
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
@@ -6561,9 +6385,10 @@ ACCLIB_PUBLIC(acc_uint32e_t, acc_muldiv32u) (acc_uint32e_t a, acc_uint32e_t b, a
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_OS_WIN32 && ACC_CC_PELLESC && (__POCC__ >= 290))
|
#if 0
|
||||||
# pragma warn(push)
|
ACCLIB_PUBLIC_NOINLINE(int, acc_syscall_clock_gettime) (int c)
|
||||||
# pragma warn(disable:2007)
|
{
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_OS_WIN16)
|
#if (ACC_OS_WIN16)
|
||||||
ACC_EXTERN_C void __far __pascal DebugBreak(void);
|
ACC_EXTERN_C void __far __pascal DebugBreak(void);
|
||||||
@@ -6641,13 +6466,27 @@ ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_enable) (int v)
|
|||||||
#endif
|
#endif
|
||||||
ACC_UNUSED(v); return r;
|
ACC_UNUSED(v); return r;
|
||||||
}
|
}
|
||||||
ACCLIB_PUBLIC_NOINLINE(int, acc_debug_running_on_valgrind) (void)
|
ACCLIB_PUBLIC_NOINLINE(unsigned, acc_debug_running_on_qemu) (void)
|
||||||
|
{
|
||||||
|
unsigned r = 0;
|
||||||
|
#if (ACC_OS_POSIX_LINUX || ACC_OS_WIN32 || ACC_OS_WIN64)
|
||||||
|
const char* p;
|
||||||
|
p = acc_getenv("ACC_ENV_RUNNING_ON_QEMU");
|
||||||
|
if (p) {
|
||||||
|
if (p[0] == 0) r = 0;
|
||||||
|
else if ((p[0] >= '0' && p[0] <= '9') && p[1] == 0) r = p[0] - '0';
|
||||||
|
else r = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
ACCLIB_PUBLIC_NOINLINE(unsigned, acc_debug_running_on_valgrind) (void)
|
||||||
{
|
{
|
||||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
||||||
volatile unsigned long args[5] = { 0x1001, 0, 0, 0, 0 };
|
volatile unsigned long args[5] = { 0x1001, 0, 0, 0, 0 };
|
||||||
long r = 0;
|
unsigned long r = 0;
|
||||||
__asm__ __volatile__(".byte 0xc1,0xc0,0x1d,0xc1,0xc0,0x03,0xc1,0xc8,0x1b,0xc1,0xc8,0x05,0xc1,0xc0,0x0d,0xc1,0xc0,0x13\n" : "=d" (r) : "a" (&args[0]), "d" (r) : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__(".byte 0xc1,0xc0,0x1d,0xc1,0xc0,0x03,0xc1,0xc8,0x1b,0xc1,0xc8,0x05,0xc1,0xc0,0x0d,0xc1,0xc0,0x13\n" : "=d" (r) : "a" (&args[0]), "d" (r) : __ACC_ASM_CLOBBER);
|
||||||
return (int) r;
|
return (unsigned) r;
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +45,11 @@ enum {
|
|||||||
struct options_t {
|
struct options_t {
|
||||||
int cmd;
|
int cmd;
|
||||||
|
|
||||||
|
// mp (meta) options
|
||||||
|
int mp_compress_task;
|
||||||
|
bool mp_query_format;
|
||||||
|
bool mp_query_num_tasks;
|
||||||
|
|
||||||
// compression options
|
// compression options
|
||||||
int method;
|
int method;
|
||||||
bool method_lzma_seen;
|
bool method_lzma_seen;
|
||||||
@@ -69,6 +74,9 @@ struct options_t {
|
|||||||
bool no_env;
|
bool no_env;
|
||||||
bool no_progress;
|
bool no_progress;
|
||||||
const char *output_name;
|
const char *output_name;
|
||||||
|
bool preserve_mode;
|
||||||
|
bool preserve_ownership;
|
||||||
|
bool preserve_timestamp;
|
||||||
int small;
|
int small;
|
||||||
int verbose;
|
int verbose;
|
||||||
bool to_stdout;
|
bool to_stdout;
|
||||||
@@ -126,7 +134,7 @@ struct options_t {
|
|||||||
bool boot_only;
|
bool boot_only;
|
||||||
bool no_align;
|
bool no_align;
|
||||||
bool do_8bit;
|
bool do_8bit;
|
||||||
bool do_8mb;
|
bool do_8mib;
|
||||||
} ps1_exe;
|
} ps1_exe;
|
||||||
struct {
|
struct {
|
||||||
unsigned blocksize;
|
unsigned blocksize;
|
||||||
|
|||||||
+13
-5
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -507,6 +507,10 @@ void PackArmPe::buildLoader(const Filter *ft)
|
|||||||
|
|
||||||
void PackArmPe::pack(OutputFile *fo)
|
void PackArmPe::pack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
|
// FIXME: we need to think about better support for --exact
|
||||||
|
if (opt->exact)
|
||||||
|
throwCantPackExact();
|
||||||
|
|
||||||
const unsigned objs = ih.objects;
|
const unsigned objs = ih.objects;
|
||||||
isection = new pe_section_t[objs];
|
isection = new pe_section_t[objs];
|
||||||
fi->seek(pe_offset+sizeof(ih),SEEK_SET);
|
fi->seek(pe_offset+sizeof(ih),SEEK_SET);
|
||||||
@@ -542,10 +546,12 @@ void PackArmPe::pack(OutputFile *fo)
|
|||||||
else if (opt->win32_pe.strip_relocs < 0)
|
else if (opt->win32_pe.strip_relocs < 0)
|
||||||
opt->win32_pe.strip_relocs = (ih.imagebase >= 0x10000);
|
opt->win32_pe.strip_relocs = (ih.imagebase >= 0x10000);
|
||||||
if (opt->win32_pe.strip_relocs)
|
if (opt->win32_pe.strip_relocs)
|
||||||
|
{
|
||||||
if (ih.imagebase < 0x10000)
|
if (ih.imagebase < 0x10000)
|
||||||
throwCantPack("--strip-relocs is not allowed when imagebase < 0x10000");
|
throwCantPack("--strip-relocs is not allowed when imagebase < 0x10000");
|
||||||
else
|
else
|
||||||
ih.flags |= RELOCS_STRIPPED;
|
ih.flags |= RELOCS_STRIPPED;
|
||||||
|
}
|
||||||
|
|
||||||
if (memcmp(isection[0].name,"UPX",3) == 0)
|
if (memcmp(isection[0].name,"UPX",3) == 0)
|
||||||
throwAlreadyPackedByUPX();
|
throwAlreadyPackedByUPX();
|
||||||
@@ -708,7 +714,7 @@ void PackArmPe::pack(OutputFile *fo)
|
|||||||
|
|
||||||
// limit stack size needed for runtime decompression
|
// limit stack size needed for runtime decompression
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
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, 2048, &cconf, filter_strategy,
|
compressWithFilters(&ft, 2048, &cconf, filter_strategy,
|
||||||
ih.codebase, rvamin, 0, NULL, 0);
|
ih.codebase, rvamin, 0, NULL, 0);
|
||||||
// info: see buildLoader()
|
// info: see buildLoader()
|
||||||
@@ -882,6 +888,8 @@ void PackArmPe::pack(OutputFile *fo)
|
|||||||
oh.codesize = osection[1].vsize;
|
oh.codesize = osection[1].vsize;
|
||||||
oh.codebase = osection[1].vaddr;
|
oh.codebase = osection[1].vaddr;
|
||||||
oh.headersize = osection[1].rawdataptr;
|
oh.headersize = osection[1].rawdataptr;
|
||||||
|
if (rvamin < osection[0].rawdataptr)
|
||||||
|
throwCantPack("object alignment too small");
|
||||||
|
|
||||||
if (opt->win32_pe.strip_relocs && !isdll)
|
if (opt->win32_pe.strip_relocs && !isdll)
|
||||||
oh.flags |= RELOCS_STRIPPED;
|
oh.flags |= RELOCS_STRIPPED;
|
||||||
@@ -890,7 +898,7 @@ void PackArmPe::pack(OutputFile *fo)
|
|||||||
// set_le32(ibuf + ic,get_le32("UPX "));
|
// set_le32(ibuf + ic,get_le32("UPX "));
|
||||||
ibuf.clear(0, oh.filealign);
|
ibuf.clear(0, oh.filealign);
|
||||||
|
|
||||||
info("Image size change: %u -> %u kBytes",
|
info("Image size change: %u -> %u KiB",
|
||||||
ih.imagesize / 1024, oh.imagesize / 1024);
|
ih.imagesize / 1024, oh.imagesize / 1024);
|
||||||
|
|
||||||
infoHeader("[Writing compressed file]");
|
infoHeader("[Writing compressed file]");
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ public:
|
|||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_DOS_COM; }
|
virtual int getFormat() const { return UPX_F_DOS_COM; }
|
||||||
virtual const char *getName() const { return "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 *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -303,7 +303,7 @@ void PackDjgpp2::pack(OutputFile *fo)
|
|||||||
// compress
|
// compress
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
// limit stack size needed for runtime decompression
|
// 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);
|
compressWithFilters(&ft, 512, &cconf);
|
||||||
|
|
||||||
// patch coff header #2
|
// patch coff header #2
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
virtual int getVersion() const { return 14; }
|
virtual int getVersion() const { return 14; }
|
||||||
virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
|
virtual int getFormat() const { return UPX_F_DJGPP2_COFF; }
|
||||||
virtual const char *getName() const { return "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 *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
|||||||
+13
-13
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -284,11 +284,11 @@ struct ElfClass_32
|
|||||||
{
|
{
|
||||||
typedef TP BeLePolicy;
|
typedef TP BeLePolicy;
|
||||||
|
|
||||||
// integral types
|
// integral types (target endianness)
|
||||||
typedef typename TP::U16 U16;
|
typedef typename TP::U16 TE16;
|
||||||
typedef typename TP::U32 U32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 U64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Elf::ElfITypes<U16, U32, U32, U32, U32> ElfITypes;
|
typedef N_Elf::ElfITypes<TE16, TE32, TE32, TE32, TE32> ElfITypes;
|
||||||
|
|
||||||
// ELF types
|
// ELF types
|
||||||
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
||||||
@@ -319,11 +319,11 @@ struct ElfClass_64
|
|||||||
{
|
{
|
||||||
typedef TP BeLePolicy;
|
typedef TP BeLePolicy;
|
||||||
|
|
||||||
// integral types
|
// integral types (target endianness)
|
||||||
typedef typename TP::U16 U16;
|
typedef typename TP::U16 TE16;
|
||||||
typedef typename TP::U32 U32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 U64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Elf::ElfITypes<U16, U32, U64, U64, U64> ElfITypes;
|
typedef N_Elf::ElfITypes<TE16, TE32, TE64, TE64, TE64> ElfITypes;
|
||||||
|
|
||||||
// ELF types
|
// ELF types
|
||||||
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
typedef N_Elf ::Ehdr<ElfITypes> Ehdr;
|
||||||
|
|||||||
+11
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -68,10 +68,13 @@
|
|||||||
};
|
};
|
||||||
enum { // e_machine
|
enum { // e_machine
|
||||||
EM_386 = 3,
|
EM_386 = 3,
|
||||||
|
EM_MIPS = 8,
|
||||||
|
EM_MIPS_RS3_LE = 10, /* MIPS R3000 little-endian */
|
||||||
EM_PPC = 20,
|
EM_PPC = 20,
|
||||||
EM_PPC64 = 21,
|
EM_PPC64 = 21,
|
||||||
EM_ARM = 40,
|
EM_ARM = 40,
|
||||||
EM_X86_64 = 62
|
EM_X86_64 = 62
|
||||||
|
|
||||||
};
|
};
|
||||||
enum { // e_version
|
enum { // e_version
|
||||||
EV_CURRENT = 1
|
EV_CURRENT = 1
|
||||||
@@ -138,10 +141,14 @@
|
|||||||
enum { // d_tag
|
enum { // d_tag
|
||||||
DT_NULL = 0, /* End flag */
|
DT_NULL = 0, /* End flag */
|
||||||
DT_NEEDED = 1, /* Name of needed library */
|
DT_NEEDED = 1, /* Name of needed library */
|
||||||
|
DT_PLTRELSZ = 2, /* Size in bytes of PLT relocs */
|
||||||
DT_HASH = 4, /* Hash table of symbol names */
|
DT_HASH = 4, /* Hash table of symbol names */
|
||||||
DT_STRTAB = 5, /* String table */
|
DT_STRTAB = 5, /* String table */
|
||||||
DT_SYMTAB = 6, /* Symbol table */
|
DT_SYMTAB = 6, /* Symbol table */
|
||||||
DT_STRSZ = 10 /* Sizeof string table */
|
DT_STRSZ = 10, /* Sizeof string table */
|
||||||
|
DT_PLTREL = 20, /* Type of reloc in PLT */
|
||||||
|
DT_JMPREL = 23, /* Address of PLT relocs */
|
||||||
|
DT_GNU_HASH = 0x6ffffef5 /* GNU-style hash table */
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -478,7 +478,7 @@ void PackExe::pack(OutputFile *fo)
|
|||||||
for (ic = 0; ic < ih.relocs; ic++)
|
for (ic = 0; ic < ih.relocs; ic++)
|
||||||
{
|
{
|
||||||
unsigned jc = get_le32(wr+4*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);
|
qsort(wr,ih.relocs,4,le32_compare);
|
||||||
relocsize = optimize_relocs(ibuf, ih_imagesize, wr, ih.relocs, w, &has_9a);
|
relocsize = optimize_relocs(ibuf, ih_imagesize, wr, ih.relocs, w, &has_9a);
|
||||||
@@ -506,7 +506,7 @@ void PackExe::pack(OutputFile *fo)
|
|||||||
// compress (max_match = 8192)
|
// compress (max_match = 8192)
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
cconf.conf_ucl.max_match = MAXMATCH;
|
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);
|
compressWithFilters(&ft, 32, &cconf);
|
||||||
|
|
||||||
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
|
if (M_IS_NRV2B(ph.method) || M_IS_NRV2D(ph.method) || M_IS_NRV2E(ph.method))
|
||||||
|
|||||||
+5
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ public:
|
|||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_DOS_EXE; }
|
virtual int getFormat() const { return UPX_F_DOS_EXE; }
|
||||||
virtual const char *getName() const { return "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 *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
|||||||
+630
-267
File diff suppressed because it is too large
Load Diff
+62
-25
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -70,6 +70,8 @@ protected:
|
|||||||
unsigned sz_phdrs; // sizeof Phdr[]
|
unsigned sz_phdrs; // sizeof Phdr[]
|
||||||
unsigned sz_elf_hdrs; // all Elf headers
|
unsigned sz_elf_hdrs; // all Elf headers
|
||||||
unsigned sz_pack2; // after pack2(), before loader
|
unsigned sz_pack2; // after pack2(), before loader
|
||||||
|
unsigned lg2_page; // log2(PAGE_SIZE)
|
||||||
|
unsigned page_size; // 1u<<lg2_page
|
||||||
|
|
||||||
unsigned short e_machine;
|
unsigned short e_machine;
|
||||||
unsigned char ei_class;
|
unsigned char ei_class;
|
||||||
@@ -119,17 +121,29 @@ protected:
|
|||||||
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
|
virtual off_t getbase(const Elf32_Phdr *phdr, int e_phnum) const;
|
||||||
|
|
||||||
static unsigned elf_hash(char const *) /*const*/;
|
static unsigned elf_hash(char const *) /*const*/;
|
||||||
|
static unsigned gnu_hash(char const *) /*const*/;
|
||||||
virtual void const *elf_find_dynamic(unsigned) const;
|
virtual void const *elf_find_dynamic(unsigned) const;
|
||||||
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
virtual Elf32_Sym const *elf_lookup(char const *) const;
|
||||||
virtual unsigned elf_get_offset_from_address(unsigned) const;
|
virtual unsigned elf_get_offset_from_address(unsigned) const;
|
||||||
|
Elf32_Shdr const *elf_find_section_name(char const *) const;
|
||||||
|
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Elf32_Ehdr ehdri; // from input file
|
Elf32_Ehdr ehdri; // from input file
|
||||||
Elf32_Phdr *phdri; // for input file
|
Elf32_Phdr *phdri; // for input file
|
||||||
|
Elf32_Shdr const *shdri; // from input file
|
||||||
|
unsigned page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
Elf32_Dyn const *dynseg; // from PT_DYNAMIC
|
Elf32_Dyn const *dynseg; // from PT_DYNAMIC
|
||||||
unsigned int const *hashtab; // from DT_HASH
|
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 *dynsym; // from DT_SYMTAB
|
||||||
|
char const *shstrtab; // via Elf32_Shdr
|
||||||
|
int n_elf_shnum; // via e_shnum
|
||||||
|
|
||||||
|
Elf32_Shdr const *sec_strndx;
|
||||||
|
Elf32_Shdr const *sec_dynsym;
|
||||||
|
Elf32_Shdr const *sec_dynstr;
|
||||||
|
|
||||||
struct cprElfHdr1 {
|
struct cprElfHdr1 {
|
||||||
Elf32_Ehdr ehdr;
|
Elf32_Ehdr ehdr;
|
||||||
@@ -211,6 +225,7 @@ protected:
|
|||||||
protected:
|
protected:
|
||||||
Elf64_Ehdr ehdri; // from input file
|
Elf64_Ehdr ehdri; // from input file
|
||||||
Elf64_Phdr *phdri; // for input file
|
Elf64_Phdr *phdri; // for input file
|
||||||
|
acc_uint64l_t page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
struct cprElfHdr1 {
|
struct cprElfHdr1 {
|
||||||
Elf64_Ehdr ehdr;
|
Elf64_Ehdr ehdr;
|
||||||
@@ -250,13 +265,6 @@ class PackLinuxElf32Be : public PackLinuxElf32
|
|||||||
typedef PackLinuxElf32 super;
|
typedef PackLinuxElf32 super;
|
||||||
protected:
|
protected:
|
||||||
PackLinuxElf32Be(InputFile *f) : super(f) { bele = &N_BELE_RTP::be_policy; }
|
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); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackLinuxElf32Le : public PackLinuxElf32
|
class PackLinuxElf32Le : public PackLinuxElf32
|
||||||
@@ -264,13 +272,6 @@ class PackLinuxElf32Le : public PackLinuxElf32
|
|||||||
typedef PackLinuxElf32 super;
|
typedef PackLinuxElf32 super;
|
||||||
protected:
|
protected:
|
||||||
PackLinuxElf32Le(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; }
|
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); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackLinuxElf64Le : public PackLinuxElf64
|
class PackLinuxElf64Le : public PackLinuxElf64
|
||||||
@@ -278,15 +279,9 @@ class PackLinuxElf64Le : public PackLinuxElf64
|
|||||||
typedef PackLinuxElf64 super;
|
typedef PackLinuxElf64 super;
|
||||||
protected:
|
protected:
|
||||||
PackLinuxElf64Le(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; }
|
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); }
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// linux/elf64amd
|
// linux/elf64amd
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -310,6 +305,7 @@ protected:
|
|||||||
virtual void defineSymbols(Filter const *);
|
virtual void defineSymbols(Filter const *);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// linux/elf32ppc
|
// linux/elf32ppc
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -330,6 +326,7 @@ protected:
|
|||||||
virtual Linker* newLinker() const;
|
virtual Linker* newLinker() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// linux/elf386
|
// linux/elf386
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -406,6 +403,7 @@ protected:
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// linux/elfarm
|
// linux/elfarm
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -450,6 +448,45 @@ protected:
|
|||||||
virtual void defineSymbols(Filter const *);
|
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/mipseb"; }
|
||||||
|
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 */
|
#endif /*} already included */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2001-2007 John F. Reiser
|
Copyright (C) 2001-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -526,22 +526,22 @@ bool PackLinuxI386::canPack()
|
|||||||
ei_osabi = osabi0; // Proudly declares its osabi in Ehdr.
|
ei_osabi = osabi0; // Proudly declares its osabi in Ehdr.
|
||||||
break;
|
break;
|
||||||
default:
|
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))) {
|
if (e_phnum<=(512/sizeof(Elf32_Phdr))) {
|
||||||
char buf2[512];
|
char buf2[512];
|
||||||
fi->seek(get_native32(&ehdr.e_phoff), SEEK_SET);
|
fi->seek(get_te32(&ehdr.e_phoff), SEEK_SET);
|
||||||
fi->readx(buf2, sizeof(buf2));
|
fi->readx(buf2, sizeof(buf2));
|
||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
Elf32_Phdr const *phdr = (Elf32_Phdr const *)buf2;
|
Elf32_Phdr const *phdr = (Elf32_Phdr const *)buf2;
|
||||||
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
|
for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
|
||||||
if (phdr->PT_NOTE == get_native32(&phdr->p_type)) {
|
if (phdr->PT_NOTE == get_te32(&phdr->p_type)) {
|
||||||
unsigned const offset = get_native32(&phdr->p_offset);
|
unsigned const offset = get_te32(&phdr->p_offset);
|
||||||
struct Elf32_Note note; memset(¬e, 0, sizeof(note));
|
struct Elf32_Note note; memset(¬e, 0, sizeof(note));
|
||||||
fi->seek(offset, SEEK_SET);
|
fi->seek(offset, SEEK_SET);
|
||||||
fi->readx(¬e, sizeof(note));
|
fi->readx(¬e, sizeof(note));
|
||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
if (4==get_native32(¬e.descsz)
|
if (4==get_te32(¬e.descsz)
|
||||||
&& 1==get_native32(¬e.type)
|
&& 1==get_te32(¬e.type)
|
||||||
&& 0==note.end ) {
|
&& 0==note.end ) {
|
||||||
if (0==strcmp("NetBSD", (char const *)¬e.text)) {
|
if (0==strcmp("NetBSD", (char const *)¬e.text)) {
|
||||||
ei_osabi = Elf32_Ehdr::ELFOSABI_NETBSD;
|
ei_osabi = Elf32_Ehdr::ELFOSABI_NETBSD;
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -138,7 +138,7 @@ class PackBSDI386 : public PackLinuxI386
|
|||||||
public:
|
public:
|
||||||
PackBSDI386(InputFile *f);
|
PackBSDI386(InputFile *f);
|
||||||
virtual int getFormat() const { return UPX_F_BSD_i386; }
|
virtual int getFormat() const { return UPX_F_BSD_i386; }
|
||||||
virtual const char *getName() const { return "*BSD/386"; }
|
virtual const char *getName() const { return "BSD/386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-bsd.elf.execve"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-bsd.elf.execve"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+10
-10
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -205,7 +205,7 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
|
|||||||
{
|
{
|
||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
fi->readx(bufehdr, MAX_INTERP_HDR);
|
fi->readx(bufehdr, MAX_INTERP_HDR);
|
||||||
unsigned const e_entry = get_native32(&ehdr->e_entry);
|
unsigned const e_entry = get_te32(&ehdr->e_entry);
|
||||||
if (e_entry < 0x401180) { /* old style, 8-byte b_info */
|
if (e_entry < 0x401180) { /* old style, 8-byte b_info */
|
||||||
szb_info = 2*sizeof(unsigned);
|
szb_info = 2*sizeof(unsigned);
|
||||||
}
|
}
|
||||||
@@ -214,16 +214,16 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
|
|||||||
fi->seek(overlay_offset, SEEK_SET);
|
fi->seek(overlay_offset, SEEK_SET);
|
||||||
p_info hbuf;
|
p_info hbuf;
|
||||||
fi->readx(&hbuf, sizeof(hbuf));
|
fi->readx(&hbuf, sizeof(hbuf));
|
||||||
unsigned orig_file_size = get_native32(&hbuf.p_filesize);
|
unsigned orig_file_size = get_te32(&hbuf.p_filesize);
|
||||||
blocksize = get_native32(&hbuf.p_blocksize);
|
blocksize = get_te32(&hbuf.p_blocksize);
|
||||||
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
|
|
||||||
ibuf.alloc(blocksize + OVERHEAD);
|
ibuf.alloc(blocksize + OVERHEAD);
|
||||||
b_info bhdr; memset(&bhdr, 0, sizeof(bhdr));
|
b_info bhdr; memset(&bhdr, 0, sizeof(bhdr));
|
||||||
fi->readx(&bhdr, szb_info);
|
fi->readx(&bhdr, szb_info);
|
||||||
ph.u_len = get_native32(&bhdr.sz_unc);
|
ph.u_len = get_te32(&bhdr.sz_unc);
|
||||||
ph.c_len = get_native32(&bhdr.sz_cpr);
|
ph.c_len = get_te32(&bhdr.sz_cpr);
|
||||||
ph.filter_cto = bhdr.b_cto8;
|
ph.filter_cto = bhdr.b_cto8;
|
||||||
|
|
||||||
// Uncompress Ehdr and Phdrs.
|
// Uncompress Ehdr and Phdrs.
|
||||||
@@ -277,7 +277,7 @@ void PackLinuxElf32x86interp::unpack(OutputFile *fo)
|
|||||||
|
|
||||||
// check for end-of-file
|
// check for end-of-file
|
||||||
fi->readx(&bhdr, szb_info);
|
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
|
if (sz_unc == 0) { // uncompressed size 0 -> EOF
|
||||||
// note: magic is always stored le32
|
// note: magic is always stored le32
|
||||||
|
|||||||
+4
-4
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
|
|||||||
+5
-5
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
@@ -91,7 +91,7 @@ PackLinuxI386sh::buildLoader(Filter const *ft)
|
|||||||
// filter
|
// filter
|
||||||
optimizeFilter(&fold_ft, buf, sz_fold);
|
optimizeFilter(&fold_ft, buf, sz_fold);
|
||||||
unsigned fold_hdrlen = sizeof(l_info) + sizeof(Elf32_Ehdr) +
|
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)) {
|
if (0 == get_le32(fold_hdrlen + buf)) {
|
||||||
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
|
// inconsistent SIZEOF_HEADERS in *.lds (ld, binutils)
|
||||||
fold_hdrlen = umax(0x80, fold_hdrlen);
|
fold_hdrlen = umax(0x80, fold_hdrlen);
|
||||||
|
|||||||
+4
-4
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2000-2007 John F. Reiser
|
Copyright (C) 2000-2008 John F. Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John F. Reiser
|
John F. Reiser
|
||||||
<jreiser@users.sourceforge.net>
|
<jreiser@users.sourceforge.net>
|
||||||
|
|||||||
+8
-6
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2004-2007 John Reiser
|
Copyright (C) 2004-2008 John Reiser
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
John Reiser
|
John Reiser
|
||||||
jreiser@users.sourceforge.net
|
<jreiser@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -104,6 +104,8 @@ PackMachBase<T>::addStubEntrySections(Filter const *)
|
|||||||
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
: M_IS_NRV2B(ph.method) ? "NRV_HEAD,NRV2B,NRV_TAIL"
|
||||||
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
|
: M_IS_LZMA(ph.method) ? "LZMA_ELF00,LZMA_DEC20,LZMA_DEC30"
|
||||||
: NULL), NULL);
|
: NULL), NULL);
|
||||||
|
if (hasLoaderSection("CFLUSH"))
|
||||||
|
addLoader("CFLUSH");
|
||||||
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
addLoader("ELFMAINY,IDENTSTR,+40,ELFMAINZ,FOLDEXEC", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -520,16 +522,16 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
fi->seek(overlay_offset, SEEK_SET);
|
fi->seek(overlay_offset, SEEK_SET);
|
||||||
p_info hbuf;
|
p_info hbuf;
|
||||||
fi->readx(&hbuf, sizeof(hbuf));
|
fi->readx(&hbuf, sizeof(hbuf));
|
||||||
unsigned orig_file_size = get_native32(&hbuf.p_filesize);
|
unsigned orig_file_size = get_te32(&hbuf.p_filesize);
|
||||||
blocksize = get_native32(&hbuf.p_blocksize);
|
blocksize = get_te32(&hbuf.p_blocksize);
|
||||||
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
|
|
||||||
ibuf.alloc(blocksize + OVERHEAD);
|
ibuf.alloc(blocksize + OVERHEAD);
|
||||||
b_info bhdr; memset(&bhdr, 0, sizeof(bhdr));
|
b_info bhdr; memset(&bhdr, 0, sizeof(bhdr));
|
||||||
fi->readx(&bhdr, sizeof(bhdr));
|
fi->readx(&bhdr, sizeof(bhdr));
|
||||||
ph.u_len = get_native32(&bhdr.sz_unc);
|
ph.u_len = get_te32(&bhdr.sz_unc);
|
||||||
ph.c_len = get_native32(&bhdr.sz_cpr);
|
ph.c_len = get_te32(&bhdr.sz_cpr);
|
||||||
ph.method = bhdr.b_method;
|
ph.method = bhdr.b_method;
|
||||||
ph.filter = bhdr.b_ftid;
|
ph.filter = bhdr.b_ftid;
|
||||||
ph.filter_cto = bhdr.b_cto8;
|
ph.filter_cto = bhdr.b_cto8;
|
||||||
|
|||||||
+35
-39
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -236,13 +236,13 @@ struct MachClass_32
|
|||||||
{
|
{
|
||||||
typedef TP BeLePolicy;
|
typedef TP BeLePolicy;
|
||||||
|
|
||||||
// integral types
|
// integral types (target endianness)
|
||||||
typedef typename TP::U16 U16;
|
typedef typename TP::U16 TE16;
|
||||||
typedef typename TP::U32 U32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 U64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Mach::MachITypes<U32, U64, U32, U32> MachITypes;
|
typedef N_Mach::MachITypes<TE32, TE64, TE32, TE32> MachITypes;
|
||||||
#if (ACC_CC_BORLANDC)
|
#if (ACC_CC_BORLANDC)
|
||||||
typedef U32 Addr;
|
typedef TE32 Addr;
|
||||||
#else
|
#else
|
||||||
typedef typename MachITypes::Addr Addr;
|
typedef typename MachITypes::Addr Addr;
|
||||||
#endif
|
#endif
|
||||||
@@ -265,11 +265,11 @@ struct MachClass_64
|
|||||||
{
|
{
|
||||||
typedef TP BeLePolicy;
|
typedef TP BeLePolicy;
|
||||||
|
|
||||||
// integral types
|
// integral types (target endianness)
|
||||||
typedef typename TP::U16 U16;
|
typedef typename TP::U16 TE16;
|
||||||
typedef typename TP::U32 U32;
|
typedef typename TP::U32 TE32;
|
||||||
typedef typename TP::U64 U64;
|
typedef typename TP::U64 TE64;
|
||||||
typedef N_Mach::MachITypes<U32, U64, U64, U64> MachITypes;
|
typedef N_Mach::MachITypes<TE32, TE64, TE64, TE64> MachITypes;
|
||||||
|
|
||||||
// Mach types
|
// Mach types
|
||||||
typedef N_Mach::Mach_header64<MachITypes> Mach_header;
|
typedef N_Mach::Mach_header64<MachITypes> Mach_header;
|
||||||
@@ -322,10 +322,10 @@ protected:
|
|||||||
typedef TMachClass MachClass;
|
typedef TMachClass MachClass;
|
||||||
typedef typename MachClass::BeLePolicy BeLePolicy;
|
typedef typename MachClass::BeLePolicy BeLePolicy;
|
||||||
typedef typename MachClass::MachITypes MachITypes;
|
typedef typename MachClass::MachITypes MachITypes;
|
||||||
// integral types
|
// integral types (target endianness)
|
||||||
typedef typename MachClass::U16 U16;
|
typedef typename MachClass::TE16 TE16;
|
||||||
typedef typename MachClass::U32 U32;
|
typedef typename MachClass::TE32 TE32;
|
||||||
typedef typename MachClass::U64 U64;
|
typedef typename MachClass::TE64 TE64;
|
||||||
typedef typename MachClass::Addr Addr;
|
typedef typename MachClass::Addr Addr;
|
||||||
// Mach types
|
// Mach types
|
||||||
typedef typename MachClass::Mach_header Mach_header;
|
typedef typename MachClass::Mach_header Mach_header;
|
||||||
@@ -381,8 +381,8 @@ protected:
|
|||||||
Mach_segment_command segcmdo;
|
Mach_segment_command segcmdo;
|
||||||
|
|
||||||
struct b_info { // 12-byte header before each compressed block
|
struct b_info { // 12-byte header before each compressed block
|
||||||
U32 sz_unc; // uncompressed_size
|
TE32 sz_unc; // uncompressed_size
|
||||||
U32 sz_cpr; // compressed_size
|
TE32 sz_cpr; // compressed_size
|
||||||
unsigned char b_method; // compression algorithm
|
unsigned char b_method; // compression algorithm
|
||||||
unsigned char b_ftid; // filter id
|
unsigned char b_ftid; // filter id
|
||||||
unsigned char b_cto8; // filter parameter
|
unsigned char b_cto8; // filter parameter
|
||||||
@@ -390,22 +390,32 @@ protected:
|
|||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
struct l_info { // 12-byte trailer in header for loader
|
struct l_info { // 12-byte trailer in header for loader
|
||||||
U32 l_checksum;
|
TE32 l_checksum;
|
||||||
LE32 l_magic;
|
LE32 l_magic;
|
||||||
U16 l_lsize;
|
TE16 l_lsize;
|
||||||
unsigned char l_version;
|
unsigned char l_version;
|
||||||
unsigned char l_format;
|
unsigned char l_format;
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
struct p_info { // 12-byte packed program header
|
struct p_info { // 12-byte packed program header
|
||||||
U32 p_progid;
|
TE32 p_progid;
|
||||||
U32 p_filesize;
|
TE32 p_filesize;
|
||||||
U32 p_blocksize;
|
TE32 p_blocksize;
|
||||||
}
|
}
|
||||||
__attribute_packed;
|
__attribute_packed;
|
||||||
|
|
||||||
struct l_info linfo;
|
struct l_info linfo;
|
||||||
|
|
||||||
|
static void compileTimeAssertions() {
|
||||||
|
MachClass::compileTimeAssertions();
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(b_info) == 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(l_info) == 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(p_info) == 12)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(b_info)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(l_info)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(p_info)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -422,13 +432,6 @@ public:
|
|||||||
virtual const char *getName() const { return "Mach/ppc32"; }
|
virtual const char *getName() const { return "Mach/ppc32"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.macho"; }
|
virtual const char *getFullName(const options_t *) const { return "powerpc-darwin.macho"; }
|
||||||
|
|
||||||
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); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
@@ -467,13 +470,6 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
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); }
|
|
||||||
|
|
||||||
virtual void pack1_setup_threado(OutputFile *const fo);
|
virtual void pack1_setup_threado(OutputFile *const fo);
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
virtual void pack4(OutputFile *, Filter &); // append PackHeader
|
||||||
|
|||||||
+14
-8
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2002-2007 Jens Medoch
|
Copyright (C) 2002-2008 Jens Medoch
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
Jens Medoch
|
Jens Medoch
|
||||||
<jssg@users.sourceforge.net>
|
<jssg@users.sourceforge.net>
|
||||||
@@ -95,7 +95,7 @@ PackPs1::PackPs1(InputFile *f) :
|
|||||||
COMPILE_TIME_ASSERT(SZ_IH_BKUP == 40)
|
COMPILE_TIME_ASSERT(SZ_IH_BKUP == 40)
|
||||||
|
|
||||||
fdata_size = file_size - PS_HDR_SIZE;
|
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
|
const int *PackPs1::getCompressionMethods(int method, int level) const
|
||||||
@@ -194,6 +194,8 @@ bool PackPs1::getBkupHeader(unsigned char *p, unsigned char *dst)
|
|||||||
unsigned sz_bh = SZ_IH_BKUP;
|
unsigned sz_bh = SZ_IH_BKUP;
|
||||||
int r = upx_decompress((const unsigned char *)&src->ih_bkup, src->len,
|
int r = upx_decompress((const unsigned char *)&src->ih_bkup, src->len,
|
||||||
unc_bh, &sz_bh, M_NRV2E_8, NULL );
|
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)
|
if (r != UPX_E_OK || sz_bh != SZ_IH_BKUP)
|
||||||
throwInternalError("header decompression failed");
|
throwInternalError("header decompression failed");
|
||||||
unsigned ad = upx_adler32(unc_bh, SZ_IH_BKUP);
|
unsigned ad = upx_adler32(unc_bh, SZ_IH_BKUP);
|
||||||
@@ -254,8 +256,9 @@ bool PackPs1::canPack()
|
|||||||
fi->readx(buf, sizeof(buf));
|
fi->readx(buf, sizeof(buf));
|
||||||
checkAlreadyPacked(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 (buf[i] != 0)
|
||||||
|
{
|
||||||
if (!opt->force)
|
if (!opt->force)
|
||||||
throwCantPack("unknown data in header (try --force)");
|
throwCantPack("unknown data in header (try --force)");
|
||||||
else
|
else
|
||||||
@@ -265,6 +268,7 @@ bool PackPs1::canPack()
|
|||||||
opt->backup = 1;
|
opt->backup = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (!checkFileHeader())
|
if (!checkFileHeader())
|
||||||
throwCantPack("unsupported header flags (try --force)");
|
throwCantPack("unsupported header flags (try --force)");
|
||||||
if (!opt->force && file_size < PS_MIN_SIZE)
|
if (!opt->force && file_size < PS_MIN_SIZE)
|
||||||
@@ -318,7 +322,7 @@ void PackPs1::buildLoader(const Filter *)
|
|||||||
sa_tmp += overlap = ALIGN_UP((ph.overlap_overhead - sa_tmp), 4u);
|
sa_tmp += overlap = ALIGN_UP((ph.overlap_overhead - sa_tmp), 4u);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCon || !isCon && M_IS_LZMA(ph.method))
|
if (isCon || M_IS_LZMA(ph.method))
|
||||||
foundBss = findBssSection();
|
foundBss = findBssSection();
|
||||||
|
|
||||||
if (M_IS_LZMA(ph.method) && !buildPart2)
|
if (M_IS_LZMA(ph.method) && !buildPart2)
|
||||||
@@ -496,7 +500,7 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
// compress (max_match = 65535)
|
// compress (max_match = 65535)
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
cconf.conf_ucl.max_match = 65535;
|
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);
|
compressWithFilters(&ft, sa_cnt, &cconf);
|
||||||
|
|
||||||
if (overlap)
|
if (overlap)
|
||||||
@@ -572,11 +576,13 @@ void PackPs1::pack(OutputFile *fo)
|
|||||||
linker->defineSymbol("ldr_sz", M_IS_LZMA(ph.method) ? sz_lunc + 16 : (d_len-pad_code));
|
linker->defineSymbol("ldr_sz", M_IS_LZMA(ph.method) ? sz_lunc + 16 : (d_len-pad_code));
|
||||||
|
|
||||||
if (foundBss)
|
if (foundBss)
|
||||||
|
{
|
||||||
if (M_IS_LZMA(ph.method))
|
if (M_IS_LZMA(ph.method))
|
||||||
linker->defineSymbol("wrkmem", bss_end - 160 - getDecompressorWrkmemSize()
|
linker->defineSymbol("wrkmem", bss_end - 160 - getDecompressorWrkmemSize()
|
||||||
- (sz_lunc + 16));
|
- (sz_lunc + 16));
|
||||||
else
|
else
|
||||||
linker->defineSymbol("wrkmem", bss_end - 16 - (d_len - pad_code));
|
linker->defineSymbol("wrkmem", bss_end - 16 - (d_len - pad_code));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const unsigned entry = comp_data_start - e_len;
|
const unsigned entry = comp_data_start - e_len;
|
||||||
|
|||||||
+4
-4
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
Copyright (C) 2002-2007 Jens Medoch
|
Copyright (C) 2002-2008 Jens Medoch
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
Jens Medoch
|
Jens Medoch
|
||||||
<jssg@users.sourceforge.net>
|
<jssg@users.sourceforge.net>
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ public:
|
|||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_DOS_SYS; }
|
virtual int getFormat() const { return UPX_F_DOS_SYS; }
|
||||||
virtual const char *getName() const { return "dos/sys"; }
|
virtual const char *getName() const { return "dos/sys"; }
|
||||||
virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.sys" : "i286-dos16.sys"; }
|
//virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_8086 ? "i086-dos16.sys" : "i286-dos16.sys"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "i086-dos16.sys"; }
|
||||||
|
|
||||||
virtual bool canPack();
|
virtual bool canPack();
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -242,7 +242,7 @@ void PackTmt::pack(OutputFile *fo)
|
|||||||
// compress
|
// compress
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
// limit stack size needed for runtime decompression
|
// 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);
|
compressWithFilters(&ft, 512, &cconf);
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_TMT_ADAM; }
|
virtual int getFormat() const { return UPX_F_TMT_ADAM; }
|
||||||
virtual const char *getName() const { return "tmt/adam"; }
|
virtual const char *getName() const { return "tmt/adam"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-dos32.tmt"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-dos32.tmt.adam"; }
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -507,7 +507,7 @@ void PackTos::pack(OutputFile *fo)
|
|||||||
// compress (max_match = 65535)
|
// compress (max_match = 65535)
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
cconf.conf_ucl.max_match = 65535;
|
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, 512, &cconf);
|
compressWithFilters(&ft, 512, &cconf);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+23
-23
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -191,8 +191,8 @@ void PackUnix::pack2(OutputFile *fo, Filter &ft)
|
|||||||
// write block header
|
// write block header
|
||||||
b_info blk_info;
|
b_info blk_info;
|
||||||
memset(&blk_info, 0, sizeof(blk_info));
|
memset(&blk_info, 0, sizeof(blk_info));
|
||||||
set_native32(&blk_info.sz_unc, ph.u_len);
|
set_te32(&blk_info.sz_unc, ph.u_len);
|
||||||
set_native32(&blk_info.sz_cpr, ph.c_len);
|
set_te32(&blk_info.sz_cpr, ph.c_len);
|
||||||
if (ph.c_len < ph.u_len) {
|
if (ph.c_len < ph.u_len) {
|
||||||
blk_info.b_method = (unsigned char) ph.method;
|
blk_info.b_method = (unsigned char) ph.method;
|
||||||
blk_info.b_ftid = (unsigned char) ph.filter;
|
blk_info.b_ftid = (unsigned char) ph.filter;
|
||||||
@@ -252,7 +252,7 @@ void PackUnix::pack4(OutputFile *fo, Filter &)
|
|||||||
writePackHeader(fo);
|
writePackHeader(fo);
|
||||||
|
|
||||||
unsigned tmp;
|
unsigned tmp;
|
||||||
set_native32(&tmp, overlay_offset);
|
set_te32(&tmp, overlay_offset);
|
||||||
fo->write(&tmp, sizeof(tmp));
|
fo->write(&tmp, sizeof(tmp));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,9 +278,9 @@ void PackUnix::pack(OutputFile *fo)
|
|||||||
pack1(fo, ft); // generate Elf header, etc.
|
pack1(fo, ft); // generate Elf header, etc.
|
||||||
|
|
||||||
p_info hbuf;
|
p_info hbuf;
|
||||||
set_native32(&hbuf.p_progid, progid);
|
set_te32(&hbuf.p_progid, progid);
|
||||||
set_native32(&hbuf.p_filesize, file_size);
|
set_te32(&hbuf.p_filesize, file_size);
|
||||||
set_native32(&hbuf.p_blocksize, blocksize);
|
set_te32(&hbuf.p_blocksize, blocksize);
|
||||||
fo->write(&hbuf, sizeof(hbuf));
|
fo->write(&hbuf, sizeof(hbuf));
|
||||||
|
|
||||||
pack2(fo, ft); // append the compressed body
|
pack2(fo, ft); // append the compressed body
|
||||||
@@ -389,8 +389,8 @@ void PackUnix::packExtent(
|
|||||||
ph.c_adler = upx_adler32(obuf, ph.c_len, ph.saved_c_adler);
|
ph.c_adler = upx_adler32(obuf, ph.c_len, ph.saved_c_adler);
|
||||||
end_u_adler = ph.u_adler;
|
end_u_adler = ph.u_adler;
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
set_native32(&tmp.sz_unc, hdr_u_len);
|
set_te32(&tmp.sz_unc, hdr_u_len);
|
||||||
set_native32(&tmp.sz_cpr, hdr_c_len);
|
set_te32(&tmp.sz_cpr, hdr_c_len);
|
||||||
tmp.b_method = (unsigned char) ph.method;
|
tmp.b_method = (unsigned char) ph.method;
|
||||||
fo->write(&tmp, sizeof(tmp));
|
fo->write(&tmp, sizeof(tmp));
|
||||||
b_len += sizeof(b_info);
|
b_len += sizeof(b_info);
|
||||||
@@ -400,8 +400,8 @@ void PackUnix::packExtent(
|
|||||||
hdr_u_len = 0; // compress hdr one time only
|
hdr_u_len = 0; // compress hdr one time only
|
||||||
}
|
}
|
||||||
memset(&tmp, 0, sizeof(tmp));
|
memset(&tmp, 0, sizeof(tmp));
|
||||||
set_native32(&tmp.sz_unc, ph.u_len);
|
set_te32(&tmp.sz_unc, ph.u_len);
|
||||||
set_native32(&tmp.sz_cpr, ph.c_len);
|
set_te32(&tmp.sz_cpr, ph.c_len);
|
||||||
if (ph.c_len < ph.u_len) {
|
if (ph.c_len < ph.u_len) {
|
||||||
tmp.b_method = (unsigned char) ph.method;
|
tmp.b_method = (unsigned char) ph.method;
|
||||||
if (ft) {
|
if (ft) {
|
||||||
@@ -439,8 +439,8 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
|
|||||||
b_info hdr; memset(&hdr, 0, sizeof(hdr));
|
b_info hdr; memset(&hdr, 0, sizeof(hdr));
|
||||||
while (wanted) {
|
while (wanted) {
|
||||||
fi->readx(&hdr, szb_info);
|
fi->readx(&hdr, szb_info);
|
||||||
int const sz_unc = ph.u_len = get_native32(&hdr.sz_unc);
|
int const sz_unc = ph.u_len = get_te32(&hdr.sz_unc);
|
||||||
int const sz_cpr = ph.c_len = get_native32(&hdr.sz_cpr);
|
int const sz_cpr = ph.c_len = get_te32(&hdr.sz_cpr);
|
||||||
ph.filter_cto = hdr.b_cto8;
|
ph.filter_cto = hdr.b_cto8;
|
||||||
|
|
||||||
if (sz_unc == 0) { // must never happen while 0!=wanted
|
if (sz_unc == 0) { // must never happen while 0!=wanted
|
||||||
@@ -509,7 +509,7 @@ int PackUnix::canUnpack()
|
|||||||
int l = ph.buf_offset + ph.getPackHeaderSize();
|
int l = ph.buf_offset + ph.getPackHeaderSize();
|
||||||
if (l < 0 || l + 4 > bufsize)
|
if (l < 0 || l + 4 > bufsize)
|
||||||
throwCantUnpack("file corrupted");
|
throwCantUnpack("file corrupted");
|
||||||
overlay_offset = get_native32(buf+l);
|
overlay_offset = get_te32(buf+l);
|
||||||
if ((off_t)overlay_offset >= file_size)
|
if ((off_t)overlay_offset >= file_size)
|
||||||
throwCantUnpack("file corrupted");
|
throwCantUnpack("file corrupted");
|
||||||
|
|
||||||
@@ -531,15 +531,15 @@ void PackUnix::unpack(OutputFile *fo)
|
|||||||
Elf32_Ehdr ehdr;
|
Elf32_Ehdr ehdr;
|
||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
fi->readx(&ehdr, sizeof(ehdr));
|
fi->readx(&ehdr, sizeof(ehdr));
|
||||||
unsigned const e_entry = get_native32(&ehdr.e_entry);
|
unsigned const e_entry = get_te32(&ehdr.e_entry);
|
||||||
if (e_entry < 0x401180) { /* old style, 8-byte b_info */
|
if (e_entry < 0x401180) { /* old style, 8-byte b_info */
|
||||||
szb_info = 2*sizeof(unsigned);
|
szb_info = 2*sizeof(unsigned);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Elf32_Phdr phdr;
|
Elf32_Phdr phdr;
|
||||||
fi->seek(get_native32(&ehdr.e_phoff), SEEK_SET);
|
fi->seek(get_te32(&ehdr.e_phoff), SEEK_SET);
|
||||||
fi->readx(&phdr, sizeof(phdr));
|
fi->readx(&phdr, sizeof(phdr));
|
||||||
unsigned const p_vaddr = get_native32(&phdr.p_vaddr);
|
unsigned const p_vaddr = get_te32(&phdr.p_vaddr);
|
||||||
if (0x80==(e_entry - p_vaddr)) { /* 1.22 old style */
|
if (0x80==(e_entry - p_vaddr)) { /* 1.22 old style */
|
||||||
szb_info = 2*sizeof(unsigned);
|
szb_info = 2*sizeof(unsigned);
|
||||||
}
|
}
|
||||||
@@ -558,8 +558,8 @@ void PackUnix::unpack(OutputFile *fo)
|
|||||||
{
|
{
|
||||||
p_info hbuf;
|
p_info hbuf;
|
||||||
fi->readx(&hbuf, sizeof(hbuf));
|
fi->readx(&hbuf, sizeof(hbuf));
|
||||||
orig_file_size = get_native32(&hbuf.p_filesize);
|
orig_file_size = get_te32(&hbuf.p_filesize);
|
||||||
blocksize = get_native32(&hbuf.p_blocksize);
|
blocksize = get_te32(&hbuf.p_blocksize);
|
||||||
|
|
||||||
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
if (file_size > (off_t)orig_file_size || blocksize > orig_file_size)
|
||||||
throwCantUnpack("file header corrupted");
|
throwCantUnpack("file header corrupted");
|
||||||
@@ -583,8 +583,8 @@ void PackUnix::unpack(OutputFile *fo)
|
|||||||
unsigned sz_unc, sz_cpr;
|
unsigned sz_unc, sz_cpr;
|
||||||
|
|
||||||
fi->readx(&bhdr, szb_info);
|
fi->readx(&bhdr, szb_info);
|
||||||
ph.u_len = sz_unc = get_native32(&bhdr.sz_unc);
|
ph.u_len = sz_unc = get_te32(&bhdr.sz_unc);
|
||||||
ph.c_len = sz_cpr = get_native32(&bhdr.sz_cpr);
|
ph.c_len = sz_cpr = get_te32(&bhdr.sz_cpr);
|
||||||
|
|
||||||
if (sz_unc == 0) // uncompressed size 0 -> EOF
|
if (sz_unc == 0) // uncompressed size 0 -> EOF
|
||||||
{
|
{
|
||||||
|
|||||||
+3
-24
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -64,15 +64,6 @@ protected:
|
|||||||
|
|
||||||
virtual void writePackHeader(OutputFile *fo);
|
virtual void writePackHeader(OutputFile *fo);
|
||||||
|
|
||||||
// in order too share as much code as possible we introduce
|
|
||||||
// an endian abstraction here
|
|
||||||
virtual acc_uint64l_t get_native64(const void *) const = 0;
|
|
||||||
virtual unsigned get_native32(const void *) const = 0;
|
|
||||||
virtual unsigned get_native16(const void *) const = 0;
|
|
||||||
virtual void set_native64(void *, acc_uint64l_t) const = 0;
|
|
||||||
virtual void set_native32(void *, unsigned) const = 0;
|
|
||||||
virtual void set_native16(void *, unsigned) const = 0;
|
|
||||||
|
|
||||||
virtual bool checkCompressionRatio(unsigned, unsigned) const;
|
virtual bool checkCompressionRatio(unsigned, unsigned) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -142,12 +133,6 @@ class PackUnixBe32 : public PackUnix
|
|||||||
typedef PackUnix super;
|
typedef PackUnix super;
|
||||||
protected:
|
protected:
|
||||||
PackUnixBe32(InputFile *f) : super(f) { bele = &N_BELE_RTP::be_policy; }
|
PackUnixBe32(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); }
|
|
||||||
|
|
||||||
// must agree with stub/linux.hh
|
// must agree with stub/linux.hh
|
||||||
struct b_info { // 12-byte header before each compressed block
|
struct b_info { // 12-byte header before each compressed block
|
||||||
@@ -183,12 +168,6 @@ class PackUnixLe32 : public PackUnix
|
|||||||
typedef PackUnix super;
|
typedef PackUnix super;
|
||||||
protected:
|
protected:
|
||||||
PackUnixLe32(InputFile *f) : super(f) { bele = &N_BELE_RTP::le_policy; }
|
PackUnixLe32(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); }
|
|
||||||
|
|
||||||
// must agree with stub/linux.hh
|
// must agree with stub/linux.hh
|
||||||
struct b_info { // 12-byte header before each compressed block
|
struct b_info { // 12-byte header before each compressed block
|
||||||
|
|||||||
+326
-24
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2004-2007 John Reiser
|
Copyright (C) 2004-2008 John Reiser
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
UPX and the UCL library are free software; you can redistribute them
|
||||||
@@ -23,10 +23,10 @@
|
|||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
|
|
||||||
John Reiser
|
John Reiser
|
||||||
jreiser@users.sourceforge.net
|
<jreiser@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -46,6 +46,8 @@ static const
|
|||||||
#include "stub/arm-linux.kernel.vmlinux.h"
|
#include "stub/arm-linux.kernel.vmlinux.h"
|
||||||
static const
|
static const
|
||||||
#include "stub/armeb-linux.kernel.vmlinux.h"
|
#include "stub/armeb-linux.kernel.vmlinux.h"
|
||||||
|
static const
|
||||||
|
#include "stub/powerpc-linux.kernel.vmlinux.h"
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -203,13 +205,14 @@ bool PackVmlinuxBase<T>::canPack()
|
|||||||
return 0 < n_ptload;
|
return 0 < n_ptload;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#include "p_elf.h"
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
unsigned fo_off = 0;
|
unsigned fo_off = 0;
|
||||||
Ehdr ehdro;
|
Ehdr ehdro;
|
||||||
U32 tmp_u32;
|
TE32 tmp_u32;
|
||||||
|
|
||||||
// NULL
|
// NULL
|
||||||
// .text(PT_LOADs) .note(1st page) .note(rest)
|
// .text(PT_LOADs) .note(1st page) .note(rest)
|
||||||
@@ -266,8 +269,217 @@ void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
|||||||
|
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
// limit stack size needed for runtime decompression
|
// 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
|
||||||
|
|
||||||
|
unsigned ppc32_extra = 0;
|
||||||
|
if (Ehdr::EM_PPC==my_e_machine) {
|
||||||
|
// output layout:
|
||||||
|
// .long UPX_MAGIC_LE32
|
||||||
|
// .long L20 - L10
|
||||||
|
// L10:
|
||||||
|
// b_info for Ehdr; compressed Ehdr; .balign 4 // one block only
|
||||||
|
// b_info for LOAD; compressed LOAD; .balign 4 // possibly many blocks
|
||||||
|
// // This allows per-block filters!
|
||||||
|
// L20:
|
||||||
|
// b f_decompress
|
||||||
|
// +4: f_unfilter(char *buf, unsigned len, unsigned cto8, unsigned ftid)
|
||||||
|
// // Code for multiple filters can "daisy chain" on ftid.
|
||||||
|
// f_decompress(char const *src, unsigned src_len,
|
||||||
|
// char *dst, unsigned *dst_len, int method)
|
||||||
|
unsigned tmp;
|
||||||
|
tmp = UPX_MAGIC_LE32; fo->write(&tmp, sizeof(tmp)); fo_off += sizeof(tmp);
|
||||||
|
tmp = 0; fo->write(&tmp, sizeof(tmp)); fo_off += sizeof(tmp);
|
||||||
|
ppc32_extra += 2*sizeof(tmp);
|
||||||
|
unsigned const len_unc = sizeof(ehdri) + sizeof(Phdr) * ehdri.e_phnum;
|
||||||
|
MemBuffer unc_hdr(len_unc);
|
||||||
|
MemBuffer cpr_hdr; cpr_hdr.allocForCompression(len_unc);
|
||||||
|
memcpy(&unc_hdr[0], &ehdri, sizeof(ehdri));
|
||||||
|
memcpy(&unc_hdr[sizeof(ehdri)], phdri, sizeof(Phdr) * ehdri.e_phnum);
|
||||||
|
unsigned len_cpr = 0;
|
||||||
|
int const r = upx_compress(unc_hdr, len_unc, cpr_hdr, &len_cpr,
|
||||||
|
NULL, ph.method, 10, NULL, NULL );
|
||||||
|
if (UPX_E_OK!=r || len_unc<=len_cpr) // FIXME: allow no compression
|
||||||
|
throwInternalError("Ehdr compression failed");
|
||||||
|
|
||||||
|
struct b_info { // 12-byte header before each compressed block
|
||||||
|
unsigned sz_unc; // uncompressed_size
|
||||||
|
unsigned sz_cpr; // compressed_size
|
||||||
|
unsigned char b_method; // compression algorithm
|
||||||
|
unsigned char b_ftid; // filter id
|
||||||
|
unsigned char b_cto8; // filter parameter
|
||||||
|
unsigned char b_unused; // FIXME: !=0 for partial-block unfilter
|
||||||
|
// unsigned f_offset, f_len; // only if partial-block unfilter
|
||||||
|
}
|
||||||
|
__attribute_packed;
|
||||||
|
|
||||||
|
struct b_info hdr_info;
|
||||||
|
set_be32(&hdr_info.sz_unc, len_unc);
|
||||||
|
set_be32(&hdr_info.sz_cpr, len_cpr);
|
||||||
|
hdr_info.b_method = ph.method;
|
||||||
|
hdr_info.b_ftid = 0;
|
||||||
|
hdr_info.b_cto8 = 0;
|
||||||
|
hdr_info.b_unused = 0;
|
||||||
|
fo->write(&hdr_info, sizeof(hdr_info)); fo_off += sizeof(hdr_info);
|
||||||
|
unsigned const frag = (3& (0u-len_cpr));
|
||||||
|
ppc32_extra += sizeof(hdr_info) + len_cpr + frag;
|
||||||
|
fo_off += len_cpr + frag;
|
||||||
|
fo->write(cpr_hdr, len_cpr + frag);
|
||||||
|
|
||||||
|
// Partial filter: .text and following contiguous SHF_EXECINSTR
|
||||||
|
upx_bytep f_ptr = ibuf;
|
||||||
|
unsigned f_len = 0;
|
||||||
|
Shdr const *shdr = 1+ shdri; // skip empty shdr[0]
|
||||||
|
if (ft.buf_len==0 // not specified yet FIXME: was set near construction
|
||||||
|
&& (Shdr::SHF_ALLOC & shdr->sh_flags)
|
||||||
|
&& (Shdr::SHF_EXECINSTR & shdr->sh_flags)) {
|
||||||
|
// shdr[1] is instructions (probably .text)
|
||||||
|
f_ptr = ibuf + (unsigned) (shdr->sh_offset - phdri[0].p_offset);
|
||||||
|
f_len = shdr->sh_size;
|
||||||
|
++shdr;
|
||||||
|
for (int j= ehdri.e_shnum - 2; --j>=0; ++shdr) {
|
||||||
|
unsigned prev_end = shdr[-1].sh_size + shdr[-1].sh_offset;
|
||||||
|
prev_end += ~(0u-shdr[0].sh_addralign) & (0u-prev_end); // align_up
|
||||||
|
if ((Shdr::SHF_ALLOC & shdr->sh_flags)
|
||||||
|
&& (Shdr::SHF_EXECINSTR & shdr->sh_flags)
|
||||||
|
&& shdr[0].sh_offset==prev_end) {
|
||||||
|
f_len += shdr->sh_size;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else { // ft.buf_len already specified, or Shdr[1] not instructions
|
||||||
|
f_ptr = ibuf;
|
||||||
|
f_len = ph.u_len;
|
||||||
|
}
|
||||||
|
compressWithFilters(ibuf, ph.u_len, obuf,
|
||||||
|
f_ptr, f_len, // filter range
|
||||||
|
NULL, 0, // hdr_ptr, hdr_len
|
||||||
|
&ft, 512, &cconf, getStrategy(ft));
|
||||||
|
|
||||||
|
set_be32(&hdr_info.sz_unc, ph.u_len);
|
||||||
|
set_be32(&hdr_info.sz_cpr, ph.c_len);
|
||||||
|
hdr_info.b_ftid = ft.id;
|
||||||
|
hdr_info.b_cto8 = ft.cto;
|
||||||
|
if (ph.u_len!=f_len) {
|
||||||
|
hdr_info.b_unused = 1; // flag for partial filter
|
||||||
|
}
|
||||||
|
fo->write(&hdr_info, sizeof(hdr_info)); fo_off += sizeof(hdr_info);
|
||||||
|
ppc32_extra += sizeof(hdr_info);
|
||||||
|
if (ph.u_len!=f_len) {
|
||||||
|
set_be32(&hdr_info.sz_unc, f_ptr - (upx_bytep) ibuf);
|
||||||
|
set_be32(&hdr_info.sz_cpr, f_len);
|
||||||
|
fo->write(&hdr_info, 2*sizeof(unsigned)); fo_off += 2*sizeof(unsigned);
|
||||||
|
ppc32_extra += 2*sizeof(unsigned);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0 /*{ Documentation: changes to arch/powerpc/boot/main.c */
|
||||||
|
struct b_info {
|
||||||
|
unsigned sz_unc;
|
||||||
|
unsigned sz_cpr;
|
||||||
|
unsigned char b_method;
|
||||||
|
unsigned char b_ftid;
|
||||||
|
unsigned char b_cto8;
|
||||||
|
unsigned char b_unused;
|
||||||
|
};
|
||||||
|
typedef int (*upx_f_unc)( /* uncompress */
|
||||||
|
unsigned char const *src, unsigned src_len,
|
||||||
|
unsigned char *dst, unsigned *dst_len,
|
||||||
|
int method
|
||||||
|
);
|
||||||
|
typedef int (*upx_f_unf)( /* unfilter */
|
||||||
|
unsigned char *buf,
|
||||||
|
unsigned len,
|
||||||
|
unsigned cto8,
|
||||||
|
unsigned ftid
|
||||||
|
);
|
||||||
|
|
||||||
|
unsigned char const *upx_expand( // return updated src [aligned, too]
|
||||||
|
unsigned char const *src,
|
||||||
|
unsigned char *dst,
|
||||||
|
unsigned *const dst_len,
|
||||||
|
upx_f_unc const f_unc
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (0==*dst_len) {
|
||||||
|
*dst_len = ((struct b_info const *)src)->sz_unc;
|
||||||
|
}
|
||||||
|
upx_f_unf const f_unf = (upx_f_unf)(sizeof(int) + (char *)f_unc);
|
||||||
|
unsigned total_len = 0;
|
||||||
|
unsigned need = *dst_len;
|
||||||
|
while (0 < need) {
|
||||||
|
struct b_info const *const b_hdr = (struct b_info const *)src;
|
||||||
|
src = (unsigned char const *)(1+ b_hdr);
|
||||||
|
unsigned blk_len = b_hdr->sz_unc;
|
||||||
|
int const rv = (*f_unc)(src, b_hdr->sz_cpr, dst, &blk_len, b_hdr->b_method);
|
||||||
|
if (0!=rv) {
|
||||||
|
printf("decompress error %d\n\r", rv);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
if (b_hdr->b_ftid) {
|
||||||
|
(*f_unf)(dst, b_hdr->sz_unc, b_hdr->b_cto8, b_hdr->b_ftid);
|
||||||
|
}
|
||||||
|
src += b_hdr->sz_cpr;
|
||||||
|
src += (3& -(int)src); // 4-byte align
|
||||||
|
dst += b_hdr->sz_unc;
|
||||||
|
total_len += b_hdr->sz_unc;
|
||||||
|
need -= b_hdr->sz_unc;
|
||||||
|
}
|
||||||
|
*dst_len = total_len;
|
||||||
|
return src;
|
||||||
|
}
|
||||||
|
|
||||||
|
void prep_kernel(unsigned long a1, unsigned long a2)
|
||||||
|
{
|
||||||
|
upx_f_unc f_unc = (upx_f_unc)0;
|
||||||
|
|
||||||
|
vmlinuz.addr = (unsigned long)_vmlinux_start;
|
||||||
|
vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
|
||||||
|
|
||||||
|
if (0x55505821 == *(unsigned *)vmlinuz.addr) {
|
||||||
|
/* was compressed by upx */
|
||||||
|
/* Uncompress elfheader */
|
||||||
|
unsigned const *const fwa = (unsigned *)vmlinuz.addr;
|
||||||
|
f_unc = (upx_f_unc)((char *)&fwa[2] + fwa[1]);
|
||||||
|
unsigned dst_len = 0;
|
||||||
|
unsigned char const *src = (unsigned char const *)&fwa[2];
|
||||||
|
src = upx_expand(src, (unsigned char *)elfheader, &dst_len, f_unc);
|
||||||
|
unsigned const src_len = src - (unsigned char const *)&fwa[0];
|
||||||
|
vmlinuz.addr += src_len;
|
||||||
|
vmlinuz.size -= src_len;
|
||||||
|
} else {
|
||||||
|
memcpy(elfheader, (const void *)vmlinuz.addr,
|
||||||
|
sizeof(elfheader));
|
||||||
|
}
|
||||||
|
=====
|
||||||
|
/* Eventually gunzip the kernel */
|
||||||
|
if (f_unc) {
|
||||||
|
/* was compressed by upx */
|
||||||
|
printf("upx_expand (0x%lx <- 0x%lx:0x%0lx)...",
|
||||||
|
vmlinux.addr, vmlinuz.addr, vmlinuz.addr+vmlinuz.size);
|
||||||
|
unsigned dst_len = vmlinux.size - elfoffset;
|
||||||
|
upx_expand((unsigned char const *)vmlinuz.addr,
|
||||||
|
(unsigned char *)vmlinux.addr, &dst_len, f_unc);
|
||||||
|
printf("done 0x%lx bytes\n\r", len);
|
||||||
|
} else {
|
||||||
|
memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,
|
||||||
|
vmlinuz.size);
|
||||||
|
/* Skip over the ELF header */
|
||||||
|
#ifdef DEBUG
|
||||||
|
printf("... skipping 0x%lx bytes of ELF header\n\r",
|
||||||
|
elfoffset);
|
||||||
|
#endif
|
||||||
|
vmlinux.addr += elfoffset;
|
||||||
|
}
|
||||||
|
=====
|
||||||
|
}
|
||||||
|
#endif /*}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
compressWithFilters(&ft, 512, &cconf, getStrategy(ft));
|
compressWithFilters(&ft, 512, &cconf, getStrategy(ft));
|
||||||
|
}
|
||||||
unsigned const txt_c_len = ph.c_len;
|
unsigned const txt_c_len = ph.c_len;
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
@@ -287,13 +499,13 @@ void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
|||||||
shdro[1].sh_name = ptr_diff(p, shstrtab);
|
shdro[1].sh_name = ptr_diff(p, shstrtab);
|
||||||
shdro[1].sh_type = Shdr::SHT_PROGBITS;
|
shdro[1].sh_type = Shdr::SHT_PROGBITS;
|
||||||
shdro[1].sh_flags = Shdr::SHF_ALLOC | Shdr::SHF_EXECINSTR;
|
shdro[1].sh_flags = Shdr::SHF_ALLOC | Shdr::SHF_EXECINSTR;
|
||||||
shdro[1].sh_offset = fo_off;
|
shdro[1].sh_offset = fo_off - ppc32_extra;
|
||||||
shdro[1].sh_size = txt_c_len + lsize; // plus more ...
|
shdro[1].sh_size = ppc32_extra + txt_c_len + lsize; // plus more ...
|
||||||
shdro[1].sh_addralign = 1; // default
|
shdro[1].sh_addralign = 1; // default
|
||||||
|
|
||||||
fo_off += write_vmlinux_head(fo, &shdro[1]);
|
fo_off += write_vmlinux_head(fo, &shdro[1]);
|
||||||
fo->write(obuf, txt_c_len); fo_off += txt_c_len;
|
fo->write(obuf, txt_c_len); fo_off += txt_c_len;
|
||||||
unsigned const a = (shdro[1].sh_addralign -1) & (0u-txt_c_len);
|
unsigned const a = (shdro[1].sh_addralign -1) & (0u-(ppc32_extra + txt_c_len));
|
||||||
if (0!=a) { // align
|
if (0!=a) { // align
|
||||||
fo_off += a;
|
fo_off += a;
|
||||||
shdro[1].sh_size += a;
|
shdro[1].sh_size += a;
|
||||||
@@ -361,7 +573,7 @@ void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
|||||||
shdro[5].sh_name = ptr_diff(p, shstrtab);
|
shdro[5].sh_name = ptr_diff(p, shstrtab);
|
||||||
shdro[5].sh_type = Shdr::SHT_SYMTAB;
|
shdro[5].sh_type = Shdr::SHT_SYMTAB;
|
||||||
shdro[5].sh_offset = fo_off;
|
shdro[5].sh_offset = fo_off;
|
||||||
shdro[5].sh_size = 5*sizeof(Sym);
|
shdro[5].sh_size = ((Ehdr::EM_PPC==my_e_machine) + 5)*sizeof(Sym);
|
||||||
//shdro[5].sh_flags = Shdr::SHF_INFO_LINK;
|
//shdro[5].sh_flags = Shdr::SHF_INFO_LINK;
|
||||||
shdro[5].sh_link = 6; // to .strtab for symbols
|
shdro[5].sh_link = 6; // to .strtab for symbols
|
||||||
shdro[5].sh_info = 1+3; // number of non-global symbols [binutils/bfd/elf.c]
|
shdro[5].sh_info = 1+3; // number of non-global symbols [binutils/bfd/elf.c]
|
||||||
@@ -388,26 +600,40 @@ void PackVmlinuxBase<T>::pack(OutputFile *fo)
|
|||||||
Sym unc_ker;
|
Sym unc_ker;
|
||||||
unc_ker.st_name = 1; // 1 byte into strtab
|
unc_ker.st_name = 1; // 1 byte into strtab
|
||||||
unc_ker.st_value = 0;
|
unc_ker.st_value = 0;
|
||||||
unc_ker.st_size = txt_c_len;
|
unc_ker.st_size = ppc32_extra + txt_c_len;
|
||||||
unc_ker.st_info = unc_ker.make_st_info(Sym::STB_GLOBAL, Sym::STT_FUNC);
|
unc_ker.st_info = unc_ker.make_st_info(Sym::STB_GLOBAL, Sym::STT_FUNC);
|
||||||
unc_ker.st_other = Sym::STV_DEFAULT;
|
unc_ker.st_other = Sym::STV_DEFAULT;
|
||||||
unc_ker.st_shndx = 1; // .text
|
unc_ker.st_shndx = 1; // .text
|
||||||
fo->write(&unc_ker, sizeof(unc_ker)); fo_off += sizeof(unc_ker);
|
fo->write(&unc_ker, sizeof(unc_ker)); fo_off += sizeof(unc_ker);
|
||||||
|
|
||||||
unsigned const lablen = strlen(my_boot_label);
|
unsigned const lablen = strlen(my_boot_label);
|
||||||
|
if (Ehdr::EM_PPC==my_e_machine) {
|
||||||
|
unc_ker.st_name += 1+ lablen;
|
||||||
|
unc_ker.st_value = unc_ker.st_size;
|
||||||
|
unc_ker.st_size = 0;
|
||||||
|
fo->write(&unc_ker, sizeof(unc_ker)); fo_off += sizeof(unc_ker);
|
||||||
|
}
|
||||||
while (0!=*p++) ;
|
while (0!=*p++) ;
|
||||||
shdro[6].sh_name = ptr_diff(p, shstrtab);
|
shdro[6].sh_name = ptr_diff(p, shstrtab);
|
||||||
shdro[6].sh_type = Shdr::SHT_STRTAB;
|
shdro[6].sh_type = Shdr::SHT_STRTAB;
|
||||||
shdro[6].sh_offset = fo_off;
|
shdro[6].sh_offset = fo_off;
|
||||||
shdro[6].sh_size = 2+ lablen; // '\0' before and after
|
shdro[6].sh_size = 2+ lablen + (Ehdr::EM_PPC==my_e_machine)*(1+ 12); // '\0' before and after
|
||||||
shdro[6].sh_addralign = 1;
|
shdro[6].sh_addralign = 1;
|
||||||
fo->seek(1, SEEK_CUR); // the '\0' before
|
fo->seek(1, SEEK_CUR); // the '\0' before
|
||||||
fo->write(my_boot_label, 1+ lablen); // include the '\0' terminator
|
fo->write(my_boot_label, 1+ lablen); // include the '\0' terminator
|
||||||
|
if (Ehdr::EM_PPC==my_e_machine) {
|
||||||
|
fo->write("_vmlinux_end", 1+ 12); fo_off += 1+ 12;
|
||||||
|
}
|
||||||
fo_off += 2+ lablen;
|
fo_off += 2+ lablen;
|
||||||
|
|
||||||
fo->seek(0, SEEK_SET);
|
fo->seek(0, SEEK_SET);
|
||||||
fo->write(&ehdro, sizeof(ehdro));
|
fo->write(&ehdro, sizeof(ehdro));
|
||||||
fo->write(&shdro, sizeof(shdro));
|
fo->write(&shdro, sizeof(shdro));
|
||||||
|
if (Ehdr::EM_PPC==my_e_machine) {
|
||||||
|
fo->seek(sizeof(unsigned), SEEK_CUR);
|
||||||
|
set_be32(&ppc32_extra, ppc32_extra - 2*sizeof(unsigned) + txt_c_len);
|
||||||
|
fo->write(&ppc32_extra, sizeof(ppc32_extra));
|
||||||
|
}
|
||||||
|
|
||||||
if (!checkFinalCompressionRatio(fo))
|
if (!checkFinalCompressionRatio(fo))
|
||||||
throwNotCompressible();
|
throwNotCompressible();
|
||||||
@@ -483,7 +709,7 @@ int PackVmlinuxBase<T>::canUnpack()
|
|||||||
template <class T>
|
template <class T>
|
||||||
void PackVmlinuxBase<T>::unpack(OutputFile *fo)
|
void PackVmlinuxBase<T>::unpack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
U32 word;
|
TE32 word;
|
||||||
PackHeader const ph_tmp(ph);
|
PackHeader const ph_tmp(ph);
|
||||||
|
|
||||||
fi->seek(p_note0->sh_offset, SEEK_SET);
|
fi->seek(p_note0->sh_offset, SEEK_SET);
|
||||||
@@ -559,6 +785,12 @@ const int *PackVmlinuxARMEB::getCompressionMethods(int method, int level) const
|
|||||||
return Packer::getDefaultCompressionMethods_8(method, level);
|
return Packer::getDefaultCompressionMethods_8(method, level);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int *PackVmlinuxPPC32::getCompressionMethods(int method, int level) const
|
||||||
|
{
|
||||||
|
// No real dependency on LE32.
|
||||||
|
return Packer::getDefaultCompressionMethods_le32(method, level);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const int *PackVmlinuxARMEL::getFilters() const
|
const int *PackVmlinuxARMEL::getFilters() const
|
||||||
{
|
{
|
||||||
@@ -572,6 +804,12 @@ const int *PackVmlinuxARMEB::getFilters() const
|
|||||||
return f51;
|
return f51;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int *PackVmlinuxPPC32::getFilters() const
|
||||||
|
{
|
||||||
|
static const int fd0[] = { 0xd0, FT_END };
|
||||||
|
return fd0;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Examples as of 2004-07-16 [readelf --segments vmlinux # before fiddling]:
|
// Examples as of 2004-07-16 [readelf --segments vmlinux # before fiddling]:
|
||||||
//
|
//
|
||||||
@@ -599,7 +837,7 @@ const int *PackVmlinuxARMEB::getFilters() const
|
|||||||
|
|
||||||
bool PackVmlinuxI386::is_valid_e_entry(Addr e_entry)
|
bool PackVmlinuxI386::is_valid_e_entry(Addr e_entry)
|
||||||
{
|
{
|
||||||
return 0==(0x000fffff & e_entry); // entry on whole 1MB
|
return 0==(0x000fffff & e_entry); // entry on whole 1 MiB
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -669,6 +907,11 @@ bool PackVmlinuxARMEB::is_valid_e_entry(Addr e_entry)
|
|||||||
return 0xc0008000==e_entry;
|
return 0xc0008000==e_entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PackVmlinuxPPC32::is_valid_e_entry(Addr e_entry)
|
||||||
|
{
|
||||||
|
return 0xc0000000==e_entry;
|
||||||
|
}
|
||||||
|
|
||||||
Linker* PackVmlinuxARMEL::newLinker() const
|
Linker* PackVmlinuxARMEL::newLinker() const
|
||||||
{
|
{
|
||||||
return new ElfLinkerArmLE;
|
return new ElfLinkerArmLE;
|
||||||
@@ -679,6 +922,11 @@ Linker* PackVmlinuxARMEB::newLinker() const
|
|||||||
return new ElfLinkerArmBE;
|
return new ElfLinkerArmBE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Linker* PackVmlinuxPPC32::newLinker() const
|
||||||
|
{
|
||||||
|
return new ElfLinkerPpc32;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PackVmlinuxARMEL::buildLoader(const Filter *ft)
|
void PackVmlinuxARMEL::buildLoader(const Filter *ft)
|
||||||
@@ -725,6 +973,28 @@ void PackVmlinuxARMEB::buildLoader(const Filter *ft)
|
|||||||
addLoader("IDENTSTR,UPX1HEAD", NULL);
|
addLoader("IDENTSTR,UPX1HEAD", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PackVmlinuxPPC32::buildLoader(const Filter *ft)
|
||||||
|
{
|
||||||
|
// prepare loader
|
||||||
|
initLoader(stub_powerpc_linux_kernel_vmlinux, sizeof(stub_powerpc_linux_kernel_vmlinux));
|
||||||
|
addLoader("LINUX000", NULL);
|
||||||
|
if (ft->id) {
|
||||||
|
assert(ft->calls > 0);
|
||||||
|
addLoader("LINUX010", NULL);
|
||||||
|
}
|
||||||
|
addLoader("LINUX020", NULL);
|
||||||
|
if (ft->id) {
|
||||||
|
addFilter32(ft->id);
|
||||||
|
}
|
||||||
|
addLoader("LINUX030", NULL);
|
||||||
|
if (ph.method == M_NRV2E_LE32) addLoader("NRV2E", NULL);
|
||||||
|
else if (ph.method == M_NRV2B_LE32) addLoader("NRV2B", NULL);
|
||||||
|
else if (ph.method == M_NRV2D_LE32) addLoader("NRV2D", NULL);
|
||||||
|
else if (M_IS_LZMA(ph.method)) addLoader("LZMA_ELF00,LZMA_DEC10,LZMA_DEC30", NULL);
|
||||||
|
else throwBadLoader();
|
||||||
|
addLoader("IDENTSTR,UPX1HEAD", NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static const
|
static const
|
||||||
#include "stub/i386-linux.kernel.vmlinux-head.h"
|
#include "stub/i386-linux.kernel.vmlinux-head.h"
|
||||||
@@ -734,6 +1004,8 @@ static const
|
|||||||
#include "stub/arm-linux.kernel.vmlinux-head.h"
|
#include "stub/arm-linux.kernel.vmlinux-head.h"
|
||||||
static const
|
static const
|
||||||
#include "stub/armeb-linux.kernel.vmlinux-head.h"
|
#include "stub/armeb-linux.kernel.vmlinux-head.h"
|
||||||
|
static const
|
||||||
|
#include "stub/powerpc-linux.kernel.vmlinux-head.h"
|
||||||
|
|
||||||
unsigned PackVmlinuxI386::write_vmlinux_head(
|
unsigned PackVmlinuxI386::write_vmlinux_head(
|
||||||
OutputFile *const fo,
|
OutputFile *const fo,
|
||||||
@@ -743,7 +1015,7 @@ unsigned PackVmlinuxI386::write_vmlinux_head(
|
|||||||
// COMPRESSED_LENGTH
|
// COMPRESSED_LENGTH
|
||||||
fo->write(&stub_i386_linux_kernel_vmlinux_head[0],
|
fo->write(&stub_i386_linux_kernel_vmlinux_head[0],
|
||||||
sizeof(stub_i386_linux_kernel_vmlinux_head)-(1+ 4) +1);
|
sizeof(stub_i386_linux_kernel_vmlinux_head)-(1+ 4) +1);
|
||||||
U32 tmp_u32; tmp_u32 = ph.c_len; fo->write(&tmp_u32, 4);
|
TE32 tmp_u32; tmp_u32 = ph.c_len; fo->write(&tmp_u32, 4);
|
||||||
|
|
||||||
stxt->sh_size += sizeof(stub_i386_linux_kernel_vmlinux_head);
|
stxt->sh_size += sizeof(stub_i386_linux_kernel_vmlinux_head);
|
||||||
|
|
||||||
@@ -758,7 +1030,7 @@ unsigned PackVmlinuxAMD64::write_vmlinux_head(
|
|||||||
// COMPRESSED_LENGTH
|
// COMPRESSED_LENGTH
|
||||||
fo->write(&stub_amd64_linux_kernel_vmlinux_head[0],
|
fo->write(&stub_amd64_linux_kernel_vmlinux_head[0],
|
||||||
sizeof(stub_amd64_linux_kernel_vmlinux_head)-(1+ 4) +1);
|
sizeof(stub_amd64_linux_kernel_vmlinux_head)-(1+ 4) +1);
|
||||||
U32 tmp_u32; tmp_u32 = ph.c_len; fo->write(&tmp_u32, 4);
|
TE32 tmp_u32; tmp_u32 = ph.c_len; fo->write(&tmp_u32, 4);
|
||||||
printf(" Compressed length=0x%x\n", ph.c_len);
|
printf(" Compressed length=0x%x\n", ph.c_len);
|
||||||
printf("UnCompressed length=0x%x\n", ph.u_len);
|
printf("UnCompressed length=0x%x\n", ph.u_len);
|
||||||
|
|
||||||
@@ -783,6 +1055,14 @@ void PackVmlinuxARMEB::defineDecompressorSymbols()
|
|||||||
linker->defineSymbol("METHOD", ph.method);
|
linker->defineSymbol("METHOD", ph.method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PackVmlinuxPPC32::defineDecompressorSymbols()
|
||||||
|
{
|
||||||
|
super::defineDecompressorSymbols();
|
||||||
|
// linker->defineSymbol( "COMPRESSED_LENGTH", ph.c_len);
|
||||||
|
// linker->defineSymbol("UNCOMPRESSED_LENGTH", ph.u_len);
|
||||||
|
// linker->defineSymbol("METHOD", ph.method);
|
||||||
|
}
|
||||||
|
|
||||||
void PackVmlinuxI386::defineDecompressorSymbols()
|
void PackVmlinuxI386::defineDecompressorSymbols()
|
||||||
{
|
{
|
||||||
super::defineDecompressorSymbols();
|
super::defineDecompressorSymbols();
|
||||||
@@ -809,7 +1089,7 @@ unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
|||||||
fo->write(&stub_arm_linux_kernel_vmlinux_head[0], 4);
|
fo->write(&stub_arm_linux_kernel_vmlinux_head[0], 4);
|
||||||
|
|
||||||
// Second word
|
// Second word
|
||||||
U32 tmp_u32;
|
TE32 tmp_u32;
|
||||||
unsigned const t = (0xff000000 &
|
unsigned const t = (0xff000000 &
|
||||||
BeLePolicy::get32(&stub_arm_linux_kernel_vmlinux_head[4]))
|
BeLePolicy::get32(&stub_arm_linux_kernel_vmlinux_head[4]))
|
||||||
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
||||||
@@ -831,7 +1111,7 @@ unsigned PackVmlinuxARMEB::write_vmlinux_head(
|
|||||||
fo->write(&stub_armeb_linux_kernel_vmlinux_head[0], 4);
|
fo->write(&stub_armeb_linux_kernel_vmlinux_head[0], 4);
|
||||||
|
|
||||||
// Second word
|
// Second word
|
||||||
U32 tmp_u32;
|
TE32 tmp_u32;
|
||||||
unsigned const t = (0xff000000 &
|
unsigned const t = (0xff000000 &
|
||||||
BeLePolicy::get32(&stub_armeb_linux_kernel_vmlinux_head[4]))
|
BeLePolicy::get32(&stub_armeb_linux_kernel_vmlinux_head[4]))
|
||||||
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
| (0x00ffffff & (0u - 1 + ((3+ ph.c_len)>>2)));
|
||||||
@@ -844,10 +1124,18 @@ unsigned PackVmlinuxARMEB::write_vmlinux_head(
|
|||||||
return sizeof(stub_armeb_linux_kernel_vmlinux_head);
|
return sizeof(stub_armeb_linux_kernel_vmlinux_head);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned PackVmlinuxPPC32::write_vmlinux_head(
|
||||||
|
OutputFile * /*const fo*/,
|
||||||
|
Shdr * /*const stxt*/
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PackVmlinuxARMEL::has_valid_vmlinux_head()
|
bool PackVmlinuxARMEL::has_valid_vmlinux_head()
|
||||||
{
|
{
|
||||||
U32 buf[2];
|
TE32 buf[2];
|
||||||
fi->seek(p_text->sh_offset + sizeof(stub_arm_linux_kernel_vmlinux_head) -8, SEEK_SET);
|
fi->seek(p_text->sh_offset + sizeof(stub_arm_linux_kernel_vmlinux_head) -8, SEEK_SET);
|
||||||
fi->readx(buf, sizeof(buf));
|
fi->readx(buf, sizeof(buf));
|
||||||
//unsigned const word0 = buf[0];
|
//unsigned const word0 = buf[0];
|
||||||
@@ -861,7 +1149,7 @@ bool PackVmlinuxARMEL::has_valid_vmlinux_head()
|
|||||||
|
|
||||||
bool PackVmlinuxARMEB::has_valid_vmlinux_head()
|
bool PackVmlinuxARMEB::has_valid_vmlinux_head()
|
||||||
{
|
{
|
||||||
U32 buf[2];
|
TE32 buf[2];
|
||||||
fi->seek(p_text->sh_offset + sizeof(stub_armeb_linux_kernel_vmlinux_head) -8, SEEK_SET);
|
fi->seek(p_text->sh_offset + sizeof(stub_armeb_linux_kernel_vmlinux_head) -8, SEEK_SET);
|
||||||
fi->readx(buf, sizeof(buf));
|
fi->readx(buf, sizeof(buf));
|
||||||
//unsigned const word0 = buf[0];
|
//unsigned const word0 = buf[0];
|
||||||
@@ -873,6 +1161,20 @@ bool PackVmlinuxARMEB::has_valid_vmlinux_head()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PackVmlinuxPPC32::has_valid_vmlinux_head()
|
||||||
|
{
|
||||||
|
TE32 buf[2];
|
||||||
|
fi->seek(p_text->sh_offset + sizeof(stub_powerpc_linux_kernel_vmlinux_head) -8, SEEK_SET);
|
||||||
|
fi->readx(buf, sizeof(buf));
|
||||||
|
//unsigned const word0 = buf[0];
|
||||||
|
unsigned const word1 = buf[1];
|
||||||
|
if (0xeb==(word1>>24)
|
||||||
|
&& (0x00ffffff& word1)==(0u - 1 + ((3+ ph.c_len)>>2))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool PackVmlinuxI386::has_valid_vmlinux_head()
|
bool PackVmlinuxI386::has_valid_vmlinux_head()
|
||||||
{
|
{
|
||||||
unsigned char buf[5];
|
unsigned char buf[5];
|
||||||
@@ -1088,8 +1390,8 @@ bool PackVmlinuxAMD64::has_valid_vmlinux_head()
|
|||||||
// pushl $0
|
// pushl $0
|
||||||
// pushl $ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
// pushl $ MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED
|
||||||
// pushl $ PROT_EXEC | PROT_WRITE | PROT_READ
|
// pushl $ PROT_EXEC | PROT_WRITE | PROT_READ
|
||||||
// pushl $0x600000 # 6MB length
|
// pushl $0x600000 # 6 MiB length
|
||||||
// pushl $0x100000 # 1MB address
|
// pushl $0x100000 # 1 MiB address
|
||||||
// call mmap
|
// call mmap
|
||||||
// leal -0x9000(%esp),%esi # expect "lea 0x9000(%esi),%esp" later
|
// leal -0x9000(%esp),%esi # expect "lea 0x9000(%esi),%esp" later
|
||||||
///* Fall into .text of upx-compressed vmlinux. */
|
///* Fall into .text of upx-compressed vmlinux. */
|
||||||
@@ -1138,7 +1440,7 @@ const int *PackVmlinuxAMD64::getFilters() const
|
|||||||
|
|
||||||
bool PackVmlinuxAMD64::is_valid_e_entry(Addr e_entry)
|
bool PackVmlinuxAMD64::is_valid_e_entry(Addr e_entry)
|
||||||
{
|
{
|
||||||
return 0x200000<=e_entry; // 2MB
|
return 0x200000<=e_entry; // 2 MiB
|
||||||
}
|
}
|
||||||
|
|
||||||
Linker* PackVmlinuxAMD64::newLinker() const
|
Linker* PackVmlinuxAMD64::newLinker() const
|
||||||
|
|||||||
+30
-6
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -45,9 +45,9 @@ protected:
|
|||||||
typedef typename ElfClass::BeLePolicy BeLePolicy;
|
typedef typename ElfClass::BeLePolicy BeLePolicy;
|
||||||
typedef typename ElfClass::ElfITypes ElfITypes;
|
typedef typename ElfClass::ElfITypes ElfITypes;
|
||||||
// integral types
|
// integral types
|
||||||
typedef typename ElfClass::U16 U16;
|
typedef typename ElfClass::TE16 TE16;
|
||||||
typedef typename ElfClass::U32 U32;
|
typedef typename ElfClass::TE32 TE32;
|
||||||
typedef typename ElfClass::U64 U64;
|
typedef typename ElfClass::TE64 TE64;
|
||||||
typedef typename ElfITypes::Addr Addr;
|
typedef typename ElfITypes::Addr Addr;
|
||||||
// ELF types
|
// ELF types
|
||||||
typedef typename ElfClass::Ehdr Ehdr;
|
typedef typename ElfClass::Ehdr Ehdr;
|
||||||
@@ -167,6 +167,30 @@ protected:
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class PackVmlinuxPPC32 : public PackVmlinuxBase<ElfClass_BE32>
|
||||||
|
{
|
||||||
|
typedef PackVmlinuxBase<ElfClass_BE32> super;
|
||||||
|
public:
|
||||||
|
PackVmlinuxPPC32(InputFile *f) : super(f, Ehdr::EM_PPC,
|
||||||
|
Ehdr::ELFCLASS32, Ehdr::ELFDATA2MSB, "_vmlinux_start") { }
|
||||||
|
virtual int getFormat() const { return UPX_F_VMLINUX_PPC32; }
|
||||||
|
virtual const char *getName() const { return "vmlinux/ppc32"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "powerpc-linux.kernel.vmlinux"; }
|
||||||
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void buildLoader(const Filter *ft);
|
||||||
|
virtual void defineDecompressorSymbols();
|
||||||
|
virtual Linker* newLinker() const;
|
||||||
|
virtual bool is_valid_e_entry(Addr);
|
||||||
|
virtual bool has_valid_vmlinux_head();
|
||||||
|
virtual unsigned write_vmlinux_head(
|
||||||
|
OutputFile *const fo,
|
||||||
|
Shdr *const stxt
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class PackVmlinuxAMD64 : public PackVmlinuxBase<ElfClass_LE64>
|
class PackVmlinuxAMD64 : public PackVmlinuxBase<ElfClass_LE64>
|
||||||
{
|
{
|
||||||
|
|||||||
+174
-29
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ static const unsigned bzimage_offset = 0x100000;
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
PackVmlinuzI386::PackVmlinuzI386(InputFile *f) :
|
PackVmlinuzI386::PackVmlinuzI386(InputFile *f) :
|
||||||
super(f), physical_start(0x100000)
|
super(f), physical_start(0x100000), page_offset(0), config_physical_align(0)
|
||||||
{
|
{
|
||||||
bele = &N_BELE_RTP::le_policy;
|
bele = &N_BELE_RTP::le_policy;
|
||||||
COMPILE_TIME_ASSERT(sizeof(boot_sect_t) == 0x218);
|
COMPILE_TIME_ASSERT(sizeof(boot_sect_t) == 0x218);
|
||||||
@@ -73,6 +73,15 @@ const int *PackVmlinuzI386::getFilters() const
|
|||||||
return filters;
|
return filters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int *PackBvmlinuzI386::getFilters() const
|
||||||
|
{
|
||||||
|
// The destination buffer might be relocated at runtime.
|
||||||
|
static const int filters[] = {
|
||||||
|
0x49, 0x46,
|
||||||
|
FT_END };
|
||||||
|
return filters;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool PackVmlinuzI386::canPack()
|
bool PackVmlinuzI386::canPack()
|
||||||
{
|
{
|
||||||
@@ -111,12 +120,16 @@ int PackVmlinuzI386::readFileHeader()
|
|||||||
else if (hdrs && (h.load_flags & 1) != 0)
|
else if (hdrs && (h.load_flags & 1) != 0)
|
||||||
{
|
{
|
||||||
format = UPX_F_BVMLINUZ_i386;
|
format = UPX_F_BVMLINUZ_i386;
|
||||||
// account for 16-bit h.sys_size, wrap around at 20 bits
|
|
||||||
sys_size &= (1 << 20) - 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (16u * h.sys_size != sys_size)
|
if (0x204<=h.version) {
|
||||||
|
if ((16u * h.sys_size) != sys_size)
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
else { // h.sys_size is only 2 bytes
|
||||||
|
if ((16u * (0xffff & h.sys_size)) != (~(~0u<<20) & sys_size))
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: add more checks for a valid kernel
|
// FIXME: add more checks for a valid kernel
|
||||||
|
|
||||||
@@ -124,6 +137,11 @@ int PackVmlinuzI386::readFileHeader()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int is_pow2(unsigned const x)
|
||||||
|
{
|
||||||
|
return !(x & (x - 1));
|
||||||
|
}
|
||||||
|
|
||||||
// read full kernel into obuf[], gzip-decompress into ibuf[],
|
// read full kernel into obuf[], gzip-decompress into ibuf[],
|
||||||
// return decompressed size
|
// return decompressed size
|
||||||
int PackVmlinuzI386::decompressKernel()
|
int PackVmlinuzI386::decompressKernel()
|
||||||
@@ -133,15 +151,77 @@ int PackVmlinuzI386::decompressKernel()
|
|||||||
fi->seek(0, SEEK_SET);
|
fi->seek(0, SEEK_SET);
|
||||||
fi->readx(obuf, file_size);
|
fi->readx(obuf, file_size);
|
||||||
|
|
||||||
// Find "ljmp $__BOOT_CS,$__PHYSICAL_START" if any.
|
{
|
||||||
|
const upx_byte *base = NULL;
|
||||||
|
unsigned relocated = 0;
|
||||||
|
|
||||||
// See startup_32: in linux/arch/i386/boot/compressed/head.S
|
// See startup_32: in linux/arch/i386/boot/compressed/head.S
|
||||||
char const *p = (char const *)&obuf[setup_size];
|
const upx_byte *p = &obuf[setup_size];
|
||||||
for (int j= 0; j < 0x200; ++j, ++p)
|
unsigned cpa_0 = 0;
|
||||||
if (0==memcmp("\xEA\x00\x00", p, 3) && 0==(0xf & p[3]) && 0==p[4]) {
|
unsigned cpa_1 = 0;
|
||||||
/* whole megabyte < 16MB */
|
int j;
|
||||||
physical_start = get_le32(1+ p);
|
for ((p = &obuf[setup_size]), (j= 0); j < 0x200; ++j, ++p) {
|
||||||
|
if (0==memcmp("\x89\xeb\x81\xc3", p, 4)
|
||||||
|
&& 0==memcmp("\x81\xe3", 8+ p, 2)) {
|
||||||
|
// movl %ebp,%ebx
|
||||||
|
// addl $imm.w,%ebx
|
||||||
|
// andl $imm.w,%ebx
|
||||||
|
cpa_0 = 1+ get_te32( 4+ p);
|
||||||
|
cpa_1 = get_te32(10+ p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
for ((p = &obuf[setup_size]), (j= 0); j < 0x200; ++j, ++p) {
|
||||||
|
if (0==memcmp("\x8d\x83", p, 2) // leal d32(%ebx),%eax
|
||||||
|
&& 0==memcmp("\xff\xe0", 6+ p, 2) // jmp *%eax
|
||||||
|
) {
|
||||||
|
relocated = get_te32(2+ p);
|
||||||
|
}
|
||||||
|
if (0==memcmp("\xE8\x00\x00\x00\x00\x5D", p, 6)) {
|
||||||
|
// "call 1f; 1f: pop %ebp" determines actual execution address.
|
||||||
|
// linux-2.6.21 (spring 2007) and later; upx stub needs work
|
||||||
|
// unless LOAD_PHYSICAL_ADDR is known.
|
||||||
|
// Allowed code is: linux-2.6.23/arch/x86/head_32.S 2008-01-01
|
||||||
|
// call 1f
|
||||||
|
// 1: popl %ebp
|
||||||
|
// subl $1b, %ebp # 32-bit immediate
|
||||||
|
// movl $LOAD_PHYSICAL_ADDR, %ebx
|
||||||
|
//
|
||||||
|
if (0==memcmp("\x81\xed", 6+ p, 2) // subl $imm.w,%ebp
|
||||||
|
&& 0==memcmp("\xbb", 12+ p, 1) ) { // movl $imm.w,%ebx
|
||||||
|
physical_start = get_te32(13+ p);
|
||||||
|
} else
|
||||||
|
if (0==memcmp("\x81\xed", 6+ p, 2) // subl $imm.w,%ebp
|
||||||
|
&& is_pow2(cpa_0) && (0u-cpa_0)==cpa_1) {
|
||||||
|
base = (5+ p) - get_te32(8+ p);
|
||||||
|
config_physical_align = cpa_0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
throwCantPack("Unrecognized relocatable kernel");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Find "ljmp $__BOOT_CS,$__PHYSICAL_START" if any.
|
||||||
|
if (0==memcmp("\xEA\x00\x00", p, 3) && 0==(0xf & p[3]) && 0==p[4]) {
|
||||||
|
/* whole megabyte < 16 MiB */
|
||||||
|
physical_start = get_te32(1+ p);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (base && relocated) {
|
||||||
|
p = base + relocated;
|
||||||
|
for (j = 0; j < 0x200; ++j, ++p) {
|
||||||
|
if (0==memcmp("\x01\x9c\x0b", p, 3) // addl %ebx,d32(%ebx,%ecx)
|
||||||
|
) {
|
||||||
|
page_offset = 0u - get_te32(3+ p);
|
||||||
|
}
|
||||||
|
if (0==memcmp("\x89\xeb", p, 2) // movl %ebp,%ebx
|
||||||
|
&& 0==memcmp("\x81\xeb", 2+ p, 2) // subl $imm32,%ebx
|
||||||
|
) {
|
||||||
|
physical_start = get_te32(4+ p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkAlreadyPacked(obuf + setup_size, UPX_MIN(file_size - setup_size, (off_t)1024));
|
checkAlreadyPacked(obuf + setup_size, UPX_MIN(file_size - setup_size, (off_t)1024));
|
||||||
|
|
||||||
@@ -208,15 +288,24 @@ int PackVmlinuzI386::decompressKernel()
|
|||||||
if (fd_pos != file_size)
|
if (fd_pos != file_size)
|
||||||
{
|
{
|
||||||
//printf("fd_pos: %ld, file_size: %ld\n", (long)fd_pos, (long)file_size);
|
//printf("fd_pos: %ld, file_size: %ld\n", (long)fd_pos, (long)file_size);
|
||||||
throwCantPack("trailing bytes after kernel image; use option '-f' to force packing");
|
|
||||||
|
// linux-2.6.21.5/arch/i386/boot/compressed/vmlinux.lds
|
||||||
|
// puts .data.compressed ahead of .text, .rodata, etc;
|
||||||
|
// so piggy.o need not be last in bzImage. Alas.
|
||||||
|
//throwCantPack("trailing bytes after kernel image; use option '-f' to force packing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// see /usr/src/linux/arch/i386/kernel/head.S
|
// see /usr/src/linux/arch/i386/kernel/head.S
|
||||||
// 2.4.x: cld; mov $...,%eax
|
// 2.4.x: [cli;] cld; mov $...,%eax
|
||||||
if (memcmp(ibuf, "\xFC\xB8", 2) == 0) goto head_ok;
|
if (memcmp(ibuf, "\xFC\xB8", 2) == 0) goto head_ok;
|
||||||
// 2.6.x: cld; lgdt ...
|
if (memcmp(ibuf, "\xFA\xFC\xB8", 3) == 0) goto head_ok;
|
||||||
|
// 2.6.21.5 CONFIG_PARAVIRT mov %cs,%eax; test $3,%eax; jne ...;
|
||||||
|
if (memcmp(ibuf, "\x8c\xc8\xa9\x03\x00\x00\x00\x0f\x85", 9) == 0) goto head_ok;
|
||||||
|
if (memcmp(ibuf, "\x8c\xc8\xa8\x03\x0f\x85", 6) == 0) goto head_ok;
|
||||||
|
// 2.6.x: [cli;] cld; lgdt ...
|
||||||
if (memcmp(ibuf, "\xFC\x0F\x01", 3) == 0) goto head_ok;
|
if (memcmp(ibuf, "\xFC\x0F\x01", 3) == 0) goto head_ok;
|
||||||
|
if (memcmp(ibuf, "\xFA\xFC\x0F\x01", 4) == 0) goto head_ok;
|
||||||
// 2.6.x+grsecurity+strongswan+openwall+trustix: ljmp $0x10,...
|
// 2.6.x+grsecurity+strongswan+openwall+trustix: ljmp $0x10,...
|
||||||
if (ibuf[0] == 0xEA && memcmp(ibuf+5, "\x10\x00", 2) == 0) goto head_ok;
|
if (ibuf[0] == 0xEA && memcmp(ibuf+5, "\x10\x00", 2) == 0) goto head_ok;
|
||||||
// x86_64 2.6.x
|
// x86_64 2.6.x
|
||||||
@@ -227,6 +316,15 @@ int PackVmlinuzI386::decompressKernel()
|
|||||||
&& 0x0F==ibuf[19] && 0xA2==ibuf[20] // cpuid
|
&& 0x0F==ibuf[19] && 0xA2==ibuf[20] // cpuid
|
||||||
) goto head_ok;
|
) goto head_ok;
|
||||||
|
|
||||||
|
// cmpw $0x207,0x206(%esi) Debian vmlinuz-2.6.24-12-generic
|
||||||
|
if (0==memcmp("\x66\x81\xbe\x06\x02\x00\x00\x07\x02", ibuf, 9)) goto head_ok;
|
||||||
|
|
||||||
|
// testb $0x40,0x211(%esi) Fedora vmlinuz-2.6.25-0.218.rc8.git7.fc9.i686
|
||||||
|
if (0==memcmp("\xf6\x86\x11\x02\x00\x00\x40", ibuf, 7)) goto head_ok;
|
||||||
|
|
||||||
|
// rex.W prefix for x86_64
|
||||||
|
if (0x48==ibuf[0]) throwCantPack("x86_64 bzImage is not yet supported");
|
||||||
|
|
||||||
throwCantPack("unrecognized kernel architecture; use option '-f' to force packing");
|
throwCantPack("unrecognized kernel architecture; use option '-f' to force packing");
|
||||||
head_ok:
|
head_ok:
|
||||||
|
|
||||||
@@ -275,7 +373,7 @@ void PackVmlinuzI386::buildLoader(const Filter *ft)
|
|||||||
// prepare loader
|
// prepare loader
|
||||||
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
||||||
addLoader("LINUZ000",
|
addLoader("LINUZ000",
|
||||||
ph.first_offset_found == 1 ? "LINUZ001" : "",
|
ph.first_offset_found == 1 ? "LINUZ010" : "",
|
||||||
ft->id ? "LZCALLT1" : "",
|
ft->id ? "LZCALLT1" : "",
|
||||||
"LZIMAGE0",
|
"LZIMAGE0",
|
||||||
getDecompressorSections(),
|
getDecompressorSections(),
|
||||||
@@ -303,7 +401,7 @@ void PackVmlinuzI386::pack(OutputFile *fo)
|
|||||||
// compress
|
// compress
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
// limit stack size needed for runtime decompression
|
// 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);
|
compressWithFilters(&ft, 512, &cconf);
|
||||||
|
|
||||||
const unsigned lsize = getLoaderSize();
|
const unsigned lsize = getLoaderSize();
|
||||||
@@ -348,21 +446,30 @@ void PackBvmlinuzI386::buildLoader(const Filter *ft)
|
|||||||
{
|
{
|
||||||
// prepare loader
|
// prepare loader
|
||||||
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
initLoader(stub_i386_linux_kernel_vmlinuz, sizeof(stub_i386_linux_kernel_vmlinuz));
|
||||||
addLoader("LINUZ000",
|
if (0!=page_offset) { // relocatable kernel
|
||||||
ph.first_offset_found == 1 ? "LINUZ001" : "",
|
assert(0==ft->id || 0x40==(0xf0 & ft->id)); // others assume fixed buffer address
|
||||||
|
addLoader("LINUZ000,LINUZVGA,LINUZ101,LINUZ110",
|
||||||
|
((0!=config_physical_align) ? "LINUZ120" : "LINUZ130"),
|
||||||
|
"LINUZ140,LZCUTPOI,LINUZ141",
|
||||||
|
(ft->id ? "LINUZ145" : ""),
|
||||||
|
(ph.first_offset_found == 1 ? "LINUZ010" : ""),
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
addLoader("LINUZ000,LINUZVGA,LINUZ001",
|
||||||
|
ph.first_offset_found == 1 ? "LINUZ010" : "",
|
||||||
(0x40==(0xf0 & ft->id)) ? "LZCKLLT1" : (ft->id ? "LZCALLT1" : ""),
|
(0x40==(0xf0 & ft->id)) ? "LZCKLLT1" : (ft->id ? "LZCALLT1" : ""),
|
||||||
"LBZIMAGE,IDENTSTR",
|
"LBZIMAGE,IDENTSTR",
|
||||||
"+40", // align the stuff to 4 byte boundary
|
"+40", // align the stuff to 4 byte boundary
|
||||||
"UPX1HEAD", // 32 byte
|
"UPX1HEAD", // 32 byte
|
||||||
"LZCUTPOI",
|
"LZCUTPOI",
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
// fake alignment for the start of the decompressor
|
// fake alignment for the start of the decompressor
|
||||||
linker->defineSymbol("LZCUTPOI", 0x1000);
|
//linker->defineSymbol("LZCUTPOI", 0x1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
addLoader(getDecompressorSections(), NULL);
|
||||||
|
|
||||||
addLoader(getDecompressorSections(),
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
if (ft->id)
|
if (ft->id)
|
||||||
{
|
{
|
||||||
assert(ft->calls > 0);
|
assert(ft->calls > 0);
|
||||||
@@ -374,7 +481,27 @@ void PackBvmlinuzI386::buildLoader(const Filter *ft)
|
|||||||
}
|
}
|
||||||
addFilter32(ft->id);
|
addFilter32(ft->id);
|
||||||
}
|
}
|
||||||
|
if (0!=page_offset) {
|
||||||
|
addLoader("LINUZ150,IDENTSTR,+40,UPX1HEAD", NULL);
|
||||||
|
unsigned const l_len = getLoaderSize();
|
||||||
|
unsigned const c_len = ALIGN_UP(ph.c_len, 4u);
|
||||||
|
unsigned const e_len = getLoaderSectionStart("LINUZ141") -
|
||||||
|
getLoaderSectionStart("LINUZ110");
|
||||||
|
linker->defineSymbol("compressed_length", c_len);
|
||||||
|
linker->defineSymbol("load_physical_address", physical_start); // FIXME
|
||||||
|
if (0!=config_physical_align) {
|
||||||
|
linker->defineSymbol("neg_config_physical_align", 0u - config_physical_align);
|
||||||
|
}
|
||||||
|
linker->defineSymbol("neg_length_mov", 0u - ALIGN_UP(c_len + l_len, 4u));
|
||||||
|
linker->defineSymbol("neg_page_offset", 0u - page_offset);
|
||||||
|
//linker->defineSymbol("physical_start", physical_start);
|
||||||
|
linker->defineSymbol("unc_length", ph.u_len);
|
||||||
|
linker->defineSymbol("dec_offset", ph.overlap_overhead + e_len);
|
||||||
|
linker->defineSymbol("unc_offset", ph.overlap_overhead + ph.u_len - c_len);
|
||||||
|
}
|
||||||
|
else {
|
||||||
addLoader("LINUZ990", NULL);
|
addLoader("LINUZ990", NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -385,11 +512,15 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||||||
// prepare filter
|
// prepare filter
|
||||||
Filter ft(ph.level);
|
Filter ft(ph.level);
|
||||||
ft.buf_len = ph.u_len;
|
ft.buf_len = ph.u_len;
|
||||||
ft.addvalue = physical_start; // saves 4 bytes in unfilter code
|
ft.addvalue = 0; // The destination buffer might be relocated at runtime.
|
||||||
|
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
// limit stack size needed for runtime decompression
|
// 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
|
||||||
|
|
||||||
|
// FIXME: new stub allows most of low memory as stack for Bvmlinuz ?
|
||||||
|
//cconf.conf_lzma.max_num_probs = (0x99000 - 0x10250)>>1; // ushort: 560560 stack
|
||||||
|
|
||||||
compressWithFilters(&ft, 512, &cconf);
|
compressWithFilters(&ft, 512, &cconf);
|
||||||
|
|
||||||
// align everything to dword boundary - it is easier to handle
|
// align everything to dword boundary - it is easier to handle
|
||||||
@@ -418,6 +549,7 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||||||
const int e_len = getLoaderSectionStart("LZCUTPOI");
|
const int e_len = getLoaderSectionStart("LZCUTPOI");
|
||||||
assert(e_len > 0);
|
assert(e_len > 0);
|
||||||
|
|
||||||
|
if (0==page_offset) { // not relocatable kernel
|
||||||
const unsigned d_len4 = ALIGN_UP(lsize - e_len, 4u);
|
const unsigned d_len4 = ALIGN_UP(lsize - e_len, 4u);
|
||||||
const unsigned decompr_pos = ALIGN_UP(ph.u_len + ph.overlap_overhead, 16u);
|
const unsigned decompr_pos = ALIGN_UP(ph.u_len + ph.overlap_overhead, 16u);
|
||||||
const unsigned copy_size = c_len + d_len4;
|
const unsigned copy_size = c_len + d_len4;
|
||||||
@@ -429,10 +561,13 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||||||
linker->defineSymbol("words_to_copy", copy_size / 4);
|
linker->defineSymbol("words_to_copy", copy_size / 4);
|
||||||
linker->defineSymbol("copy_dest", physical_start + edi);
|
linker->defineSymbol("copy_dest", physical_start + edi);
|
||||||
linker->defineSymbol("copy_source", bzimage_offset + esi);
|
linker->defineSymbol("copy_source", bzimage_offset + esi);
|
||||||
|
}
|
||||||
|
|
||||||
defineFilterSymbols(&ft);
|
defineFilterSymbols(&ft);
|
||||||
defineDecompressorSymbols();
|
defineDecompressorSymbols();
|
||||||
|
if (0==page_offset) {
|
||||||
linker->defineSymbol("original_entry", physical_start);
|
linker->defineSymbol("original_entry", physical_start);
|
||||||
|
}
|
||||||
linker->defineSymbol("stack_offset", stack_offset_during_uncompression);
|
linker->defineSymbol("stack_offset", stack_offset_during_uncompression);
|
||||||
relocateLoader();
|
relocateLoader();
|
||||||
|
|
||||||
@@ -441,11 +576,21 @@ void PackBvmlinuzI386::pack(OutputFile *fo)
|
|||||||
patchPackHeader(loader, lsize);
|
patchPackHeader(loader, lsize);
|
||||||
|
|
||||||
boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf);
|
boot_sect_t * const bs = (boot_sect_t *) ((unsigned char *) setup_buf);
|
||||||
bs->sys_size = (ALIGN_UP(lsize + c_len, 16u) / 16) & 0xffff;
|
bs->sys_size = (ALIGN_UP(lsize + c_len, 16u) / 16);
|
||||||
|
|
||||||
fo->write(setup_buf, setup_buf.getSize());
|
fo->write(setup_buf, setup_buf.getSize());
|
||||||
|
|
||||||
|
unsigned const e_pfx = (0==page_offset) ? 0 : getLoaderSectionStart("LINUZ110");
|
||||||
|
if (0!=page_offset) {
|
||||||
|
fo->write(loader, e_pfx);
|
||||||
|
}
|
||||||
|
else {
|
||||||
fo->write(loader, e_len);
|
fo->write(loader, e_len);
|
||||||
|
}
|
||||||
fo->write(obuf, c_len);
|
fo->write(obuf, c_len);
|
||||||
|
if (0!=page_offset) {
|
||||||
|
fo->write(loader + e_pfx, e_len - e_pfx);
|
||||||
|
}
|
||||||
fo->write(loader + e_len, lsize - e_len);
|
fo->write(loader + e_len, lsize - e_len);
|
||||||
#if 0
|
#if 0
|
||||||
printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize());
|
printf("%-13s: setup : %8ld bytes\n", getName(), (long) setup_buf.getSize());
|
||||||
@@ -479,7 +624,7 @@ int PackVmlinuzI386::canUnpack()
|
|||||||
void PackVmlinuzI386::unpack(OutputFile *fo)
|
void PackVmlinuzI386::unpack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
// no uncompression support for this format, so that
|
// no uncompression support for this format, so that
|
||||||
// it is possible to remove the original deflate code (>10KB)
|
// it is possible to remove the original deflate code (>10 KiB)
|
||||||
|
|
||||||
// FIXME: but we could write the uncompressed "vmlinux" image
|
// FIXME: but we could write the uncompressed "vmlinux" image
|
||||||
|
|
||||||
|
|||||||
+8
-5
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -68,8 +68,8 @@ protected:
|
|||||||
char _[0x1f1];
|
char _[0x1f1];
|
||||||
unsigned char setup_sects;
|
unsigned char setup_sects;
|
||||||
char __[2];
|
char __[2];
|
||||||
LE16 sys_size;
|
LE32 sys_size;
|
||||||
char ___[8];
|
char ___[6];
|
||||||
LE16 boot_flag; // 0xAA55
|
LE16 boot_flag; // 0xAA55
|
||||||
// 0x200
|
// 0x200
|
||||||
char ____[2];
|
char ____[2];
|
||||||
@@ -88,6 +88,8 @@ protected:
|
|||||||
MemBuffer setup_buf;
|
MemBuffer setup_buf;
|
||||||
int setup_size;
|
int setup_size;
|
||||||
unsigned physical_start;
|
unsigned physical_start;
|
||||||
|
unsigned page_offset;
|
||||||
|
unsigned config_physical_align;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -103,6 +105,7 @@ public:
|
|||||||
virtual int getFormat() const { return UPX_F_BVMLINUZ_i386; }
|
virtual int getFormat() const { return UPX_F_BVMLINUZ_i386; }
|
||||||
virtual const char *getName() const { return "bvmlinuz/386"; }
|
virtual const char *getName() const { return "bvmlinuz/386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-linux.kernel.bvmlinuz"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-linux.kernel.bvmlinuz"; }
|
||||||
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
virtual void pack(OutputFile *fo);
|
virtual void pack(OutputFile *fo);
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+5
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -42,7 +42,8 @@ public:
|
|||||||
virtual int getVersion() const { return 13; }
|
virtual int getVersion() const { return 13; }
|
||||||
virtual int getFormat() const { return UPX_F_WIN16_NE; }
|
virtual int getFormat() const { return UPX_F_WIN16_NE; }
|
||||||
virtual const char *getName() const { return "win16/ne"; }
|
virtual const char *getName() const { return "win16/ne"; }
|
||||||
virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_286 ? "i286-win16.ne" : "i386-win16.ne"; }
|
//virtual const char *getFullName(const options_t *o) const { return o && o->cpu == o->CPU_286 ? "i286-win16.ne" : "i386-win16.ne"; }
|
||||||
|
virtual const char *getFullName(const options_t *) const { return "i286-win16.ne"; }
|
||||||
virtual const int *getCompressionMethods(int method, int level) const;
|
virtual const int *getCompressionMethods(int method, int level) const;
|
||||||
virtual const int *getFilters() const;
|
virtual const int *getFilters() const;
|
||||||
|
|
||||||
|
|||||||
+12
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -592,6 +592,10 @@ void PackW32Pe::buildLoader(const Filter *ft)
|
|||||||
|
|
||||||
void PackW32Pe::pack(OutputFile *fo)
|
void PackW32Pe::pack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
|
// FIXME: we need to think about better support for --exact
|
||||||
|
if (opt->exact)
|
||||||
|
throwCantPackExact();
|
||||||
|
|
||||||
const unsigned objs = ih.objects;
|
const unsigned objs = ih.objects;
|
||||||
isection = new pe_section_t[objs];
|
isection = new pe_section_t[objs];
|
||||||
fi->seek(pe_offset+sizeof(ih),SEEK_SET);
|
fi->seek(pe_offset+sizeof(ih),SEEK_SET);
|
||||||
@@ -629,10 +633,12 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
else if (opt->win32_pe.strip_relocs < 0)
|
else if (opt->win32_pe.strip_relocs < 0)
|
||||||
opt->win32_pe.strip_relocs = (ih.imagebase >= 0x400000);
|
opt->win32_pe.strip_relocs = (ih.imagebase >= 0x400000);
|
||||||
if (opt->win32_pe.strip_relocs)
|
if (opt->win32_pe.strip_relocs)
|
||||||
|
{
|
||||||
if (ih.imagebase < 0x400000)
|
if (ih.imagebase < 0x400000)
|
||||||
throwCantPack("--strip-relocs is not allowed when imagebase < 0x400000");
|
throwCantPack("--strip-relocs is not allowed when imagebase < 0x400000");
|
||||||
else
|
else
|
||||||
ih.flags |= RELOCS_STRIPPED;
|
ih.flags |= RELOCS_STRIPPED;
|
||||||
|
}
|
||||||
|
|
||||||
if (memcmp(isection[0].name,"UPX",3) == 0)
|
if (memcmp(isection[0].name,"UPX",3) == 0)
|
||||||
throwAlreadyPackedByUPX();
|
throwAlreadyPackedByUPX();
|
||||||
@@ -1021,6 +1027,8 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
oh.codebase = osection[1].vaddr;
|
oh.codebase = osection[1].vaddr;
|
||||||
// oh.headersize = osection[0].rawdataptr;
|
// oh.headersize = osection[0].rawdataptr;
|
||||||
oh.headersize = rvamin;
|
oh.headersize = rvamin;
|
||||||
|
if (rvamin < osection[0].rawdataptr)
|
||||||
|
throwCantPack("object alignment too small");
|
||||||
|
|
||||||
if (opt->win32_pe.strip_relocs && !isdll)
|
if (opt->win32_pe.strip_relocs && !isdll)
|
||||||
oh.flags |= RELOCS_STRIPPED;
|
oh.flags |= RELOCS_STRIPPED;
|
||||||
@@ -1029,7 +1037,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
// set_le32(ibuf + ic,get_le32("UPX "));
|
// set_le32(ibuf + ic,get_le32("UPX "));
|
||||||
ibuf.clear(0, oh.filealign);
|
ibuf.clear(0, oh.filealign);
|
||||||
|
|
||||||
info("Image size change: %u -> %u kBytes",
|
info("Image size change: %u -> %u KiB",
|
||||||
ih.imagesize / 1024, oh.imagesize / 1024);
|
ih.imagesize / 1024, oh.imagesize / 1024);
|
||||||
|
|
||||||
infoHeader("[Writing compressed file]");
|
infoHeader("[Writing compressed file]");
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
<mfx@users.sourceforge.net> <ml1050@users.sourceforge.net>
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -433,7 +433,7 @@ void PackWcle::encodeImage(Filter *ft)
|
|||||||
// prepare filter [already done]
|
// prepare filter [already done]
|
||||||
// compress
|
// compress
|
||||||
upx_compress_config_t cconf; cconf.reset();
|
upx_compress_config_t cconf; cconf.reset();
|
||||||
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(ibuf, isize,
|
compressWithFilters(ibuf, isize,
|
||||||
oimage + RESERVED,
|
oimage + RESERVED,
|
||||||
ibuf + ft->addvalue, ft->buf_len,
|
ibuf + ft->addvalue, ft->buf_len,
|
||||||
|
|||||||
+3
-3
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2007 Laszlo Molnar
|
Copyright (C) 1996-2008 Laszlo Molnar
|
||||||
All Rights Reserved.
|
All Rights Reserved.
|
||||||
|
|
||||||
UPX and the UCL library are free software; you can redistribute them
|
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.
|
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer Laszlo Molnar
|
Markus F.X.J. Oberhumer Laszlo Molnar
|
||||||
markus@oberhumer.com ml1050@users.sourceforge.net
|
<markus@oberhumer.com> <ml1050@users.sourceforge.net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user