Compare commits
128 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7082594bbc | |||
| 36dd35f238 | |||
| 9c9fb6a485 | |||
| 5438a4837b | |||
| 84996e8cb6 | |||
| 87a368a857 | |||
| 21412d93dd | |||
| 0b11ff22b4 | |||
| 8fafa78796 | |||
| c43158f8a2 | |||
| 92ad524947 | |||
| b362a61863 | |||
| 468fec38d7 | |||
| 89830a5ae0 | |||
| 5977c296bd | |||
| 47d5792d97 | |||
| 25d706a913 | |||
| 048236aaaa | |||
| d442c58fd1 | |||
| f890f6bb09 | |||
| 036d466790 | |||
| dee47ba2d8 | |||
| be96c28b77 | |||
| ad1c0f578e | |||
| c8f7b1b72c | |||
| c89702ae84 | |||
| 2d29a82250 | |||
| b36c65e654 | |||
| 09b072b908 | |||
| 0ae9fee350 | |||
| 1579182ed9 | |||
| 074671aa71 | |||
| 36b7c47247 | |||
| 424d5b3025 | |||
| 8a5d352733 | |||
| f383629282 | |||
| a6d717cb04 | |||
| 84a5753301 | |||
| 5d2d9c7e81 | |||
| 82801d1411 | |||
| 340c3963d8 | |||
| ef15cf9847 | |||
| 4d613ccfa7 | |||
| 43ce34d547 | |||
| eda074cd80 | |||
| a2396d82f6 | |||
| a38721db93 | |||
| a06e811717 | |||
| 86e534ff75 | |||
| 640d5b2dec | |||
| 57e9b27085 | |||
| c56eefc739 | |||
| cf28306997 | |||
| 10acf3ddd1 | |||
| fed3ed9f9a | |||
| 260138ba11 | |||
| 67f7e0089c | |||
| d4a22c7851 | |||
| 06cf986490 | |||
| adf9aa04ce | |||
| 69f66fbe52 | |||
| d061005c89 | |||
| f6ee8b9f04 | |||
| 31af22c2ff | |||
| c421e3f243 | |||
| 6e92902407 | |||
| 6256381dc3 | |||
| b247b051ea | |||
| afbd553622 | |||
| 36bc14e884 | |||
| 9c5d0ff2ff | |||
| cfa6c8ddf6 | |||
| 21924bf022 | |||
| eea33f6019 | |||
| 66d48ae808 | |||
| de9b9fd0b1 | |||
| ece7384be4 | |||
| 0c052e4506 | |||
| 1996a0a3d6 | |||
| 679ad9b8c6 | |||
| d4983731e7 | |||
| 4fec3c8f34 | |||
| 836fd2565f | |||
| 54618064a1 | |||
| 519e3e01ae | |||
| aec8f81358 | |||
| c1d6bf4366 | |||
| 9bf2b79d9e | |||
| 4d98408995 | |||
| 7b466388f9 | |||
| b926fb3c66 | |||
| 6c8d5c0d0e | |||
| 5a1d234260 | |||
| fd6d42c297 | |||
| 7310ad6e92 | |||
| 7e47b1348d | |||
| 1e3555a6b7 | |||
| 9a67ce5968 | |||
| 279d7955f8 | |||
| db977c0bf5 | |||
| ba6bc59818 | |||
| 6e8be0578c | |||
| 92f7d16b5e | |||
| 40bb3c2f5e | |||
| 56a6096221 | |||
| ee37b42a91 | |||
| 0806e61df4 | |||
| 279ffeeefa | |||
| 80c5ee2479 | |||
| 16208544e5 | |||
| 6afeb24fdb | |||
| e6357b81eb | |||
| dfc2efe8a6 | |||
| f28b96f431 | |||
| a10293f8f7 | |||
| b1f02f91d7 | |||
| e76fa45d86 | |||
| 06f43892a5 | |||
| a094332b0d | |||
| 7b8779f534 | |||
| 371bf20d19 | |||
| 0f633ddd15 | |||
| 7886ca7f5f | |||
| 9b4c11954d | |||
| a1b724f30a | |||
| 7c3b2fb9cc | |||
| acef68d67e | |||
| 7e393d5f1e |
@@ -9,6 +9,7 @@ syntax: regexp
|
|||||||
syntax: glob
|
syntax: glob
|
||||||
|
|
||||||
.depend
|
.depend
|
||||||
|
*.qtcreator.{config,creator,creator.user,files,includes}
|
||||||
Makevars.local
|
Makevars.local
|
||||||
|
|
||||||
*.a
|
*.a
|
||||||
@@ -42,7 +43,9 @@ src/*.ttp
|
|||||||
|
|
||||||
stub/**MMakefile
|
stub/**MMakefile
|
||||||
stub/**.*-stamp
|
stub/**.*-stamp
|
||||||
stub/tmp*/*
|
##stub/tmp*/*
|
||||||
|
stub/tmp*/*.{bin,bin.bindump,bin.disasm,d,map,o,o.disasm}
|
||||||
|
stub/tmp*/mips{,el}.r3000-*.{i,s}
|
||||||
stub/**/tmp*/*
|
stub/**/tmp*/*
|
||||||
|
|
||||||
stub/tools/armpe/armpe_tester{,.exe,.out}
|
stub/tools/armpe/armpe_tester{,.exe,.out}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
087cafe682c014863b4aa8a6ea21431251a6ad3c RELEASE_308
|
||||||
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
|
140415ffbcef86a42b4d672249927364430d3d38 RELEASE_111
|
||||||
155618b5b7930f97bd84b82befa7a4fd6672efb3 RELEASE_304
|
155618b5b7930f97bd84b82befa7a4fd6672efb3 RELEASE_304
|
||||||
1931f4f28074970ec53b4cd21c7fc181b4da8e5e RELEASE_301
|
1931f4f28074970ec53b4cd21c7fc181b4da8e5e RELEASE_301
|
||||||
@@ -7,6 +8,7 @@
|
|||||||
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
|
396983c065fc743cb5b9703e266ca87eeff8a6ee RELEASE_291
|
||||||
46f3a6cca02603000fadc16637b02e30caddd909 RELEASE_302
|
46f3a6cca02603000fadc16637b02e30caddd909 RELEASE_302
|
||||||
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
|
70402aeee6e0e4fc2889658ed8cee44461c0b0a8 RELEASE_200
|
||||||
|
7c6747c82b167368344a238b1a3a87c2a4fa6a18 RELEASE_306
|
||||||
95c558f81a0b8d5bb2bede4c8208bb84ae7d1e58 RELEASE_303
|
95c558f81a0b8d5bb2bede4c8208bb84ae7d1e58 RELEASE_303
|
||||||
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
|
a1c61174f54aac714f59ac20fcba839d71e64c5c RELEASE_292
|
||||||
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
|
a916a2fe22de45167d25abcb40008315f415221c RELEASE_201
|
||||||
@@ -20,3 +22,4 @@ eb1ce56dce7dd1835964362470610925963b9043 RELEASE_110
|
|||||||
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
|
ed96891ef795bceec6b7ff3ca1ca7764431bfb39 RELEASE_191
|
||||||
ef9c7f2c9658d73a9b5ab2ed291483d2bbcd8bc7 RELEASE_300
|
ef9c7f2c9658d73a9b5ab2ed291483d2bbcd8bc7 RELEASE_300
|
||||||
efa52753e366300c0e0ebe20631adcb24ed3c15b RELEASE_293
|
efa52753e366300c0e0ebe20631adcb24ed3c15b RELEASE_293
|
||||||
|
fe7acf61147e7031fcc304aae47ca2352056815d RELEASE_307
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ test file.
|
|||||||
|
|
||||||
win32/pe
|
win32/pe
|
||||||
--------
|
--------
|
||||||
* writeable shared sections (`--force' *may* work)
|
* writable shared sections (`--force' *may* work)
|
||||||
* certificates in the image
|
* certificates in the image
|
||||||
* compressing files which contain a big BSS requires lots of memory
|
* compressing files which contain a big BSS requires lots of memory
|
||||||
during compression
|
during compression
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# UPX toplevel Makefile - needs GNU make 3.81 or better
|
# UPX toplevel Makefile - needs GNU make 3.81 or better
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
|
|||||||
@@ -2,6 +2,28 @@
|
|||||||
User visible changes for UPX
|
User visible changes for UPX
|
||||||
==================================================================
|
==================================================================
|
||||||
|
|
||||||
|
Changes in 3.09 (18 Feb 2013):
|
||||||
|
* New option --preserve-build-id for GNU ELF.
|
||||||
|
* Allow for code signing and LC_UUID on Mac OS X executables.
|
||||||
|
* Allow non-contiguous LC_SEGMENTs and 0==.vmsize for Mach-O.
|
||||||
|
* Allow zero-filled final page in PackUnix::canUnpack().
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.08 (12 Dec 2011):
|
||||||
|
* Fix allocation in runtime stub for darwin.macho-entry (i386 and amd64).
|
||||||
|
* Compress shared library on ELF i386 only [ld.so threatens even this case].
|
||||||
|
* Attempt to support ELF on QNX 6.3.0 for armel (experimental).
|
||||||
|
* Better diagnostic when ELF -fPIC is needed.
|
||||||
|
* PT_NOTE improvements for *BSD.
|
||||||
|
* Preserve more ELF .e_flags on ARM.
|
||||||
|
* Minor code improvements for ELF stubs.
|
||||||
|
* Defend against another flavor of corrupt PE header.
|
||||||
|
* bug fixes
|
||||||
|
|
||||||
|
Changes in 3.07 (08 Sep 2010):
|
||||||
|
* win32/pe: fixed relocation handling for files with *no* TLS callbacks
|
||||||
|
[severe bug introduced in 3.06]
|
||||||
|
|
||||||
Changes in 3.06 (04 Sep 2010):
|
Changes in 3.06 (04 Sep 2010):
|
||||||
* win32/pe: TLS callback support contributed by Stefan Widmann. Thanks!
|
* win32/pe: TLS callback support contributed by Stefan Widmann. Thanks!
|
||||||
* bug fixes
|
* bug fixes
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 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-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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.
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,6 +71,12 @@ Tools needed to build/modify the UPX sources
|
|||||||
|
|
||||||
- GNU make 3.81 or better
|
- GNU make 3.81 or better
|
||||||
|
|
||||||
|
- zlib and zlib-devel [or zlib-dev] software packages for your
|
||||||
|
host environment, or via http://www.cygwin.org/setup.exe
|
||||||
|
|
||||||
|
- lzma SDK, such as from https://sourceforge.net/projects/sevenzip/
|
||||||
|
files/LZMA%20SDK/4.43/
|
||||||
|
|
||||||
|
|
||||||
To compile the packer sources
|
To compile the packer sources
|
||||||
-----------------------------
|
-----------------------------
|
||||||
@@ -85,6 +91,7 @@ To compile the packer sources
|
|||||||
to your unpacked lzma443.tar.bz2 source directory, e.g.
|
to your unpacked lzma443.tar.bz2 source directory, e.g.
|
||||||
|
|
||||||
export UPX_LZMADIR=$HOME/local/src/lzma-4.43 (Unix)
|
export UPX_LZMADIR=$HOME/local/src/lzma-4.43 (Unix)
|
||||||
|
export UPX_LZMA_VERSION=0x443 # perhaps 0x459,0x458,0x457,0x449,0x442
|
||||||
|
|
||||||
Finally type
|
Finally type
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
|
|
||||||
The Ultimate Packer for eXecutables
|
The Ultimate Packer for eXecutables
|
||||||
Copyright (c) 1996-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
-1
@@ -1,5 +1,5 @@
|
|||||||
Decompressing ELF Directly to Memory on Linux/x86
|
Decompressing ELF Directly to Memory on Linux/x86
|
||||||
Copyright (C) 2000-2010 John F. Reiser jreiser@BitWagon.com
|
Copyright (C) 2000-2013 John F. Reiser jreiser@BitWagon.com
|
||||||
|
|
||||||
References:
|
References:
|
||||||
<elf.h> definitions for the ELF file format
|
<elf.h> definitions for the ELF file format
|
||||||
@@ -76,6 +76,21 @@ and previous versions did this by default with no option. However,
|
|||||||
too much other software erroneously assumes that /proc/self/exe
|
too much other software erroneously assumes that /proc/self/exe
|
||||||
always exists.
|
always exists.
|
||||||
|
|
||||||
|
On arm*-linux-elf there is no good address at which to retain one
|
||||||
|
page of the compressed executable. Pages below the usual .p_vaddr
|
||||||
|
0x8000 (32KiB) are rejected by the kernel. Using a page above the
|
||||||
|
original uncompressed brk(0) would require placing the entire initial
|
||||||
|
compressed program above uncompressed brk(0), which would significantly
|
||||||
|
increase the running brk(0); but too many programs break if brk(0)
|
||||||
|
moves. Thus on arm*-linux-elf the compressed executable begins
|
||||||
|
with 0x8000==.p_vaddr, all pages mapped by execve() that are also
|
||||||
|
occupied by decompressed bytes are removed before overwriting, and
|
||||||
|
/proc/self/exe becomes a "(deleted)" symlink. It might be possible
|
||||||
|
to preserve /proc/self/exe if the original uncompressed executable
|
||||||
|
were created with 0x9000==.p_vaddr (one page higher than the usual
|
||||||
|
0x8000) so that the compressed page mapped at 0x8000 would linger.
|
||||||
|
[This has not been tested.]
|
||||||
|
|
||||||
Linux stores the pathname argument that was specified to execve()
|
Linux stores the pathname argument that was specified to execve()
|
||||||
immediately after the '\0' which terminates the character string of the
|
immediately after the '\0' which terminates the character string of the
|
||||||
last environment variable [as of execve()]. This is true for at least
|
last environment variable [as of execve()]. This is true for at least
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ code 127, and a record will be added to the history file
|
|||||||
|
|
||||||
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
In "targeted enforcing" mode, SELinux pays close attention mostly to
|
||||||
designated processes that run with elevated privileges: web server,
|
designated processes that run with elevated privileges: web server,
|
||||||
print server, login server, etc. Ordinary user excutables receive
|
print server, login server, etc. Ordinary user executables receive
|
||||||
much less scrutiny. However, one of the eventual goals of SELinux is to
|
much less scrutiny. However, one of the eventual goals of SELinux is to
|
||||||
eradicate runtime generation of instructions because of the possibility
|
eradicate runtime generation of instructions because of the possibility
|
||||||
for exploitation by malware (virus, trojan, key logger, privilege
|
for exploitation by malware (virus, trojan, key logger, privilege
|
||||||
|
|||||||
+5
-5
@@ -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-2010 Markus Oberhumer, Laszlo Molnar & John Reiser
|
Copyright (c) 1996-2013 Markus Oberhumer, Laszlo Molnar & John Reiser
|
||||||
http://upx.sourceforge.net
|
http://upx.sourceforge.net
|
||||||
|
|
||||||
|
|
||||||
@@ -933,13 +933,13 @@ Please report all bugs immediately to the authors.
|
|||||||
|
|
||||||
=head1 COPYRIGHT
|
=head1 COPYRIGHT
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
|
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 John F. Reiser
|
||||||
|
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2013 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.
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# UPX Makefile - needs GNU make 3.81 or better
|
# UPX Makefile - needs GNU make 3.81 or better
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
# Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
#
|
#
|
||||||
|
|
||||||
MAKEFLAGS += -rR
|
MAKEFLAGS += -rR
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -352,6 +352,7 @@ namespace MyLzma {
|
|||||||
|
|
||||||
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
struct InStream: public ISequentialInStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~InStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
const Byte *b_buf; size_t b_size; size_t b_pos;
|
const Byte *b_buf; size_t b_size; size_t b_pos;
|
||||||
void Init(const Byte *data, size_t size) {
|
void Init(const Byte *data, size_t size) {
|
||||||
@@ -372,6 +373,7 @@ STDMETHODIMP InStream::Read(void *data, UInt32 size, UInt32 *processedSize)
|
|||||||
|
|
||||||
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
struct OutStream : public ISequentialOutStream, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~OutStream() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
Byte *b_buf; size_t b_size; size_t b_pos; bool overflow;
|
||||||
void Init(Byte *data, size_t size) {
|
void Init(Byte *data, size_t size) {
|
||||||
@@ -397,6 +399,7 @@ STDMETHODIMP OutStream::Write(const void *data, UInt32 size, UInt32 *processedSi
|
|||||||
|
|
||||||
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
struct ProgressInfo : public ICompressProgressInfo, public CMyUnknownImp
|
||||||
{
|
{
|
||||||
|
virtual ~ProgressInfo() { }
|
||||||
MY_UNKNOWN_IMP
|
MY_UNKNOWN_IMP
|
||||||
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
STDMETHOD(SetRatioInfo)(const UInt64 *inSize, const UInt64 *outSize);
|
||||||
upx_callback_p cb;
|
upx_callback_p cb;
|
||||||
|
|||||||
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -34,7 +34,7 @@ int compress_ucl_dummy = 0;
|
|||||||
#else
|
#else
|
||||||
|
|
||||||
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
|
#if 1 && !(UCL_USE_ASM) && (ACC_ARCH_I386)
|
||||||
# if (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
# if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_WATCOMC)
|
||||||
# define UCL_USE_ASM 1
|
# define UCL_USE_ASM 1
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+12
-17
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -222,19 +222,14 @@
|
|||||||
#if (WITH_VALGRIND)
|
#if (WITH_VALGRIND)
|
||||||
# include <valgrind/memcheck.h>
|
# include <valgrind/memcheck.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(VALGRIND_MAKE_MEM_DEFINED)
|
||||||
#if !defined(VALGRIND_MAKE_WRITABLE)
|
# define VALGRIND_MAKE_MEM_DEFINED(addr,len) 0
|
||||||
# define VALGRIND_MAKE_WRITABLE(addr,len) 0
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VALGRIND_MAKE_READABLE)
|
#if !defined(VALGRIND_MAKE_MEM_NOACCESS)
|
||||||
# if 0
|
# define VALGRIND_MAKE_MEM_NOACCESS(addr,len) 0
|
||||||
# define VALGRIND_MAKE_READABLE(addr,len) (memset(addr,0,len), 0)
|
|
||||||
# else
|
|
||||||
# define VALGRIND_MAKE_READABLE(addr,len) 0
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VALGRIND_DISCARD)
|
#if !defined(VALGRIND_MAKE_MEM_UNDEFINED)
|
||||||
# define VALGRIND_DISCARD(handle) ((void)(&handle))
|
# define VALGRIND_MAKE_MEM_UNDEFINED(addr,len) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -326,7 +321,7 @@
|
|||||||
|
|
||||||
#if (ACC_CC_INTELC && (__INTEL_COMPILER < 800))
|
#if (ACC_CC_INTELC && (__INTEL_COMPILER < 800))
|
||||||
#elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386))
|
#elif (0 && (ACC_ARCH_AMD64 || ACC_ARCH_I386))
|
||||||
#elif (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE)
|
||||||
# define __packed_struct(s) struct s {
|
# define __packed_struct(s) struct s {
|
||||||
# define __packed_struct_end() } __attribute__((__packed__,__aligned__(1)));
|
# define __packed_struct_end() } __attribute__((__packed__,__aligned__(1)));
|
||||||
#elif (ACC_CC_WATCOMC)
|
#elif (ACC_CC_WATCOMC)
|
||||||
@@ -752,7 +747,7 @@ typedef ElfLinker Linker;
|
|||||||
// main.cpp
|
// main.cpp
|
||||||
extern const char *progname;
|
extern const char *progname;
|
||||||
bool set_ec(int ec);
|
bool set_ec(int ec);
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void e_exit(int ec) __attribute__((__noreturn__));
|
void e_exit(int ec) __attribute__((__noreturn__));
|
||||||
#else
|
#else
|
||||||
void e_exit(int ec);
|
void e_exit(int ec);
|
||||||
@@ -764,7 +759,7 @@ void printSetNl(int need_nl);
|
|||||||
void printClearLine(FILE *f = NULL);
|
void printClearLine(FILE *f = NULL);
|
||||||
void printErr(const char *iname, const Throwable *e);
|
void printErr(const char *iname, const Throwable *e);
|
||||||
void printUnhandledException(const char *iname, const std::exception *e);
|
void printUnhandledException(const char *iname, const std::exception *e);
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
|
void __acc_cdecl_va printErr(const char *iname, const char *format, ...)
|
||||||
__attribute__((__format__(__printf__,2,3)));
|
__attribute__((__format__(__printf__,2,3)));
|
||||||
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
|
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...)
|
||||||
@@ -774,7 +769,7 @@ void __acc_cdecl_va printErr(const char *iname, const char *format, ...);
|
|||||||
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
|
void __acc_cdecl_va printWarn(const char *iname, const char *format, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
void __acc_cdecl_va infoWarning(const char *format, ...)
|
void __acc_cdecl_va infoWarning(const char *format, ...)
|
||||||
__attribute__((__format__(__printf__,1,2)));
|
__attribute__((__format__(__printf__,1,2)));
|
||||||
void __acc_cdecl_va infoHeader(const char *format, ...)
|
void __acc_cdecl_va infoHeader(const char *format, ...)
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+13
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -410,6 +410,17 @@ void OutputFile::seek(off_t off, int whence)
|
|||||||
super::seek(off,whence);
|
super::seek(off,whence);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WARNING: fsync() does not exist in some Windows environments.
|
||||||
|
// This trick works only on UNIX-like systems.
|
||||||
|
//int OutputFile::read(void *buf, int len)
|
||||||
|
//{
|
||||||
|
// fsync(_fd);
|
||||||
|
// InputFile infile;
|
||||||
|
// infile.open(this->getName(), O_RDONLY);
|
||||||
|
// infile.seek(this->tell(), SEEK_SET);
|
||||||
|
// return infile.read(buf, len);
|
||||||
|
//}
|
||||||
|
|
||||||
void OutputFile::set_extent(off_t offset, off_t length)
|
void OutputFile::set_extent(off_t offset, off_t length)
|
||||||
{
|
{
|
||||||
super::set_extent(offset, length);
|
super::set_extent(offset, length);
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2004-2010 John F. Reiser
|
Copyright (C) 2004-2013 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
|
||||||
@@ -98,7 +98,7 @@ static int F(Filter *f)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
#if (W_CTO != 0)
|
#if (W_CTO != 0)
|
||||||
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != cto8); // this should not happen
|
assert((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) != (unsigned) cto8); // this should not happen
|
||||||
#endif
|
#endif
|
||||||
lastnoncall = ic;
|
lastnoncall = ic;
|
||||||
noncalls++;
|
noncalls++;
|
||||||
@@ -133,7 +133,7 @@ static int U(Filter *f)
|
|||||||
|
|
||||||
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
for (ic = 0; ic<=size4; ic+=4) if (COND(b,ic)) {
|
||||||
unsigned const word = get_be32(b+ic);
|
unsigned const word = get_be32(b+ic);
|
||||||
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == f->cto) {
|
if ((~(~0u<<W_CTO) & (word>>(24+2 - W_CTO))) == (unsigned) f->cto) {
|
||||||
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
unsigned const jc = word & (~(~0u<<(26 - W_CTO)) & (~0u<<2));
|
||||||
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
set_be32(b+ic, (0xfc000003&word)|(0x03fffffc&(jc-ic-addvalue)));
|
||||||
f->calls++;
|
f->calls++;
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+11
-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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -290,6 +290,11 @@ void show_help(int verbose)
|
|||||||
" --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"
|
||||||
"\n");
|
"\n");
|
||||||
|
con_fprintf(f,"Options for linux/elf:\n");
|
||||||
|
fg = con_fg(f,fg);
|
||||||
|
con_fprintf(f,
|
||||||
|
" --preserve-build-id copy .gnu.note.build-id to compressed output\n"
|
||||||
|
"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
con_fprintf(f, "file.. executables to (de)compress\n");
|
con_fprintf(f, "file.. executables to (de)compress\n");
|
||||||
@@ -400,10 +405,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-2010 Markus Franz Xaver Johannes Oberhumer\n");
|
fprintf(fp, "Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer\n");
|
||||||
fprintf(fp, "Copyright (C) 1996-2010 Laszlo Molnar\n");
|
fprintf(fp, "Copyright (C) 1996-2013 Laszlo Molnar\n");
|
||||||
fprintf(fp, "Copyright (C) 2000-2010 John F. Reiser\n");
|
fprintf(fp, "Copyright (C) 2000-2013 John F. Reiser\n");
|
||||||
fprintf(fp, "Copyright (C) 2002-2010 Jens Medoch\n");
|
fprintf(fp, "Copyright (C) 2002-2013 Jens Medoch\n");
|
||||||
#if (WITH_ZLIB)
|
#if (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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+33
-53
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -45,6 +45,18 @@ static bool update_capacity(unsigned size, unsigned *capacity)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __acc_cdecl_va internal_error(const char *format, ...)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
va_list ap;
|
||||||
|
|
||||||
|
va_start(ap, format);
|
||||||
|
vsnprintf(buf, sizeof(buf), format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
|
||||||
|
throwInternalError(buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
// Section
|
// Section
|
||||||
@@ -317,10 +329,7 @@ ElfLinker::Section *ElfLinker::findSection(const char *name, bool fatal) const
|
|||||||
if (strcmp(sections[ic]->name, name) == 0)
|
if (strcmp(sections[ic]->name, name) == 0)
|
||||||
return sections[ic];
|
return sections[ic];
|
||||||
if (fatal)
|
if (fatal)
|
||||||
{
|
internal_error("unknown section %s\n", name);
|
||||||
printf("unknown section %s\n", name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,10 +339,7 @@ ElfLinker::Symbol *ElfLinker::findSymbol(const char *name, bool fatal) const
|
|||||||
if (strcmp(symbols[ic]->name, name) == 0)
|
if (strcmp(symbols[ic]->name, name) == 0)
|
||||||
return symbols[ic];
|
return symbols[ic];
|
||||||
if (fatal)
|
if (fatal)
|
||||||
{
|
internal_error("unknown symbol %s\n", name);
|
||||||
printf("unknown symbol %s\n", name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -492,7 +498,7 @@ void ElfLinker::relocate()
|
|||||||
for (unsigned ic = 0; ic < nrelocations; ic++)
|
for (unsigned ic = 0; ic < nrelocations; ic++)
|
||||||
{
|
{
|
||||||
const Relocation *rel = relocations[ic];
|
const Relocation *rel = relocations[ic];
|
||||||
unsigned value;
|
unsigned value = 0;
|
||||||
|
|
||||||
if (rel->section->output == NULL)
|
if (rel->section->output == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -502,17 +508,11 @@ void ElfLinker::relocate()
|
|||||||
}
|
}
|
||||||
else if (strcmp(rel->value->section->name, "*UND*") == 0 &&
|
else if (strcmp(rel->value->section->name, "*UND*") == 0 &&
|
||||||
rel->value->offset == 0xdeaddead)
|
rel->value->offset == 0xdeaddead)
|
||||||
{
|
internal_error("undefined symbol '%s' referenced\n", rel->value->name);
|
||||||
printf("undefined symbol '%s' referenced\n", rel->value->name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
else if (rel->value->section->output == NULL)
|
else if (rel->value->section->output == NULL)
|
||||||
{
|
internal_error("can not apply reloc '%s:%x' without section '%s'\n",
|
||||||
printf("can not apply reloc '%s:%x' without section '%s'\n",
|
|
||||||
rel->section->name, rel->offset,
|
rel->section->name, rel->offset,
|
||||||
rel->value->section->name);
|
rel->value->section->name);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
value = rel->value->section->offset +
|
value = rel->value->section->offset +
|
||||||
@@ -529,10 +529,7 @@ void ElfLinker::defineSymbol(const char *name, unsigned value)
|
|||||||
{
|
{
|
||||||
Symbol *symbol = findSymbol(name);
|
Symbol *symbol = findSymbol(name);
|
||||||
if (strcmp(symbol->section->name, "*ABS*") == 0)
|
if (strcmp(symbol->section->name, "*ABS*") == 0)
|
||||||
{
|
internal_error("defineSymbol: symbol '%s' is *ABS*\n", name);
|
||||||
printf("defineSymbol: symbol '%s' is *ABS*\n", name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
else if (strcmp(symbol->section->name, "*UND*") == 0) // for undefined symbols
|
else if (strcmp(symbol->section->name, "*UND*") == 0) // for undefined symbols
|
||||||
symbol->offset = value;
|
symbol->offset = value;
|
||||||
else if (strcmp(symbol->section->name, name) == 0) // for sections
|
else if (strcmp(symbol->section->name, name) == 0) // for sections
|
||||||
@@ -545,10 +542,7 @@ void ElfLinker::defineSymbol(const char *name, unsigned value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
internal_error("defineSymbol: symbol '%s' already defined\n", name);
|
||||||
printf("defineSymbol: symbol '%s' already defined\n", name);
|
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// debugging support
|
// debugging support
|
||||||
@@ -602,8 +596,7 @@ void ElfLinker::alignWithByte(unsigned len, unsigned char b)
|
|||||||
void ElfLinker::relocate1(const Relocation *rel, upx_byte *,
|
void ElfLinker::relocate1(const Relocation *rel, upx_byte *,
|
||||||
unsigned, const char *)
|
unsigned, const char *)
|
||||||
{
|
{
|
||||||
printf("unknown relocation type '%s\n", rel->type);
|
internal_error("unknown relocation type '%s\n", rel->type);
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -616,16 +609,12 @@ void ElfLinker::relocate1(const Relocation *rel, upx_byte *,
|
|||||||
#if 0 // FIXME
|
#if 0 // FIXME
|
||||||
static void check8(const Relocation *rel, const upx_byte *location, int v, int d)
|
static void check8(const Relocation *rel, const upx_byte *location, int v, int d)
|
||||||
{
|
{
|
||||||
if (v < -128 || v > 127) {
|
if (v < -128 || v > 127)
|
||||||
printf("value out of range (%d) in reloc %s:%x\n",
|
internal_error("value out of range (%d) in reloc %s:%x\n",
|
||||||
v, rel->section->name, rel->offset);
|
v, rel->section->name, rel->offset);
|
||||||
abort();
|
if (d < -128 || d > 127)
|
||||||
}
|
internal_error("displacement target out of range (%d) in reloc %s:%x\n",
|
||||||
if (d < -128 || d > 127) {
|
|
||||||
printf("displacement target out of range (%d) in reloc %s:%x\n",
|
|
||||||
v, rel->section->name, rel->offset);
|
v, rel->section->name, rel->offset);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -651,11 +640,8 @@ void ElfLinkerAMD64::relocate1(const Relocation *rel, upx_byte *location,
|
|||||||
int displ = (signed char) *location + (int) value;
|
int displ = (signed char) *location + (int) value;
|
||||||
#endif
|
#endif
|
||||||
if (displ < -128 || displ > 127)
|
if (displ < -128 || displ > 127)
|
||||||
{
|
internal_error("target out of range (%d) in reloc %s:%x\n",
|
||||||
printf("target out of range (%d) in reloc %s:%x\n",
|
|
||||||
displ, rel->section->name, rel->offset);
|
displ, rel->section->name, rel->offset);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
*location += value;
|
*location += value;
|
||||||
}
|
}
|
||||||
else if (strcmp(type, "16") == 0)
|
else if (strcmp(type, "16") == 0)
|
||||||
@@ -857,19 +843,15 @@ void ElfLinkerPpc32::relocate1(const Relocation *rel, upx_byte *location,
|
|||||||
|
|
||||||
// Note that original (*location).displ is ignored.
|
// Note that original (*location).displ is ignored.
|
||||||
if (strcmp(type, "24") == 0) {
|
if (strcmp(type, "24") == 0) {
|
||||||
if (3& value) {
|
if (3& value)
|
||||||
printf("unaligned word diplacement");
|
internal_error("unaligned word diplacement");
|
||||||
abort();
|
|
||||||
}
|
|
||||||
// FIXME: displacment overflow?
|
// FIXME: displacment overflow?
|
||||||
set_be32(location, (0xfc000003 & get_be32(location)) +
|
set_be32(location, (0xfc000003 & get_be32(location)) +
|
||||||
(0x03fffffc & value));
|
(0x03fffffc & value));
|
||||||
}
|
}
|
||||||
else if (strcmp(type, "14") == 0) {
|
else if (strcmp(type, "14") == 0) {
|
||||||
if (3& value) {
|
if (3& value)
|
||||||
printf("unaligned word diplacement");
|
internal_error("unaligned word diplacement");
|
||||||
abort();
|
|
||||||
}
|
|
||||||
// FIXME: displacment overflow?
|
// FIXME: displacment overflow?
|
||||||
set_be32(location, (0xffff0003 & get_be32(location)) +
|
set_be32(location, (0xffff0003 & get_be32(location)) +
|
||||||
(0x0000fffc & value));
|
(0x0000fffc & value));
|
||||||
@@ -901,11 +883,9 @@ void ElfLinkerX86::relocate1(const Relocation *rel, upx_byte *location,
|
|||||||
#else
|
#else
|
||||||
int displ = (signed char) *location + (int) value;
|
int displ = (signed char) *location + (int) value;
|
||||||
#endif
|
#endif
|
||||||
if (range_check && (displ < -128 || displ > 127)) {
|
if (range_check && (displ < -128 || displ > 127))
|
||||||
printf("target out of range (%d,%d,%d) in reloc %s:%x\n",
|
internal_error("target out of range (%d,%d,%d) in reloc %s:%x\n",
|
||||||
displ, *location, value, rel->section->name, rel->offset);
|
displ, *location, value, rel->section->name, rel->offset);
|
||||||
abort();
|
|
||||||
}
|
|
||||||
*location += value;
|
*location += value;
|
||||||
}
|
}
|
||||||
else if (strcmp(type, "16") == 0)
|
else if (strcmp(type, "16") == 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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
//virtual void setLoaderAlignOffset(int phase);
|
//virtual void setLoaderAlignOffset(int phase);
|
||||||
virtual int addLoader(const char *sname);
|
virtual int addLoader(const char *sname);
|
||||||
void addLoader(const char *s, va_list ap);
|
void addLoader(const char *s, va_list ap);
|
||||||
#if 1 && (ACC_CC_GNUC >= 0x040100)
|
#if 1 && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x040100))
|
||||||
void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
|
void __acc_cdecl_va addLoaderVA(const char *s, ...) __attribute__((__sentinel__));
|
||||||
#else
|
#else
|
||||||
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
void __acc_cdecl_va addLoaderVA(const char *s, ...);
|
||||||
|
|||||||
+14
-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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -898,6 +898,9 @@ static int do_option(int optc, const char *arg)
|
|||||||
case 674:
|
case 674:
|
||||||
opt->o_unix.unmap_all_pages = true; // val ?
|
opt->o_unix.unmap_all_pages = true; // val ?
|
||||||
break;
|
break;
|
||||||
|
case 675:
|
||||||
|
opt->o_unix.preserve_build_id = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case '\0':
|
case '\0':
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1048,6 +1051,7 @@ static const struct mfx_option longopts[] =
|
|||||||
{"OpenBSD", 0x10, 0, 669},
|
{"OpenBSD", 0x10, 0, 669},
|
||||||
{"openbsd", 0x10, 0, 669},
|
{"openbsd", 0x10, 0, 669},
|
||||||
{"unmap-all-pages", 0x10, 0, 674}, // linux /proc/self/exe vanishes
|
{"unmap-all-pages", 0x10, 0, 674}, // linux /proc/self/exe vanishes
|
||||||
|
{"preserve-build-id", 0, 0, 675},
|
||||||
// watcom/le
|
// watcom/le
|
||||||
{"le", 0x10, 0, 620}, // produce LE output
|
{"le", 0x10, 0, 620}, // produce LE output
|
||||||
// win32/pe
|
// win32/pe
|
||||||
@@ -1285,9 +1289,13 @@ static bool test(void)
|
|||||||
COMPILE_TIME_ASSERT_ALIGNED1(test2_t)
|
COMPILE_TIME_ASSERT_ALIGNED1(test2_t)
|
||||||
COMPILE_TIME_ASSERT(sizeof(t2) == 7 + 21*sizeof(T))
|
COMPILE_TIME_ASSERT(sizeof(t2) == 7 + 21*sizeof(T))
|
||||||
#if defined(__acc_alignof)
|
#if defined(__acc_alignof)
|
||||||
|
#if (ACC_CC_CLANG && ACC_ARCH_AMD64)
|
||||||
|
// CBUG: clang-2.8 bug in 64-bit mode
|
||||||
|
#else
|
||||||
COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1)
|
COMPILE_TIME_ASSERT(__acc_alignof(t1) == 1)
|
||||||
COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1)
|
COMPILE_TIME_ASSERT(__acc_alignof(t2) == 1)
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
#if 1 && (ACC_CC_WATCOMC)
|
#if 1 && (ACC_CC_WATCOMC)
|
||||||
test1_t t11; COMPILE_TIME_ASSERT(sizeof(t11.a) <= sizeof(t11.b))
|
test1_t t11; COMPILE_TIME_ASSERT(sizeof(t11.a) <= sizeof(t11.b))
|
||||||
test2_t t22; COMPILE_TIME_ASSERT(sizeof(t22.a) <= sizeof(t22.b))
|
test2_t t22; COMPILE_TIME_ASSERT(sizeof(t22.a) <= sizeof(t22.b))
|
||||||
@@ -1366,7 +1374,7 @@ void upx_sanity_check(void)
|
|||||||
assert(TestBELE<BE64>::test());
|
assert(TestBELE<BE64>::test());
|
||||||
{
|
{
|
||||||
static const unsigned char dd[32]
|
static const unsigned char dd[32]
|
||||||
#if 1 && (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) && defined(__ELF__)
|
#if 1 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE) && defined(__ELF__)
|
||||||
__attribute__((__aligned__(16)))
|
__attribute__((__aligned__(16)))
|
||||||
#endif
|
#endif
|
||||||
= { 0, 0, 0, 0, 0, 0, 0,
|
= { 0, 0, 0, 0, 0, 0, 0,
|
||||||
@@ -1434,6 +1442,9 @@ int __acc_cdecl_main main(int argc, char *argv[])
|
|||||||
#if 0 && defined(__DJGPP__)
|
#if 0 && defined(__DJGPP__)
|
||||||
// LFN=n may cause problems with 2.03's _rename and mkdir under WinME
|
// LFN=n may cause problems with 2.03's _rename and mkdir under WinME
|
||||||
putenv("LFN=y");
|
putenv("LFN=y");
|
||||||
|
#endif
|
||||||
|
#if (ACC_OS_WIN32 || ACC_OS_WIN64) && (ACC_CC_MSC) && defined(_WRITE_ABORT_MSG) && defined(_CALL_REPORTFAULT)
|
||||||
|
_set_abort_behavior(_WRITE_ABORT_MSG, _WRITE_ABORT_MSG | _CALL_REPORTFAULT);
|
||||||
#endif
|
#endif
|
||||||
acc_wildargv(&argc, &argv);
|
acc_wildargv(&argc, &argv);
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+180
-126
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
|
Copyright (C) 2012 Markus Franz Xaver Johannes Oberhumer
|
||||||
|
Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||||
@@ -32,7 +34,7 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; see the file COPYING.
|
along with this program; see the file COPYING.
|
||||||
If not, write to the Free Software Foundation, Inc.,
|
If not, write to the Free Software Foundation, Inc.,
|
||||||
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
|
||||||
Markus F.X.J. Oberhumer
|
Markus F.X.J. Oberhumer
|
||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
@@ -41,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef __ACC_H_INCLUDED
|
#ifndef __ACC_H_INCLUDED
|
||||||
#define __ACC_H_INCLUDED 1
|
#define __ACC_H_INCLUDED 1
|
||||||
#define ACC_VERSION 20100808L
|
#define ACC_VERSION 20130212L
|
||||||
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
#if defined(__CYGWIN32__) && !defined(__CYGWIN__)
|
||||||
# define __CYGWIN__ __CYGWIN32__
|
# define __CYGWIN__ __CYGWIN32__
|
||||||
#endif
|
#endif
|
||||||
@@ -537,7 +539,7 @@
|
|||||||
# define ACC_INFO_CC "sdcc"
|
# define ACC_INFO_CC "sdcc"
|
||||||
# define ACC_INFO_CCVER ACC_PP_MACRO_EXPAND(SDCC)
|
# define ACC_INFO_CCVER ACC_PP_MACRO_EXPAND(SDCC)
|
||||||
#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
|
#elif defined(__PATHSCALE__) && defined(__PATHCC_PATCHLEVEL__)
|
||||||
# define ACC_CC_PATHSCALE (__PATHCC__ * 0x10000L + __PATHCC_MINOR__ * 0x100 + __PATHCC_PATCHLEVEL__)
|
# define ACC_CC_PATHSCALE (__PATHCC__ * 0x10000L + (__PATHCC_MINOR__+0) * 0x100 + (__PATHCC_PATCHLEVEL__+0))
|
||||||
# define ACC_INFO_CC "Pathscale C"
|
# define ACC_INFO_CC "Pathscale C"
|
||||||
# define ACC_INFO_CCVER __PATHSCALE__
|
# define ACC_INFO_CCVER __PATHSCALE__
|
||||||
#elif defined(__INTEL_COMPILER)
|
#elif defined(__INTEL_COMPILER)
|
||||||
@@ -553,19 +555,43 @@
|
|||||||
# define ACC_CC_PELLESC 1
|
# define ACC_CC_PELLESC 1
|
||||||
# define ACC_INFO_CC "Pelles C"
|
# define ACC_INFO_CC "Pelles C"
|
||||||
# define ACC_INFO_CCVER ACC_PP_MACRO_EXPAND(__POCC__)
|
# define ACC_INFO_CCVER ACC_PP_MACRO_EXPAND(__POCC__)
|
||||||
#elif defined(__llvm__) && defined(__GNUC__) && defined(__VERSION__)
|
#elif defined(__ARMCC_VERSION) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
||||||
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
# if defined(__GNUC_PATCHLEVEL__)
|
||||||
# define ACC_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)
|
# define ACC_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100 + (__GNUC_PATCHLEVEL__+0))
|
||||||
# else
|
# else
|
||||||
# define ACC_CC_LLVM (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100)
|
# define ACC_CC_ARMCC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100)
|
||||||
# endif
|
# endif
|
||||||
|
# define ACC_CC_ARMCC __ARMCC_VERSION
|
||||||
|
# define ACC_INFO_CC "ARM C Compiler"
|
||||||
|
# define ACC_INFO_CCVER __VERSION__
|
||||||
|
#elif defined(__clang__) && defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
||||||
|
# if defined(__GNUC_PATCHLEVEL__)
|
||||||
|
# define ACC_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100 + (__GNUC_PATCHLEVEL__+0))
|
||||||
|
# else
|
||||||
|
# define ACC_CC_CLANG_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100)
|
||||||
|
# endif
|
||||||
|
# if defined(__clang_major__) && defined(__clang_minor__) && defined(__clang_patchlevel__)
|
||||||
|
# define ACC_CC_CLANG_CLANG (__clang_major__ * 0x10000L + (__clang_minor__+0) * 0x100 + (__clang_patchlevel__+0))
|
||||||
|
# else
|
||||||
|
# define ACC_CC_CLANG_CLANG 0x010000L
|
||||||
|
# endif
|
||||||
|
# define ACC_CC_CLANG ACC_CC_CLANG_GNUC
|
||||||
|
# define ACC_INFO_CC "clang"
|
||||||
|
# define ACC_INFO_CCVER __VERSION__
|
||||||
|
#elif defined(__llvm__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && defined(__VERSION__)
|
||||||
|
# if defined(__GNUC_PATCHLEVEL__)
|
||||||
|
# define ACC_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100 + (__GNUC_PATCHLEVEL__+0))
|
||||||
|
# else
|
||||||
|
# define ACC_CC_LLVM_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100)
|
||||||
|
# endif
|
||||||
|
# define ACC_CC_LLVM ACC_CC_LLVM_GNUC
|
||||||
# define ACC_INFO_CC "llvm-gcc"
|
# define ACC_INFO_CC "llvm-gcc"
|
||||||
# define ACC_INFO_CCVER __VERSION__
|
# define ACC_INFO_CCVER __VERSION__
|
||||||
#elif defined(__GNUC__) && defined(__VERSION__)
|
#elif defined(__GNUC__) && defined(__VERSION__)
|
||||||
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
# if defined(__GNUC_MINOR__) && defined(__GNUC_PATCHLEVEL__)
|
||||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)
|
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100 + (__GNUC_PATCHLEVEL__+0))
|
||||||
# elif defined(__GNUC_MINOR__)
|
# elif defined(__GNUC_MINOR__)
|
||||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + __GNUC_MINOR__ * 0x100)
|
# define ACC_CC_GNUC (__GNUC__ * 0x10000L + (__GNUC_MINOR__+0) * 0x100)
|
||||||
# else
|
# else
|
||||||
# define ACC_CC_GNUC (__GNUC__ * 0x10000L)
|
# define ACC_CC_GNUC (__GNUC__ * 0x10000L)
|
||||||
# endif
|
# endif
|
||||||
@@ -575,6 +601,11 @@
|
|||||||
# define ACC_CC_ACK 1
|
# define ACC_CC_ACK 1
|
||||||
# define ACC_INFO_CC "Amsterdam Compiler Kit C"
|
# define ACC_INFO_CC "Amsterdam Compiler Kit C"
|
||||||
# define ACC_INFO_CCVER "unknown"
|
# define ACC_INFO_CCVER "unknown"
|
||||||
|
#elif defined(__ARMCC_VERSION) && !defined(__GNUC__)
|
||||||
|
# define ACC_CC_ARMCC __ARMCC_VERSION
|
||||||
|
# define ACC_CC_ARMCC_ARMCC __ARMCC_VERSION
|
||||||
|
# define ACC_INFO_CC "ARM C Compiler"
|
||||||
|
# define ACC_INFO_CCVER ACC_PP_MACRO_EXPAND(__ARMCC_VERSION)
|
||||||
#elif defined(__AZTEC_C__)
|
#elif defined(__AZTEC_C__)
|
||||||
# define ACC_CC_AZTECC 1
|
# define ACC_CC_AZTECC 1
|
||||||
# define ACC_INFO_CC "Aztec C"
|
# define ACC_INFO_CC "Aztec C"
|
||||||
@@ -710,6 +741,20 @@
|
|||||||
# define ACC_INFO_CC "unknown"
|
# define ACC_INFO_CC "unknown"
|
||||||
# define ACC_INFO_CCVER "unknown"
|
# define ACC_INFO_CCVER "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
#if (ACC_CC_GNUC) && defined(__OPEN64__)
|
||||||
|
# if defined(__OPENCC__) && defined(__OPENCC_MINOR__) && defined(__OPENCC_PATCHLEVEL__)
|
||||||
|
# define ACC_CC_OPEN64_OPEN64 (__OPENCC__ * 0x10000L + (__OPENCC_MINOR__+0) * 0x100 + (__OPENCC_PATCHLEVEL__+0))
|
||||||
|
# define ACC_CC_OPEN64_GNUC ACC_CC_GNUC
|
||||||
|
# define ACC_CC_OPEN64 ACC_CC_OPEN64_OPEN64
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if (ACC_CC_GNUC) && defined(__PCC__)
|
||||||
|
# if defined(__PCC__) && defined(__PCC_MINOR__) && defined(__PCC_MINORMINOR__)
|
||||||
|
# define ACC_CC_PCC_PCC (__PCC__ * 0x10000L + (__PCC_MINOR__+0) * 0x100 + (__PCC_MINORMINOR__+0))
|
||||||
|
# define ACC_CC_PCC_GNUC ACC_CC_GNUC
|
||||||
|
# define ACC_CC_PCC ACC_CC_PCC_PCC
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
#if 0 && (ACC_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER)
|
#if 0 && (ACC_CC_MSC && (_MSC_VER >= 1200)) && !defined(_MSC_FULL_VER)
|
||||||
# error "ACC_CC_MSC: _MSC_FULL_VER is not defined"
|
# error "ACC_CC_MSC: _MSC_FULL_VER is not defined"
|
||||||
#endif
|
#endif
|
||||||
@@ -1175,7 +1220,7 @@ extern "C" {
|
|||||||
#if (ACC_ARCH_I086 && ACC_CC_DMC)
|
#if (ACC_ARCH_I086 && ACC_CC_DMC)
|
||||||
#elif (ACC_CC_CILLY) && defined(__GNUC__)
|
#elif (ACC_CC_CILLY) && defined(__GNUC__)
|
||||||
# define ACC_SIZEOF_LONG_LONG 8
|
# define ACC_SIZEOF_LONG_LONG 8
|
||||||
#elif (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define ACC_SIZEOF_LONG_LONG 8
|
# define ACC_SIZEOF_LONG_LONG 8
|
||||||
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64 || defined(_WIN32)) && ACC_CC_MSC && (_MSC_VER >= 1400))
|
#elif ((ACC_OS_WIN32 || ACC_OS_WIN64 || defined(_WIN32)) && ACC_CC_MSC && (_MSC_VER >= 1400))
|
||||||
# define ACC_SIZEOF_LONG_LONG 8
|
# define ACC_SIZEOF_LONG_LONG 8
|
||||||
@@ -1388,6 +1433,9 @@ extern "C" {
|
|||||||
# define ACC_INFO_LIBC "isoc90"
|
# define ACC_INFO_LIBC "isoc90"
|
||||||
#elif (ACC_LIBC_ISOC99)
|
#elif (ACC_LIBC_ISOC99)
|
||||||
# define ACC_INFO_LIBC "isoc99"
|
# define ACC_INFO_LIBC "isoc99"
|
||||||
|
#elif (ACC_CC_ARMCC_ARMCC) && defined(__ARMCLIB_VERSION)
|
||||||
|
# define ACC_LIBC_ISOC90 1
|
||||||
|
# define ACC_INFO_LIBC "isoc90"
|
||||||
#elif defined(__dietlibc__)
|
#elif defined(__dietlibc__)
|
||||||
# define ACC_LIBC_DIETLIBC 1
|
# define ACC_LIBC_DIETLIBC 1
|
||||||
# define ACC_INFO_LIBC "dietlibc"
|
# define ACC_INFO_LIBC "dietlibc"
|
||||||
@@ -1396,13 +1444,13 @@ extern "C" {
|
|||||||
# define ACC_INFO_LIBC "newlib"
|
# define ACC_INFO_LIBC "newlib"
|
||||||
#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__)
|
#elif defined(__UCLIBC__) && defined(__UCLIBC_MAJOR__) && defined(__UCLIBC_MINOR__)
|
||||||
# if defined(__UCLIBC_SUBLEVEL__)
|
# if defined(__UCLIBC_SUBLEVEL__)
|
||||||
# define ACC_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + __UCLIBC_MINOR__ * 0x100 + __UCLIBC_SUBLEVEL__)
|
# define ACC_LIBC_UCLIBC (__UCLIBC_MAJOR__ * 0x10000L + (__UCLIBC_MINOR__+0) * 0x100 + (__UCLIBC_SUBLEVEL__+0))
|
||||||
# else
|
# else
|
||||||
# define ACC_LIBC_UCLIBC 0x00090bL
|
# define ACC_LIBC_UCLIBC 0x00090bL
|
||||||
# endif
|
# endif
|
||||||
# define ACC_INFO_LIBC "uclibc"
|
# define ACC_INFO_LIBC "uclibc"
|
||||||
#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
#elif defined(__GLIBC__) && defined(__GLIBC_MINOR__)
|
||||||
# define ACC_LIBC_GLIBC (__GLIBC__ * 0x10000L + __GLIBC_MINOR__ * 0x100)
|
# define ACC_LIBC_GLIBC (__GLIBC__ * 0x10000L + (__GLIBC_MINOR__+0) * 0x100)
|
||||||
# define ACC_INFO_LIBC "glibc"
|
# define ACC_INFO_LIBC "glibc"
|
||||||
#elif (ACC_CC_MWERKS) && defined(__MSL__)
|
#elif (ACC_CC_MWERKS) && defined(__MSL__)
|
||||||
# define ACC_LIBC_MSL __MSL__
|
# define ACC_LIBC_MSL __MSL__
|
||||||
@@ -1418,17 +1466,17 @@ extern "C" {
|
|||||||
#if !defined(__acc_gnuc_extension__)
|
#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_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_gnuc_extension__ __extension__
|
# define __acc_gnuc_extension__ __extension__
|
||||||
#else
|
#else
|
||||||
# define __acc_gnuc_extension__
|
# define __acc_gnuc_extension__ /*empty*/
|
||||||
#endif
|
#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
|
||||||
#if !defined(__acc_alignof)
|
#if !defined(__acc_alignof)
|
||||||
#if (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE || ACC_CC_PGI)
|
#if (ACC_CC_ARMCC_GNUC || ACC_CC_CILLY || ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE || ACC_CC_PGI)
|
||||||
# define __acc_alignof(e) __alignof__(e)
|
# define __acc_alignof(e) __alignof__(e)
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700))
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 700))
|
||||||
# define __acc_alignof(e) __alignof__(e)
|
# define __acc_alignof(e) __alignof__(e)
|
||||||
@@ -1446,7 +1494,7 @@ extern "C" {
|
|||||||
# define __acc_constructor __attribute__((__constructor__,__used__))
|
# define __acc_constructor __attribute__((__constructor__,__used__))
|
||||||
#elif (ACC_CC_GNUC >= 0x020700ul)
|
#elif (ACC_CC_GNUC >= 0x020700ul)
|
||||||
# define __acc_constructor __attribute__((__constructor__))
|
# define __acc_constructor __attribute__((__constructor__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_constructor __attribute__((__constructor__))
|
# define __acc_constructor __attribute__((__constructor__))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1458,7 +1506,7 @@ extern "C" {
|
|||||||
# define __acc_destructor __attribute__((__destructor__,__used__))
|
# define __acc_destructor __attribute__((__destructor__,__used__))
|
||||||
#elif (ACC_CC_GNUC >= 0x020700ul)
|
#elif (ACC_CC_GNUC >= 0x020700ul)
|
||||||
# define __acc_destructor __attribute__((__destructor__))
|
# define __acc_destructor __attribute__((__destructor__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_destructor __attribute__((__destructor__))
|
# define __acc_destructor __attribute__((__destructor__))
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
@@ -1474,7 +1522,7 @@ extern "C" {
|
|||||||
# define __acc_inline inline
|
# define __acc_inline inline
|
||||||
#elif (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0550))
|
#elif (ACC_CC_BORLANDC && (__BORLANDC__ >= 0x0550))
|
||||||
# define __acc_inline __inline
|
# define __acc_inline __inline
|
||||||
#elif (ACC_CC_CILLY || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE || ACC_CC_PGI)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CILLY || ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE || ACC_CC_PGI)
|
||||||
# define __acc_inline __inline__
|
# define __acc_inline __inline__
|
||||||
#elif (ACC_CC_DMC)
|
#elif (ACC_CC_DMC)
|
||||||
# define __acc_inline __inline
|
# define __acc_inline __inline
|
||||||
@@ -1493,7 +1541,7 @@ extern "C" {
|
|||||||
#if defined(__acc_inline)
|
#if defined(__acc_inline)
|
||||||
# define __acc_HAVE_inline 1
|
# define __acc_HAVE_inline 1
|
||||||
#else
|
#else
|
||||||
# define __acc_inline
|
# define __acc_inline /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_forceinline)
|
#if !defined(__acc_forceinline)
|
||||||
#if (ACC_CC_GNUC >= 0x030200ul)
|
#if (ACC_CC_GNUC >= 0x030200ul)
|
||||||
@@ -1502,7 +1550,7 @@ extern "C" {
|
|||||||
# define __acc_forceinline __forceinline
|
# define __acc_forceinline __forceinline
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800) && ACC_CC_SYNTAX_GNUC)
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800) && ACC_CC_SYNTAX_GNUC)
|
||||||
# define __acc_forceinline __inline__ __attribute__((__always_inline__))
|
# define __acc_forceinline __inline__ __attribute__((__always_inline__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_forceinline __inline__ __attribute__((__always_inline__))
|
# define __acc_forceinline __inline__ __attribute__((__always_inline__))
|
||||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
#elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
||||||
# define __acc_forceinline __forceinline
|
# define __acc_forceinline __forceinline
|
||||||
@@ -1513,7 +1561,7 @@ extern "C" {
|
|||||||
#if defined(__acc_forceinline)
|
#if defined(__acc_forceinline)
|
||||||
# define __acc_HAVE_forceinline 1
|
# define __acc_HAVE_forceinline 1
|
||||||
#else
|
#else
|
||||||
# define __acc_forceinline
|
# define __acc_forceinline /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_noinline)
|
#if !defined(__acc_noinline)
|
||||||
#if 1 && (ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x040000ul) && (ACC_CC_GNUC < 0x040003ul)
|
#if 1 && (ACC_ARCH_I386) && (ACC_CC_GNUC >= 0x040000ul) && (ACC_CC_GNUC < 0x040003ul)
|
||||||
@@ -1524,7 +1572,7 @@ extern "C" {
|
|||||||
# define __acc_noinline __declspec(noinline)
|
# define __acc_noinline __declspec(noinline)
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800) && ACC_CC_SYNTAX_GNUC)
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800) && ACC_CC_SYNTAX_GNUC)
|
||||||
# define __acc_noinline __attribute__((__noinline__))
|
# define __acc_noinline __attribute__((__noinline__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_noinline __attribute__((__noinline__))
|
# define __acc_noinline __attribute__((__noinline__))
|
||||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1300))
|
#elif (ACC_CC_MSC && (_MSC_VER >= 1300))
|
||||||
# define __acc_noinline __declspec(noinline)
|
# define __acc_noinline __declspec(noinline)
|
||||||
@@ -1540,7 +1588,7 @@ extern "C" {
|
|||||||
#if defined(__acc_noinline)
|
#if defined(__acc_noinline)
|
||||||
# define __acc_HAVE_noinline 1
|
# define __acc_HAVE_noinline 1
|
||||||
#else
|
#else
|
||||||
# define __acc_noinline
|
# define __acc_noinline /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if (__acc_HAVE_forceinline || __acc_HAVE_noinline) && !(__acc_HAVE_inline)
|
#if (__acc_HAVE_forceinline || __acc_HAVE_noinline) && !(__acc_HAVE_inline)
|
||||||
# error "this should not happen"
|
# error "this should not happen"
|
||||||
@@ -1552,7 +1600,7 @@ extern "C" {
|
|||||||
# define __acc_noreturn __declspec(noreturn)
|
# define __acc_noreturn __declspec(noreturn)
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 600) && ACC_CC_SYNTAX_GNUC)
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 600) && ACC_CC_SYNTAX_GNUC)
|
||||||
# define __acc_noreturn __attribute__((__noreturn__))
|
# define __acc_noreturn __attribute__((__noreturn__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_noreturn __attribute__((__noreturn__))
|
# define __acc_noreturn __attribute__((__noreturn__))
|
||||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
#elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
||||||
# define __acc_noreturn __declspec(noreturn)
|
# define __acc_noreturn __declspec(noreturn)
|
||||||
@@ -1561,7 +1609,7 @@ extern "C" {
|
|||||||
#if defined(__acc_noreturn)
|
#if defined(__acc_noreturn)
|
||||||
# define __acc_HAVE_noreturn 1
|
# define __acc_HAVE_noreturn 1
|
||||||
#else
|
#else
|
||||||
# define __acc_noreturn
|
# define __acc_noreturn /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_nothrow)
|
#if !defined(__acc_nothrow)
|
||||||
#if (ACC_CC_GNUC >= 0x030300ul)
|
#if (ACC_CC_GNUC >= 0x030300ul)
|
||||||
@@ -1570,7 +1618,7 @@ extern "C" {
|
|||||||
# define __acc_nothrow __declspec(nothrow)
|
# define __acc_nothrow __declspec(nothrow)
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 900) && ACC_CC_SYNTAX_GNUC)
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 900) && ACC_CC_SYNTAX_GNUC)
|
||||||
# define __acc_nothrow __attribute__((__nothrow__))
|
# define __acc_nothrow __attribute__((__nothrow__))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_nothrow __attribute__((__nothrow__))
|
# define __acc_nothrow __attribute__((__nothrow__))
|
||||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus)
|
#elif (ACC_CC_MSC && (_MSC_VER >= 1200)) && defined(__cplusplus)
|
||||||
# define __acc_nothrow __declspec(nothrow)
|
# define __acc_nothrow __declspec(nothrow)
|
||||||
@@ -1579,14 +1627,14 @@ extern "C" {
|
|||||||
#if defined(__acc_nothrow)
|
#if defined(__acc_nothrow)
|
||||||
# define __acc_HAVE_nothrow 1
|
# define __acc_HAVE_nothrow 1
|
||||||
#else
|
#else
|
||||||
# define __acc_nothrow
|
# define __acc_nothrow /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_restrict)
|
#if !defined(__acc_restrict)
|
||||||
#if (ACC_CC_GNUC >= 0x030400ul)
|
#if (ACC_CC_GNUC >= 0x030400ul)
|
||||||
# define __acc_restrict __restrict__
|
# define __acc_restrict __restrict__
|
||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 600) && ACC_CC_SYNTAX_GNUC)
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 600) && ACC_CC_SYNTAX_GNUC)
|
||||||
# define __acc_restrict __restrict__
|
# define __acc_restrict __restrict__
|
||||||
#elif (ACC_CC_LLVM)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM)
|
||||||
# define __acc_restrict __restrict__
|
# define __acc_restrict __restrict__
|
||||||
#elif (ACC_CC_MSC && (_MSC_VER >= 1400))
|
#elif (ACC_CC_MSC && (_MSC_VER >= 1400))
|
||||||
# define __acc_restrict __restrict
|
# define __acc_restrict __restrict
|
||||||
@@ -1595,7 +1643,7 @@ extern "C" {
|
|||||||
#if defined(__acc_restrict)
|
#if defined(__acc_restrict)
|
||||||
# define __acc_HAVE_restrict 1
|
# define __acc_HAVE_restrict 1
|
||||||
#else
|
#else
|
||||||
# define __acc_restrict
|
# define __acc_restrict /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_likely) && !defined(__acc_unlikely)
|
#if !defined(__acc_likely) && !defined(__acc_unlikely)
|
||||||
#if (ACC_CC_GNUC >= 0x030200ul)
|
#if (ACC_CC_GNUC >= 0x030200ul)
|
||||||
@@ -1604,7 +1652,7 @@ extern "C" {
|
|||||||
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800))
|
#elif (ACC_CC_INTELC && (__INTEL_COMPILER >= 800))
|
||||||
# define __acc_likely(e) (__builtin_expect(!!(e),1))
|
# define __acc_likely(e) (__builtin_expect(!!(e),1))
|
||||||
# define __acc_unlikely(e) (__builtin_expect(!!(e),0))
|
# define __acc_unlikely(e) (__builtin_expect(!!(e),0))
|
||||||
#elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __acc_likely(e) (__builtin_expect(!!(e),1))
|
# define __acc_likely(e) (__builtin_expect(!!(e),1))
|
||||||
# define __acc_unlikely(e) (__builtin_expect(!!(e),0))
|
# define __acc_unlikely(e) (__builtin_expect(!!(e),0))
|
||||||
#endif
|
#endif
|
||||||
@@ -1624,7 +1672,9 @@ extern "C" {
|
|||||||
# define ACC_UNUSED(var) ((void) &var)
|
# define ACC_UNUSED(var) ((void) &var)
|
||||||
# elif (ACC_CC_BORLANDC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PELLESC || ACC_CC_TURBOC)
|
# elif (ACC_CC_BORLANDC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PELLESC || ACC_CC_TURBOC)
|
||||||
# define ACC_UNUSED(var) if (&var) ; else
|
# define ACC_UNUSED(var) if (&var) ; else
|
||||||
# elif (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
# elif (ACC_CC_CLANG && (ACC_CC_CLANG_CLANG >= 0x030200ul))
|
||||||
|
# define ACC_UNUSED(var) ((void) &var)
|
||||||
|
# elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define ACC_UNUSED(var) ((void) var)
|
# define ACC_UNUSED(var) ((void) var)
|
||||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||||
# define ACC_UNUSED(var) if (&var) ; else
|
# define ACC_UNUSED(var) if (&var) ; else
|
||||||
@@ -1643,7 +1693,7 @@ extern "C" {
|
|||||||
# define ACC_UNUSED_FUNC(func) ((void) func)
|
# define ACC_UNUSED_FUNC(func) ((void) func)
|
||||||
# elif (ACC_CC_BORLANDC || ACC_CC_NDPC || ACC_CC_TURBOC)
|
# elif (ACC_CC_BORLANDC || ACC_CC_NDPC || ACC_CC_TURBOC)
|
||||||
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
||||||
# elif (ACC_CC_LLVM)
|
# elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_LLVM)
|
||||||
# define ACC_UNUSED_FUNC(func) ((void) &func)
|
# define ACC_UNUSED_FUNC(func) ((void) &func)
|
||||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||||
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
# define ACC_UNUSED_FUNC(func) if (func) ; else
|
||||||
@@ -1658,7 +1708,7 @@ extern "C" {
|
|||||||
#if !defined(ACC_UNUSED_LABEL)
|
#if !defined(ACC_UNUSED_LABEL)
|
||||||
# if (ACC_CC_WATCOMC) && defined(__cplusplus)
|
# if (ACC_CC_WATCOMC) && defined(__cplusplus)
|
||||||
# define ACC_UNUSED_LABEL(l) switch(0) case 1:goto l
|
# define ACC_UNUSED_LABEL(l) switch(0) case 1:goto l
|
||||||
# elif (ACC_CC_INTELC || ACC_CC_WATCOMC)
|
# elif (ACC_CC_ARMCC || ACC_CC_CLANG || ACC_CC_INTELC || ACC_CC_WATCOMC)
|
||||||
# define ACC_UNUSED_LABEL(l) if (0) goto l
|
# define ACC_UNUSED_LABEL(l) if (0) goto l
|
||||||
# else
|
# else
|
||||||
# define ACC_UNUSED_LABEL(l) switch(0) case 1:goto l
|
# define ACC_UNUSED_LABEL(l) switch(0) case 1:goto l
|
||||||
@@ -1676,7 +1726,7 @@ extern "C" {
|
|||||||
#if !defined(ACC_UNCONST_CAST)
|
#if !defined(ACC_UNCONST_CAST)
|
||||||
# if 0 && defined(__cplusplus)
|
# if 0 && defined(__cplusplus)
|
||||||
# define ACC_UNCONST_CAST(t,e) (const_cast<t> (e))
|
# define ACC_UNCONST_CAST(t,e) (const_cast<t> (e))
|
||||||
# elif (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
# elif (ACC_CC_ARMCC_GNUC || ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define ACC_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((acc_uintptr_t) ((const void *) (e))))))
|
# define ACC_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((acc_uintptr_t) ((const void *) (e))))))
|
||||||
# else
|
# else
|
||||||
# define ACC_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e)))))
|
# define ACC_UNCONST_CAST(t,e) ((t) ((void *) ((char *) ((const void *) (e)))))
|
||||||
@@ -1698,6 +1748,10 @@ extern "C" {
|
|||||||
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];}
|
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-!(e)];}
|
||||||
# elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
# elif (ACC_CC_DMC || ACC_CC_PACIFICC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||||
|
# elif (ACC_CC_GNUC >= 0x040700ul) && defined(__cplusplus)
|
||||||
|
# define ACC_COMPILE_TIME_ASSERT(e) {enum {__acc_cta_e=1/!!(e)} __attribute__((__unused__));}
|
||||||
|
# elif (ACC_CC_GNUC >= 0x040700ul)
|
||||||
|
# define ACC_COMPILE_TIME_ASSERT(e) {typedef int __acc_cta_t[1-2*!(e)] __attribute__((__unused__));}
|
||||||
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
# elif (ACC_CC_MSC && (_MSC_VER < 900))
|
||||||
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
# define ACC_COMPILE_TIME_ASSERT(e) switch(0) case 1:case !(e):break;
|
||||||
# elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295))
|
# elif (ACC_CC_TURBOC && (__TURBOC__ == 0x0295))
|
||||||
@@ -1710,7 +1764,7 @@ extern "C" {
|
|||||||
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
# if (ACC_CC_GNUC || ACC_CC_HIGHC || ACC_CC_NDPC || ACC_CC_PACIFICC)
|
||||||
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
# elif (ACC_CC_DMC || ACC_CC_SYMANTECC || ACC_CC_ZORTECHC)
|
||||||
# define __acc_cdecl __cdecl
|
# define __acc_cdecl __cdecl
|
||||||
# define __acc_cdecl_atexit
|
# define __acc_cdecl_atexit /*empty*/
|
||||||
# define __acc_cdecl_main __cdecl
|
# define __acc_cdecl_main __cdecl
|
||||||
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
# if (ACC_OS_OS2 && (ACC_CC_DMC || ACC_CC_SYMANTECC))
|
||||||
# define __acc_cdecl_qsort __pascal
|
# define __acc_cdecl_qsort __pascal
|
||||||
@@ -1751,19 +1805,19 @@ extern "C" {
|
|||||||
# define __acc_cdecl cdecl
|
# define __acc_cdecl cdecl
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl)
|
#if !defined(__acc_cdecl)
|
||||||
# define __acc_cdecl
|
# define __acc_cdecl /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl_atexit)
|
#if !defined(__acc_cdecl_atexit)
|
||||||
# define __acc_cdecl_atexit
|
# define __acc_cdecl_atexit /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl_main)
|
#if !defined(__acc_cdecl_main)
|
||||||
# define __acc_cdecl_main
|
# define __acc_cdecl_main /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl_qsort)
|
#if !defined(__acc_cdecl_qsort)
|
||||||
# define __acc_cdecl_qsort
|
# define __acc_cdecl_qsort /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl_sighandler)
|
#if !defined(__acc_cdecl_sighandler)
|
||||||
# define __acc_cdecl_sighandler
|
# define __acc_cdecl_sighandler /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__acc_cdecl_va)
|
#if !defined(__acc_cdecl_va)
|
||||||
# define __acc_cdecl_va __acc_cdecl
|
# define __acc_cdecl_va __acc_cdecl
|
||||||
@@ -1847,9 +1901,10 @@ extern "C" {
|
|||||||
#elif (ACC_ARCH_I386 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
#elif (ACC_ARCH_I386 && (ACC_OS_DOS32 || ACC_OS_WIN32) && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
||||||
# define ACC_ASM_SYNTAX_MSC 1
|
# define ACC_ASM_SYNTAX_MSC 1
|
||||||
#elif (ACC_OS_WIN64 && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
#elif (ACC_OS_WIN64 && (ACC_CC_DMC || ACC_CC_INTELC || ACC_CC_MSC || ACC_CC_PELLESC))
|
||||||
#elif (ACC_ARCH_I386 && (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE))
|
#elif (ACC_ARCH_I386 && ACC_CC_GNUC && (ACC_CC_GNUC == 0x011f00ul))
|
||||||
|
#elif (ACC_ARCH_I386 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE))
|
||||||
# define ACC_ASM_SYNTAX_GNUC 1
|
# define ACC_ASM_SYNTAX_GNUC 1
|
||||||
#elif (ACC_ARCH_AMD64 && (ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE))
|
#elif (ACC_ARCH_AMD64 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_INTELC || ACC_CC_PATHSCALE))
|
||||||
# define ACC_ASM_SYNTAX_GNUC 1
|
# define ACC_ASM_SYNTAX_GNUC 1
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_ASM_SYNTAX_GNUC)
|
#if (ACC_ASM_SYNTAX_GNUC)
|
||||||
@@ -2460,6 +2515,7 @@ extern "C" {
|
|||||||
# undef HAVE_ACCESS
|
# undef HAVE_ACCESS
|
||||||
# undef HAVE_CHMOD
|
# undef HAVE_CHMOD
|
||||||
# undef HAVE_CHOWN
|
# undef HAVE_CHOWN
|
||||||
|
# undef HAVE_FILENO
|
||||||
# undef HAVE_FSTAT
|
# undef HAVE_FSTAT
|
||||||
# undef HAVE_GETTIMEOFDAY
|
# undef HAVE_GETTIMEOFDAY
|
||||||
# undef HAVE_LSTAT
|
# undef HAVE_LSTAT
|
||||||
@@ -2533,7 +2589,7 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
#elif (ACC_SIZEOF_SHORT == 2)
|
#elif (ACC_SIZEOF_SHORT == 2)
|
||||||
# define acc_int16e_t short int
|
# define acc_int16e_t short int
|
||||||
# define acc_uint16e_t unsigned short int
|
# define acc_uint16e_t unsigned short int
|
||||||
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_HI) && (ACC_CC_GNUC >= 0x025f00ul || ACC_CC_LLVM)
|
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_HI) && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x025f00ul) || ACC_CC_LLVM)
|
||||||
typedef int __acc_int16e_hi_t __attribute__((__mode__(__HI__)));
|
typedef int __acc_int16e_hi_t __attribute__((__mode__(__HI__)));
|
||||||
typedef unsigned int __acc_uint16e_hi_t __attribute__((__mode__(__HI__)));
|
typedef unsigned int __acc_uint16e_hi_t __attribute__((__mode__(__HI__)));
|
||||||
# define acc_int16e_t __acc_int16e_hi_t
|
# define acc_int16e_t __acc_int16e_hi_t
|
||||||
@@ -2560,7 +2616,7 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
#elif (ACC_SIZEOF_LONG_LONG == 4)
|
#elif (ACC_SIZEOF_LONG_LONG == 4)
|
||||||
# define acc_int32e_t acc_llong_t
|
# define acc_int32e_t acc_llong_t
|
||||||
# define acc_uint32e_t acc_ullong_t
|
# define acc_uint32e_t acc_ullong_t
|
||||||
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_SI) && (ACC_CC_GNUC >= 0x025f00ul || ACC_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_SI) && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x025f00ul) || ACC_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||||
typedef int __acc_int32e_si_t __attribute__((__mode__(__SI__)));
|
typedef int __acc_int32e_si_t __attribute__((__mode__(__SI__)));
|
||||||
typedef unsigned int __acc_uint32e_si_t __attribute__((__mode__(__SI__)));
|
typedef unsigned int __acc_uint32e_si_t __attribute__((__mode__(__SI__)));
|
||||||
# define acc_int32e_t __acc_int32e_si_t
|
# define acc_int32e_t __acc_int32e_si_t
|
||||||
@@ -2961,7 +3017,7 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
#elif (ACC_SIZEOF_SHORT == 2)
|
#elif (ACC_SIZEOF_SHORT == 2)
|
||||||
# define acc_int16e_t short int
|
# define acc_int16e_t short int
|
||||||
# define acc_uint16e_t unsigned short int
|
# define acc_uint16e_t unsigned short int
|
||||||
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_HI) && (ACC_CC_GNUC >= 0x025f00ul || ACC_CC_LLVM)
|
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_HI) && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x025f00ul) || ACC_CC_LLVM)
|
||||||
typedef int __acc_int16e_hi_t __attribute__((__mode__(__HI__)));
|
typedef int __acc_int16e_hi_t __attribute__((__mode__(__HI__)));
|
||||||
typedef unsigned int __acc_uint16e_hi_t __attribute__((__mode__(__HI__)));
|
typedef unsigned int __acc_uint16e_hi_t __attribute__((__mode__(__HI__)));
|
||||||
# define acc_int16e_t __acc_int16e_hi_t
|
# define acc_int16e_t __acc_int16e_hi_t
|
||||||
@@ -2988,7 +3044,7 @@ __acc_gnuc_extension__ typedef unsigned long long acc_ullong_t;
|
|||||||
#elif (ACC_SIZEOF_LONG_LONG == 4)
|
#elif (ACC_SIZEOF_LONG_LONG == 4)
|
||||||
# define acc_int32e_t acc_llong_t
|
# define acc_int32e_t acc_llong_t
|
||||||
# define acc_uint32e_t acc_ullong_t
|
# define acc_uint32e_t acc_ullong_t
|
||||||
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_SI) && (ACC_CC_GNUC >= 0x025f00ul || ACC_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
#elif 1 && !(ACC_CFG_TYPE_NO_MODE_SI) && (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x025f00ul) || ACC_CC_LLVM) && (__INT_MAX__+0 > 2147483647L)
|
||||||
typedef int __acc_int32e_si_t __attribute__((__mode__(__SI__)));
|
typedef int __acc_int32e_si_t __attribute__((__mode__(__SI__)));
|
||||||
typedef unsigned int __acc_uint32e_si_t __attribute__((__mode__(__SI__)));
|
typedef unsigned int __acc_uint32e_si_t __attribute__((__mode__(__SI__)));
|
||||||
# define acc_int32e_t __acc_int32e_si_t
|
# define acc_int32e_t __acc_int32e_si_t
|
||||||
@@ -3642,9 +3698,9 @@ typedef unsigned short wchar_t;
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#if !defined(__ACCLIB_CONST_CAST_RETURN)
|
#if !defined(__ACCLIB_CONST_CAST_RETURN)
|
||||||
#if 1 && (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#if 1 && (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __ACCLIB_CONST_CAST_RETURN(type,var) return (type) (acc_uintptr_t) (var);
|
# define __ACCLIB_CONST_CAST_RETURN(type,var) return (type) (acc_uintptr_t) (var);
|
||||||
#elif (ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
#elif (ACC_CC_CLANG || ACC_CC_GNUC || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __ACCLIB_CONST_CAST_RETURN(type,var) \
|
# define __ACCLIB_CONST_CAST_RETURN(type,var) \
|
||||||
{ union { type a; const type b; } u; u.b = (var); return u.a; }
|
{ union { type a; const type b; } u; u.b = (var); return u.a; }
|
||||||
#else
|
#else
|
||||||
@@ -4166,7 +4222,7 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mode, const char* fn, const char* const * a
|
|||||||
# define ACC_CXX_NOTHROW throw()
|
# define ACC_CXX_NOTHROW throw()
|
||||||
#endif
|
#endif
|
||||||
#if !defined(ACC_CXX_NOTHROW)
|
#if !defined(ACC_CXX_NOTHROW)
|
||||||
# define ACC_CXX_NOTHROW
|
# define ACC_CXX_NOTHROW /*empty*/
|
||||||
#endif
|
#endif
|
||||||
#if defined(__ACC_CXX_DO_NEW)
|
#if defined(__ACC_CXX_DO_NEW)
|
||||||
#elif (ACC_CC_NDPC || ACC_CC_PGI)
|
#elif (ACC_CC_NDPC || ACC_CC_PGI)
|
||||||
@@ -4203,7 +4259,7 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mode, const char* fn, const char* const * a
|
|||||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||||
# elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
# elif (ACC_CC_MSC && (_MSC_VER >= 1200))
|
||||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||||
# elif (ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
# elif (ACC_CC_CLANG || ACC_CC_LLVM || ACC_CC_PATHSCALE)
|
||||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||||
# elif (ACC_CC_PGI)
|
# elif (ACC_CC_PGI)
|
||||||
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
# define __ACC_CXX_HAVE_PLACEMENT_DELETE 1
|
||||||
@@ -4450,12 +4506,14 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mode, const char* fn, const char* const * a
|
|||||||
ACCCHK_ASSERT((((1ul << 31) + 1) >> 31) == 1)
|
ACCCHK_ASSERT((((1ul << 31) + 1) >> 31) == 1)
|
||||||
#endif
|
#endif
|
||||||
#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150)
|
#if defined(__MSDOS__) && defined(__TURBOC__) && (__TURBOC__ < 0x0150)
|
||||||
|
#elif 1 && (ACC_CC_ARMCC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
#else
|
#else
|
||||||
ACCCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0)
|
ACCCHK_ASSERT((1 << (8*SIZEOF_INT-1)) < 0)
|
||||||
#endif
|
#endif
|
||||||
ACCCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0)
|
ACCCHK_ASSERT((1u << (8*SIZEOF_INT-1)) > 0)
|
||||||
#if 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
#if 1 && (ACC_CC_ARMCC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
|
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
#else
|
#else
|
||||||
ACCCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0)
|
ACCCHK_ASSERT((1l << (8*SIZEOF_LONG-1)) < 0)
|
||||||
#endif
|
#endif
|
||||||
@@ -4684,6 +4742,7 @@ ACCLIB_EXTERN(int, acc_spawnve) (int mode, const char* fn, const char* const * a
|
|||||||
#if (ACC_CC_KEILC)
|
#if (ACC_CC_KEILC)
|
||||||
#elif (ACC_CC_NDPC)
|
#elif (ACC_CC_NDPC)
|
||||||
#elif 1 && (ACC_CC_LCC || ACC_CC_LCCWIN32) && !defined(ACCCHK_CFG_PEDANTIC)
|
#elif 1 && (ACC_CC_LCC || ACC_CC_LCCWIN32) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
|
#elif 1 && (ACC_CC_ARMCC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
#elif 1 && (ACC_CC_SUNPROC) && !defined(ACCCHK_CFG_PEDANTIC)
|
||||||
#elif !(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
|
#elif !(ACC_BROKEN_INTEGRAL_PROMOTION) && (SIZEOF_INT > 1)
|
||||||
ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
|
ACCCHK_ASSERT( (((unsigned char)128) << (int)(8*sizeof(int)-8)) < 0)
|
||||||
@@ -4926,13 +4985,13 @@ ACCLIB_PUBLIC(void, acc_ua_set_le64) (acc_hvoid_p p, acc_uint64l_t v)
|
|||||||
#if !defined(ACCLIB_PUBLIC_NOINLINE)
|
#if !defined(ACCLIB_PUBLIC_NOINLINE)
|
||||||
# if !defined(__acc_noinline)
|
# if !defined(__acc_noinline)
|
||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) r __ACCLIB_FUNCNAME(f)
|
||||||
# elif (ACC_CC_GNUC >= 0x030400ul) || (ACC_CC_LLVM)
|
# elif (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x030400ul) || ACC_CC_LLVM)
|
||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline __attribute__((__used__)) r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline __attribute__((__used__)) r __ACCLIB_FUNCNAME(f)
|
||||||
# else
|
# else
|
||||||
# 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_CC_GNUC >= 0x030400ul) || (ACC_CC_LLVM)
|
#if (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x030400ul) || ACC_CC_LLVM)
|
||||||
extern void* volatile __acc_vget_ptr;
|
extern void* volatile __acc_vget_ptr;
|
||||||
void* volatile __attribute__((__used__)) __acc_vget_ptr = (void *) 0;
|
void* volatile __attribute__((__used__)) __acc_vget_ptr = (void *) 0;
|
||||||
#else
|
#else
|
||||||
@@ -5151,12 +5210,12 @@ ACCLIB_PUBLIC(acc_uint32l_t, acc_randmt_r32) (acc_randmt_p r)
|
|||||||
{
|
{
|
||||||
acc_uint32l_t v;
|
acc_uint32l_t v;
|
||||||
if __acc_unlikely(r->n == 624) {
|
if __acc_unlikely(r->n == 624) {
|
||||||
int i = 0, j;
|
unsigned i = 0, j;
|
||||||
r->n = 0;
|
r->n = 0;
|
||||||
do {
|
do {
|
||||||
j = i - 623; if (j < 0) j += 624;
|
j = i - 623; if ((int) j < 0) j += 624;
|
||||||
v = (r->s[i] & ACC_UINT32_C(0x80000000)) ^ (r->s[j] & ACC_UINT32_C(0x7fffffff));
|
v = (r->s[i] & ACC_UINT32_C(0x80000000)) ^ (r->s[j] & ACC_UINT32_C(0x7fffffff));
|
||||||
j = i - 227; if (j < 0) j += 624;
|
j = i - 227; if ((int) j < 0) j += 624;
|
||||||
r->s[i] = r->s[j] ^ (v >> 1);
|
r->s[i] = r->s[j] ^ (v >> 1);
|
||||||
if (v & 1) r->s[i] ^= ACC_UINT32_C(0x9908b0df);
|
if (v & 1) r->s[i] ^= ACC_UINT32_C(0x9908b0df);
|
||||||
} while (++i != 624);
|
} while (++i != 624);
|
||||||
@@ -5189,12 +5248,12 @@ ACCLIB_PUBLIC(acc_uint64l_t, acc_randmt64_r64) (acc_randmt64_p r)
|
|||||||
{
|
{
|
||||||
acc_uint64l_t v;
|
acc_uint64l_t v;
|
||||||
if __acc_unlikely(r->n == 312) {
|
if __acc_unlikely(r->n == 312) {
|
||||||
int i = 0, j;
|
unsigned i = 0, j;
|
||||||
r->n = 0;
|
r->n = 0;
|
||||||
do {
|
do {
|
||||||
j = i - 311; if (j < 0) j += 312;
|
j = i - 311; if ((int) j < 0) j += 312;
|
||||||
v = (r->s[i] & ACC_UINT64_C(0xffffffff80000000)) ^ (r->s[j] & ACC_UINT64_C(0x7fffffff));
|
v = (r->s[i] & ACC_UINT64_C(0xffffffff80000000)) ^ (r->s[j] & ACC_UINT64_C(0x7fffffff));
|
||||||
j = i - 156; if (j < 0) j += 312;
|
j = i - 156; if ((int) j < 0) j += 312;
|
||||||
r->s[i] = r->s[j] ^ (v >> 1);
|
r->s[i] = r->s[j] ^ (v >> 1);
|
||||||
if (v & 1) r->s[i] ^= ACC_UINT64_C(0xb5026f5aa96619e9);
|
if (v & 1) r->s[i] ^= ACC_UINT64_C(0xb5026f5aa96619e9);
|
||||||
} while (++i != 312);
|
} while (++i != 312);
|
||||||
@@ -5219,10 +5278,10 @@ ACCLIB_PUBLIC(acc_uint64l_t, acc_randmt64_r64) (acc_randmt64_p r)
|
|||||||
# pragma warn(disable:2007)
|
# pragma warn(disable:2007)
|
||||||
#endif
|
#endif
|
||||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
||||||
#if (ACC_ARCH_AMD64 && ACC_CC_PATHSCALE)
|
#if (ACC_ARCH_AMD64 && ACC_CC_INTELC)
|
||||||
# define __ACCLIB_RDTSC_REGS : : "c" (t) : "cc", "memory", "rax", "rdx"
|
|
||||||
#elif (ACC_ARCH_AMD64 && ACC_CC_INTELC)
|
|
||||||
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "memory", "rax", "rdx"
|
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "memory", "rax", "rdx"
|
||||||
|
#elif (ACC_ARCH_AMD64 && ACC_CC_PATHSCALE)
|
||||||
|
# define __ACCLIB_RDTSC_REGS : : "c" (t) : "cc", "memory", "rax", "rdx"
|
||||||
#elif (ACC_ARCH_AMD64)
|
#elif (ACC_ARCH_AMD64)
|
||||||
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "cc", "memory", "rax", "rdx"
|
# define __ACCLIB_RDTSC_REGS : : "r" (t) : "cc", "memory", "rax", "rdx"
|
||||||
#elif (ACC_ARCH_I386 && ACC_CC_GNUC && (ACC_CC_GNUC < 0x020000ul))
|
#elif (ACC_ARCH_I386 && ACC_CC_GNUC && (ACC_CC_GNUC < 0x020000ul))
|
||||||
@@ -5372,7 +5431,7 @@ static int __ACCLIB_FUNCNAME(acc_getopt_perror) (acc_getopt_p g, int ret, const
|
|||||||
{
|
{
|
||||||
if (g->opterr)
|
if (g->opterr)
|
||||||
{
|
{
|
||||||
#if HAVE_STDARG_H
|
#if (HAVE_STDARG_H)
|
||||||
struct { va_list ap; } s;
|
struct { va_list ap; } s;
|
||||||
va_start(s.ap, f);
|
va_start(s.ap, f);
|
||||||
g->opterr(g, f, &s);
|
g->opterr(g, f, &s);
|
||||||
@@ -5425,70 +5484,66 @@ ACCLIB_PUBLIC(int, acc_getopt) (acc_getopt_p g,
|
|||||||
a = g->argv[g->optind];
|
a = g->argv[g->optind];
|
||||||
if (a[0] == '-' && a[1] == '-')
|
if (a[0] == '-' && a[1] == '-')
|
||||||
{
|
{
|
||||||
char* arg;
|
size_t l = 0;
|
||||||
size_t a_len, i;
|
const acc_getopt_longopt_p o;
|
||||||
|
const acc_getopt_longopt_p o1 = NULL;
|
||||||
|
const acc_getopt_longopt_p o2 = NULL;
|
||||||
int need_exact = 0;
|
int need_exact = 0;
|
||||||
const acc_getopt_longopt_p lo = NULL;
|
|
||||||
const acc_getopt_longopt_p l2 = NULL;
|
|
||||||
++g->optind;
|
++g->optind;
|
||||||
if (!a[2])
|
if (!a[2])
|
||||||
goto acc_label_eof;
|
goto acc_label_eof;
|
||||||
for (a += 2, arg = a; arg[0] && arg[0] != '=' && arg[0] != '#'; )
|
for (a += 2; a[l] && a[l] != '=' && a[l] != '#'; )
|
||||||
++arg;
|
++l;
|
||||||
a_len = (size_t) (arg - a);
|
for (o = longopts; l && o && o->name; ++o)
|
||||||
for (i = 0; a_len && longopts && longopts[i].name; ++i)
|
|
||||||
{
|
{
|
||||||
if (strncmp(a, longopts[i].name, a_len) != 0)
|
if (strncmp(a, o->name, l) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (!longopts[i].name[a_len])
|
if (!o->name[l])
|
||||||
{
|
goto acc_label_found_o;
|
||||||
lo = &longopts[i];
|
need_exact |= o->has_arg & ACC_GETOPT_EXACT_ARG;
|
||||||
goto acc_label_found_lo;
|
if (o1) o2 = o;
|
||||||
|
else o1 = o;
|
||||||
}
|
}
|
||||||
need_exact |= longopts[i].has_arg & ACC_GETOPT_EXACT_ARG;
|
if (!o1 || need_exact)
|
||||||
if (lo)
|
|
||||||
l2 = &longopts[i];
|
|
||||||
else
|
|
||||||
lo = &longopts[i];
|
|
||||||
}
|
|
||||||
if (!lo || need_exact)
|
|
||||||
return pe(g, g->bad_option, "unrecognized option '--%s'", a);
|
return pe(g, g->bad_option, "unrecognized option '--%s'", a);
|
||||||
if (l2)
|
if (o2)
|
||||||
return pe(g, g->bad_option, "option '--%s' is ambiguous (could be '--%s' or '--%s')", a, lo->name, l2->name);
|
return pe(g, g->bad_option, "option '--%s' is ambiguous (could be '--%s' or '--%s')", a, o1->name, o2->name);
|
||||||
acc_label_found_lo:
|
o = o1;
|
||||||
switch (lo->has_arg & 0x2f)
|
acc_label_found_o:
|
||||||
|
a += l;
|
||||||
|
switch (o->has_arg & 0x2f)
|
||||||
{
|
{
|
||||||
case ACC_GETOPT_OPTIONAL_ARG:
|
case ACC_GETOPT_OPTIONAL_ARG:
|
||||||
if (arg[0])
|
if (a[0])
|
||||||
g->optarg = arg + 1;
|
g->optarg = a + 1;
|
||||||
break;
|
break;
|
||||||
case ACC_GETOPT_REQUIRED_ARG:
|
case ACC_GETOPT_REQUIRED_ARG:
|
||||||
if (arg[0])
|
if (a[0])
|
||||||
g->optarg = arg + 1;
|
g->optarg = a + 1;
|
||||||
else if (g->optind < g->argc)
|
else if (g->optind < g->argc)
|
||||||
g->optarg = g->argv[g->optind++];
|
g->optarg = g->argv[g->optind++];
|
||||||
if (!g->optarg)
|
if (!g->optarg)
|
||||||
return pe(g, missing_arg_ret, "option '--%s' requires an argument", lo->name);
|
return pe(g, missing_arg_ret, "option '--%s' requires an argument", o->name);
|
||||||
break;
|
break;
|
||||||
case ACC_GETOPT_REQUIRED_ARG | 0x20:
|
case ACC_GETOPT_REQUIRED_ARG | 0x20:
|
||||||
if (arg[0] && arg[1])
|
if (a[0] && a[1])
|
||||||
g->optarg = arg + 1;
|
g->optarg = a + 1;
|
||||||
if (!g->optarg)
|
if (!g->optarg)
|
||||||
return pe(g, missing_arg_ret, "option '--%s=' requires an argument", lo->name);
|
return pe(g, missing_arg_ret, "option '--%s=' requires an argument", o->name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (arg[0])
|
if (a[0])
|
||||||
return pe(g, g->bad_option, "option '--%s' doesn't allow an argument", lo->name);
|
return pe(g, g->bad_option, "option '--%s' doesn't allow an argument", o->name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (longind)
|
if (longind)
|
||||||
*longind = (int) (lo - longopts);
|
*longind = (int) (o - longopts);
|
||||||
if (lo->flag)
|
if (o->flag)
|
||||||
{
|
{
|
||||||
*lo->flag = lo->val;
|
*o->flag = o->val;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return lo->val;
|
return o->val;
|
||||||
}
|
}
|
||||||
if (a[0] == '-' && a[1])
|
if (a[0] == '-' && a[1])
|
||||||
{
|
{
|
||||||
@@ -5831,26 +5886,26 @@ ACCLIB_PUBLIC(long, acc_safe_hwrite) (int fd, const acc_hvoid_p buf, long size)
|
|||||||
#if !defined(ACCLIB_PUBLIC)
|
#if !defined(ACCLIB_PUBLIC)
|
||||||
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC(r,f) r __ACCLIB_FUNCNAME(f)
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (ACC_OS_POSIX_LINUX && ACC_ARCH_AMD64 && ACC_ASM_SYNTAX_GNUC)
|
#if 1 && (ACC_OS_POSIX_LINUX && ACC_ARCH_AMD64 && ACC_ASM_SYNTAX_GNUC)
|
||||||
#ifndef acc_pclock_syscall_clock_gettime
|
#ifndef acc_pclock_syscall_clock_gettime
|
||||||
#define acc_pclock_syscall_clock_gettime acc_pclock_syscall_clock_gettime
|
#define acc_pclock_syscall_clock_gettime acc_pclock_syscall_clock_gettime
|
||||||
#endif
|
#endif
|
||||||
static __acc_noinline long acc_pclock_syscall_clock_gettime(long clockid, struct timespec *ts)
|
static __acc_noinline long acc_pclock_syscall_clock_gettime(long clockid, struct timespec *ts)
|
||||||
{
|
{
|
||||||
long r;
|
unsigned long r = 228;
|
||||||
__asm__ __volatile__("syscall\n" : "=a" (r) : "0" (228), "D" (clockid), "S" (ts) : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("syscall\n" : "=a" (r) : "0" (r), "D" (clockid), "S" (ts) : __ACC_ASM_CLOBBER);
|
||||||
return r;
|
return (long) r;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (ACC_OS_POSIX_LINUX && ACC_ARCH_I386 && ACC_ASM_SYNTAX_GNUC)
|
#if 1 && (ACC_OS_POSIX_LINUX && ACC_ARCH_I386 && ACC_ASM_SYNTAX_GNUC) && defined(acc_int64l_t)
|
||||||
#ifndef acc_pclock_syscall_clock_gettime
|
#ifndef acc_pclock_syscall_clock_gettime
|
||||||
#define acc_pclock_syscall_clock_gettime acc_pclock_syscall_clock_gettime
|
#define acc_pclock_syscall_clock_gettime acc_pclock_syscall_clock_gettime
|
||||||
#endif
|
#endif
|
||||||
static __acc_noinline long acc_pclock_syscall_clock_gettime(long clockid, struct timespec *ts)
|
static __acc_noinline long acc_pclock_syscall_clock_gettime(long clockid, struct timespec *ts)
|
||||||
{
|
{
|
||||||
long r;
|
unsigned long r = 265;
|
||||||
__asm__ __volatile__("int $0x80\n" : "=a" (r) : "0" (265), "b" (clockid), "c" (ts) : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushl %%ebx\n pushl %%edx\n popl %%ebx\n int $0x80\n popl %%ebx\n" : "=a" (r) : "0" (r), "d" (clockid), "c" (ts) : __ACC_ASM_CLOBBER);
|
||||||
return r;
|
return (long) r;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0 && defined(acc_pclock_syscall_clock_gettime)
|
#if 0 && defined(acc_pclock_syscall_clock_gettime)
|
||||||
@@ -5863,7 +5918,7 @@ static int acc_pclock_read_clock_gettime_r_syscall(acc_pclock_handle_p h, acc_pc
|
|||||||
if (acc_pclock_syscall_clock_gettime(0, &ts) != 0)
|
if (acc_pclock_syscall_clock_gettime(0, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5921,7 +5976,7 @@ static int acc_pclock_read_clock_gettime_m_syscall(acc_pclock_handle_p h, acc_pc
|
|||||||
if (acc_pclock_syscall_clock_gettime(1, &ts) != 0)
|
if (acc_pclock_syscall_clock_gettime(1, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5942,7 +5997,7 @@ static int acc_pclock_read_uclock(acc_pclock_handle_p h, acc_pclock_p c)
|
|||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) && defined(acc_int64l_t)
|
#if 1 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID) && defined(acc_int64l_t)
|
||||||
#ifndef acc_pclock_read_clock_gettime_p_libc
|
#ifndef acc_pclock_read_clock_gettime_p_libc
|
||||||
#define acc_pclock_read_clock_gettime_p_libc acc_pclock_read_clock_gettime_p_libc
|
#define acc_pclock_read_clock_gettime_p_libc acc_pclock_read_clock_gettime_p_libc
|
||||||
#endif
|
#endif
|
||||||
@@ -5952,7 +6007,7 @@ static int acc_pclock_read_clock_gettime_p_libc(acc_pclock_handle_p h, acc_pcloc
|
|||||||
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) != 0)
|
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -5966,7 +6021,7 @@ static int acc_pclock_read_clock_gettime_p_syscall(acc_pclock_handle_p h, acc_pc
|
|||||||
if (acc_pclock_syscall_clock_gettime(2, &ts) != 0)
|
if (acc_pclock_syscall_clock_gettime(2, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -6030,7 +6085,7 @@ static int acc_pclock_read_perfctr(acc_pclock_handle_p h, acc_pclock_p c)
|
|||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if 0 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_THREAD_CPUTIME_ID) && defined(acc_int64l_t)
|
#if 1 && (HAVE_CLOCK_GETTIME) && defined(CLOCK_THREAD_CPUTIME_ID) && defined(acc_int64l_t)
|
||||||
#ifndef acc_pclock_read_clock_gettime_t_libc
|
#ifndef acc_pclock_read_clock_gettime_t_libc
|
||||||
#define acc_pclock_read_clock_gettime_t_libc acc_pclock_read_clock_gettime_t_libc
|
#define acc_pclock_read_clock_gettime_t_libc acc_pclock_read_clock_gettime_t_libc
|
||||||
#endif
|
#endif
|
||||||
@@ -6040,7 +6095,7 @@ static int acc_pclock_read_clock_gettime_t_libc(acc_pclock_handle_p h, acc_pcloc
|
|||||||
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0)
|
if (clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -6054,7 +6109,7 @@ static int acc_pclock_read_clock_gettime_t_syscall(acc_pclock_handle_p h, acc_pc
|
|||||||
if (acc_pclock_syscall_clock_gettime(3, &ts) != 0)
|
if (acc_pclock_syscall_clock_gettime(3, &ts) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
c->tv_sec = ts.tv_sec;
|
c->tv_sec = ts.tv_sec;
|
||||||
c->tv_nsec = ts.tv_nsec;
|
c->tv_nsec = (acc_uint32l_t) ts.tv_nsec;
|
||||||
ACC_UNUSED(h); return 0;
|
ACC_UNUSED(h); return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -6534,7 +6589,7 @@ ACCLIB_PUBLIC(int, acc_uclock_flush_cpu_cache) (acc_uclock_handle_p h, unsigned
|
|||||||
#if !defined(ACCLIB_PUBLIC_NOINLINE)
|
#if !defined(ACCLIB_PUBLIC_NOINLINE)
|
||||||
# if !defined(__acc_noinline)
|
# if !defined(__acc_noinline)
|
||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) r __ACCLIB_FUNCNAME(f)
|
||||||
# elif (ACC_CC_GNUC >= 0x030400ul) || (ACC_CC_LLVM)
|
# elif (ACC_CC_CLANG || (ACC_CC_GNUC >= 0x030400ul) || ACC_CC_LLVM)
|
||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline __attribute__((__used__)) r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline __attribute__((__used__)) r __ACCLIB_FUNCNAME(f)
|
||||||
# else
|
# else
|
||||||
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline r __ACCLIB_FUNCNAME(f)
|
# define ACCLIB_PUBLIC_NOINLINE(r,f) __acc_noinline r __ACCLIB_FUNCNAME(f)
|
||||||
@@ -6765,7 +6820,8 @@ ACCLIB_PUBLIC_NOINLINE(void, acc_debug_break) (void)
|
|||||||
#elif (ACC_OS_WIN32) && (ACC_HAVE_WINDOWS_H)
|
#elif (ACC_OS_WIN32) && (ACC_HAVE_WINDOWS_H)
|
||||||
DebugBreak();
|
DebugBreak();
|
||||||
#else
|
#else
|
||||||
* (volatile int *) 0x1 = -1;
|
volatile size_t a = 0;
|
||||||
|
* (volatile unsigned long *) (volatile void *) a = ~0ul;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
ACCLIB_PUBLIC_NOINLINE(void, acc_debug_nop) (void)
|
ACCLIB_PUBLIC_NOINLINE(void, acc_debug_nop) (void)
|
||||||
@@ -6774,7 +6830,7 @@ ACCLIB_PUBLIC_NOINLINE(void, acc_debug_nop) (void)
|
|||||||
ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_query) (void)
|
ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_query) (void)
|
||||||
{
|
{
|
||||||
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
#if (ACC_ARCH_AMD64 || ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
||||||
size_t r;
|
size_t r = 0;
|
||||||
__asm__ __volatile__("pushf\n pop %0\n" : "=a" (r) : : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushf\n pop %0\n" : "=a" (r) : : __ACC_ASM_CLOBBER);
|
||||||
return (int)(r >> 18) & 1;
|
return (int)(r >> 18) & 1;
|
||||||
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_MSC)
|
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_MSC)
|
||||||
@@ -6791,21 +6847,20 @@ ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_query) (void)
|
|||||||
}
|
}
|
||||||
ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_enable) (int v)
|
ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_enable) (int v)
|
||||||
{
|
{
|
||||||
int r;
|
|
||||||
#if (ACC_ARCH_AMD64) && (ACC_ASM_SYNTAX_GNUC)
|
#if (ACC_ARCH_AMD64) && (ACC_ASM_SYNTAX_GNUC)
|
||||||
if (v) {
|
if (v) {
|
||||||
__asm__ __volatile__("pushf\n orl $262144,(%%rsp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushf\n orl $262144,(%%rsp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
||||||
} else {
|
} else {
|
||||||
__asm__ __volatile__("pushf\n andl $-262145,(%%rsp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushf\n andl $-262145,(%%rsp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
||||||
}
|
}
|
||||||
r = 0;
|
return 0;
|
||||||
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_GNUC)
|
||||||
if (v) {
|
if (v) {
|
||||||
__asm__ __volatile__("pushf\n orl $262144,(%%esp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushf\n orl $262144,(%%esp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
||||||
} else {
|
} else {
|
||||||
__asm__ __volatile__("pushf\n andl $-262145,(%%esp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
__asm__ __volatile__("pushf\n andl $-262145,(%%esp)\n popf\n" : : : __ACC_ASM_CLOBBER);
|
||||||
}
|
}
|
||||||
r = 0;
|
return 0;
|
||||||
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_MSC)
|
#elif (ACC_ARCH_I386) && (ACC_ASM_SYNTAX_MSC)
|
||||||
if (v) { __asm {
|
if (v) { __asm {
|
||||||
pushf
|
pushf
|
||||||
@@ -6816,11 +6871,10 @@ ACCLIB_PUBLIC_NOINLINE(int, acc_debug_align_check_enable) (int v)
|
|||||||
and dword ptr [esp],-262145
|
and dword ptr [esp],-262145
|
||||||
popf
|
popf
|
||||||
}}
|
}}
|
||||||
r = 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
r = -1;
|
ACC_UNUSED(v); return -1;
|
||||||
#endif
|
#endif
|
||||||
ACC_UNUSED(v); return r;
|
|
||||||
}
|
}
|
||||||
ACCLIB_PUBLIC_NOINLINE(unsigned, acc_debug_running_on_qemu) (void)
|
ACCLIB_PUBLIC_NOINLINE(unsigned, acc_debug_running_on_qemu) (void)
|
||||||
{
|
{
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+3
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -146,6 +146,7 @@ struct options_t {
|
|||||||
unsigned char osabi0; // replacement if 0==.e_ident[EI_OSABI]
|
unsigned char osabi0; // replacement if 0==.e_ident[EI_OSABI]
|
||||||
enum { SCRIPT_MAX = 32 };
|
enum { SCRIPT_MAX = 32 };
|
||||||
const char *script_name;
|
const char *script_name;
|
||||||
|
bool preserve_build_id; // copy the build-id to the compressed binary
|
||||||
} o_unix;
|
} o_unix;
|
||||||
struct {
|
struct {
|
||||||
bool le;
|
bool le;
|
||||||
|
|||||||
+14
-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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -202,6 +202,7 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
unsigned iat;
|
unsigned iat;
|
||||||
LE32 *lookupt;
|
LE32 *lookupt;
|
||||||
unsigned npos;
|
unsigned npos;
|
||||||
|
unsigned original_position;
|
||||||
bool isk32;
|
bool isk32;
|
||||||
|
|
||||||
static int __acc_cdecl_qsort compare(const void *p1, const void *p2)
|
static int __acc_cdecl_qsort compare(const void *p1, const void *p2)
|
||||||
@@ -210,6 +211,8 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
const udll *u2 = * (const udll * const *) p2;
|
const udll *u2 = * (const udll * const *) p2;
|
||||||
if (u1->isk32) return -1;
|
if (u1->isk32) return -1;
|
||||||
if (u2->isk32) return 1;
|
if (u2->isk32) return 1;
|
||||||
|
if (!*u1->lookupt) return 1;
|
||||||
|
if (!*u2->lookupt) return -1;
|
||||||
int rc = strcasecmp(u1->name,u2->name);
|
int rc = strcasecmp(u1->name,u2->name);
|
||||||
if (rc) return rc;
|
if (rc) return rc;
|
||||||
if (u1->ordinal) return -1;
|
if (u1->ordinal) return -1;
|
||||||
@@ -236,11 +239,12 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
dlls[ic].iat = im->iat;
|
dlls[ic].iat = im->iat;
|
||||||
dlls[ic].lookupt = (LE32*) (ibuf + (im->oft ? im->oft : im->iat));
|
dlls[ic].lookupt = (LE32*) (ibuf + (im->oft ? im->oft : im->iat));
|
||||||
dlls[ic].npos = 0;
|
dlls[ic].npos = 0;
|
||||||
|
dlls[ic].original_position = ic;
|
||||||
dlls[ic].isk32 = strcasecmp(kernel32dll,dlls[ic].name) == 0;
|
dlls[ic].isk32 = strcasecmp(kernel32dll,dlls[ic].name) == 0;
|
||||||
|
|
||||||
soimport += strlen(dlls[ic].name) + 1 + 4;
|
soimport += strlen(dlls[ic].name) + 1 + 4;
|
||||||
|
|
||||||
for (LE32 *tarr = dlls[ic].lookupt; *tarr; tarr++)
|
for (IPTR_I(LE32, tarr, dlls[ic].lookupt); *tarr; tarr += 1)
|
||||||
{
|
{
|
||||||
if (*tarr & 0x80000000)
|
if (*tarr & 0x80000000)
|
||||||
{
|
{
|
||||||
@@ -252,10 +256,11 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned len = strlen(ibuf + *tarr + 2);
|
IPTR_I(const upx_byte, n, ibuf + *tarr + 2);
|
||||||
|
unsigned len = strlen(n);
|
||||||
soimport += len + 1;
|
soimport += len + 1;
|
||||||
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
||||||
dlls[ic].shname = ibuf + *tarr + 2;
|
dlls[ic].shname = n;
|
||||||
}
|
}
|
||||||
soimport++; // separator
|
soimport++; // separator
|
||||||
}
|
}
|
||||||
@@ -343,8 +348,10 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
for (ic = 0; ic < dllnum; ic++)
|
for (ic = 0; ic < dllnum; ic++)
|
||||||
{
|
{
|
||||||
LE32 *tarr = idlls[ic]->lookupt;
|
LE32 *tarr = idlls[ic]->lookupt;
|
||||||
|
#if 0 && ENABLE_THIS_AND_UNCOMPRESSION_WILL_BREAK
|
||||||
if (!*tarr) // no imports from this dll
|
if (!*tarr) // no imports from this dll
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
set_le32(ppi,idlls[ic]->npos);
|
set_le32(ppi,idlls[ic]->npos);
|
||||||
set_le32(ppi+4,idlls[ic]->iat - rvamin);
|
set_le32(ppi+4,idlls[ic]->iat - rvamin);
|
||||||
ppi += 8;
|
ppi += 8;
|
||||||
@@ -412,7 +419,7 @@ unsigned PackArmPe::processImports() // pass 1
|
|||||||
for (ic = 0; ic < dllnum; ic++, im++)
|
for (ic = 0; ic < dllnum; ic++, im++)
|
||||||
{
|
{
|
||||||
memset(im,FILLVAL,sizeof(*im));
|
memset(im,FILLVAL,sizeof(*im));
|
||||||
im->dllname = ptr_diff(idlls[ic]->name,ibuf); // I only need this info
|
im->dllname = ptr_diff(dlls[idlls[ic]->original_position].name,ibuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -592,7 +599,7 @@ void PackArmPe::pack(OutputFile *fo)
|
|||||||
if (((isection[ic].flags & (PEFL_WRITE|PEFL_SHARED))
|
if (((isection[ic].flags & (PEFL_WRITE|PEFL_SHARED))
|
||||||
== (PEFL_WRITE|PEFL_SHARED)))
|
== (PEFL_WRITE|PEFL_SHARED)))
|
||||||
if (!opt->force)
|
if (!opt->force)
|
||||||
throwCantPack("writeable shared sections not supported (try --force)");
|
throwCantPack("writable shared sections not supported (try --force)");
|
||||||
if (jc && isection[ic].rawdataptr - jc > ih.filealign)
|
if (jc && isection[ic].rawdataptr - jc > ih.filealign)
|
||||||
throwCantPack("superfluous data between sections");
|
throwCantPack("superfluous data between sections");
|
||||||
fi->seek(isection[ic].rawdataptr,SEEK_SET);
|
fi->seek(isection[ic].rawdataptr,SEEK_SET);
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+52
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -152,6 +152,7 @@
|
|||||||
DT_RELENT = 19, /* Size of one Rel relocation */
|
DT_RELENT = 19, /* Size of one Rel relocation */
|
||||||
DT_STRSZ = 10, /* Sizeof string table */
|
DT_STRSZ = 10, /* Sizeof string table */
|
||||||
DT_PLTREL = 20, /* Type of reloc in PLT */
|
DT_PLTREL = 20, /* Type of reloc in PLT */
|
||||||
|
DT_TEXTREL = 22, /* Reloc might modify .text */
|
||||||
DT_JMPREL = 23, /* Address of PLT relocs */
|
DT_JMPREL = 23, /* Address of PLT relocs */
|
||||||
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
|
DT_CHECKSUM = 0x6ffffdf8, /* Only for prelink? */
|
||||||
DT_GNU_HASH = 0x6ffffef5, /* GNU-style hash table */
|
DT_GNU_HASH = 0x6ffffef5, /* GNU-style hash table */
|
||||||
@@ -195,6 +196,55 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WANT_NHDR_ENUM
|
||||||
|
#undef WANT_NHDR_ENUM
|
||||||
|
enum { // ELF PT_NOTE types
|
||||||
|
#define ELF_NOTE_GNU_NAME "GNU\0"
|
||||||
|
NT_GNU_ABI_TAG = 1,
|
||||||
|
NT_GNU_HWCAP = 2,
|
||||||
|
NT_GNU_BUILD_ID = 3,
|
||||||
|
|
||||||
|
#define ELF_NOTE_OPENBSD_NAME "OpenBSD\0"
|
||||||
|
NHDR_OPENBSD_TAG = 1,
|
||||||
|
|
||||||
|
#define ELF_NOTE_NETBSD_NAME "NetBSD\0"
|
||||||
|
NHDR_NETBSD_TAG = 1,
|
||||||
|
NHDR_CHECKSUM_TAG = 2,
|
||||||
|
NHDR_PAX_TAG = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // descsz descriptor sizes
|
||||||
|
GNU_ABI_DESCSZ = 16, // int GNU_OS, major, minor, subminor;
|
||||||
|
NETBSD_DESCSZ = 4, // major_ver * (10**8) + minor
|
||||||
|
OPENBSD_DESCSZ = 4, // 32-bit zero
|
||||||
|
// CHECKSUM_DESCSZ is 2*sizeof(short) + sizeof(checksum)
|
||||||
|
PAX_DESCSZ = 4 // 32-bit mask
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // GNU OS/version
|
||||||
|
GNU_OS_LINUX = 0,
|
||||||
|
GNU_OS_HURD = 1,
|
||||||
|
GNU_OS_SOLARIS = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
enum { // NetBSD checksum methods
|
||||||
|
CHECKSUM_CRC32 = 1,
|
||||||
|
CHECKSUM_MD5 = 2,
|
||||||
|
CHECKSUM_SHA1 = 3,
|
||||||
|
CHECKSUM_SHA256 = 4
|
||||||
|
};
|
||||||
|
|
||||||
|
#define ELF_NOTE_PAX_NAME "PaX\0"
|
||||||
|
enum { // NetBSD PaX bit values
|
||||||
|
PAX_MPROTECT = (1<<0), /* force enable Mprotect */
|
||||||
|
PAX_NOMPROTECT = (1<<1), /* force disable Mprotect */
|
||||||
|
PAX_GUARD = (1<<2), /* force enable SEGVguard */
|
||||||
|
PAX_NOGUARD = (1<<3), /* force disable SEGVguard */
|
||||||
|
PAX_ASLR = (1<<4), /* force enable ASLR */
|
||||||
|
PAX_NOASLR = (1<<5) /* force disable ASLR */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
vi:ts=4:et
|
vi:ts=4:et
|
||||||
*/
|
*/
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+729
-174
File diff suppressed because it is too large
Load Diff
+69
-21
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
@@ -50,7 +50,7 @@ protected:
|
|||||||
// because they depend on Elf32 or Elf64 data structures, which differ.
|
// because they depend on Elf32 or Elf64 data structures, which differ.
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &) = 0; // generate executable header
|
virtual void pack1(OutputFile *, Filter &) = 0; // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &) = 0; // append compressed data
|
virtual int pack2(OutputFile *, Filter &) = 0; // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
||||||
//virtual void pack4(OutputFile *, Filter &) = 0; // append pack header
|
//virtual void pack4(OutputFile *, Filter &) = 0; // append pack header
|
||||||
|
|
||||||
@@ -63,8 +63,7 @@ protected:
|
|||||||
virtual void addStubEntrySections(Filter const *);
|
virtual void addStubEntrySections(Filter const *);
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
|
|
||||||
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const = 0;
|
//virtual void const *elf_find_dynamic(unsigned) const = 0;
|
||||||
virtual void const *elf_find_dynamic(unsigned) const = 0;
|
|
||||||
virtual acc_uint64l_t elf_unsigned_dynamic(unsigned) const = 0;
|
virtual acc_uint64l_t elf_unsigned_dynamic(unsigned) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@@ -75,6 +74,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 sz_pack2a; // after pack2() of all PT_LOAD
|
||||||
|
unsigned sz_pack2b; // after pack2() of all PT_LOAD and gaps
|
||||||
unsigned lg2_page; // log2(PAGE_SIZE)
|
unsigned lg2_page; // log2(PAGE_SIZE)
|
||||||
unsigned page_size; // 1u<<lg2_page
|
unsigned page_size; // 1u<<lg2_page
|
||||||
unsigned xct_off; // shared library: file offset of SHT_EXECINSTR
|
unsigned xct_off; // shared library: file offset of SHT_EXECINSTR
|
||||||
@@ -87,6 +88,10 @@ protected:
|
|||||||
unsigned char ei_data;
|
unsigned char ei_data;
|
||||||
unsigned char ei_osabi;
|
unsigned char ei_osabi;
|
||||||
char const *osabi_note;
|
char const *osabi_note;
|
||||||
|
|
||||||
|
unsigned char const *buildid_data;
|
||||||
|
int o_elf_shnum; // num output Shdrs
|
||||||
|
static unsigned char o_shstrtab[];
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackLinuxElf32 : public PackLinuxElf
|
class PackLinuxElf32 : public PackLinuxElf
|
||||||
@@ -103,9 +108,10 @@ protected:
|
|||||||
// but the class hierarchy splits after this class.
|
// but the class hierarchy splits after this class.
|
||||||
virtual void ARM_defineSymbols(Filter const *ft);
|
virtual void ARM_defineSymbols(Filter const *ft);
|
||||||
virtual void ARM_updateLoader(OutputFile *);
|
virtual void ARM_updateLoader(OutputFile *);
|
||||||
|
virtual int ARM_is_QNX(void);
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
@@ -132,15 +138,18 @@ protected:
|
|||||||
static unsigned elf_hash(char const *) /*const*/;
|
static unsigned elf_hash(char const *) /*const*/;
|
||||||
static unsigned gnu_hash(char const *) /*const*/;
|
static unsigned gnu_hash(char const *) /*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(acc_uint64l_t) 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_name(char const *) const;
|
||||||
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
Elf32_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
|
Elf32_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
acc_uint64l_t elf_unsigned_dynamic(unsigned) const;
|
acc_uint64l_t elf_unsigned_dynamic(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
|
||||||
|
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
|
||||||
|
unsigned note_size; // total size of PT_NOTEs
|
||||||
Elf32_Shdr const *shdri; // from input file
|
Elf32_Shdr const *shdri; // from input file
|
||||||
unsigned page_mask; // AND clears the offset-within-page
|
unsigned page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
@@ -173,23 +182,36 @@ protected:
|
|||||||
l_info linfo;
|
l_info linfo;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
cprElfHdr3 elfout;
|
__packed_struct(cprElfHdrNetBSD)
|
||||||
|
Elf32_Ehdr ehdr;
|
||||||
|
Elf32_Phdr phdr[4];
|
||||||
|
unsigned char notes[512];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
struct Elf32_Note {
|
cprElfHdrNetBSD elfout;
|
||||||
unsigned namesz; // 8
|
|
||||||
unsigned descsz; // 4
|
__packed_struct(cprElfShdr3)
|
||||||
unsigned type; // 1
|
Elf32_Shdr shdr[3];
|
||||||
char text[0x18 - 4*4]; // "OpenBSD"
|
__packed_struct_end()
|
||||||
unsigned end; // 0
|
|
||||||
} elfnote;
|
cprElfShdr3 shdrout;
|
||||||
|
|
||||||
|
struct Elf32_Nhdr {
|
||||||
|
unsigned namesz;
|
||||||
|
unsigned descsz;
|
||||||
|
unsigned type;
|
||||||
|
//unsigned char body[0];
|
||||||
|
};
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 52 + 1*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 52 + 1*32 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 52 + 2*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 52 + 2*32 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 52 + 3*32 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 52 + 3*32 + 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdrNetBSD) == 52 + 4*32 + 512)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdrNetBSD)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -206,7 +228,7 @@ protected:
|
|||||||
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
|
virtual int checkEhdr(Elf64_Ehdr const *ehdr) const;
|
||||||
|
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // append loader
|
virtual void pack3(OutputFile *, Filter &); // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &); // append pack header
|
virtual void pack4(OutputFile *, Filter &); // append pack header
|
||||||
virtual void unpack(OutputFile *fo);
|
virtual void unpack(OutputFile *fo);
|
||||||
@@ -229,15 +251,18 @@ protected:
|
|||||||
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
|
virtual unsigned find_LOAD_gap(Elf64_Phdr const *const phdri, unsigned const k,
|
||||||
unsigned const e_phnum);
|
unsigned const e_phnum);
|
||||||
|
|
||||||
virtual unsigned elf_get_offset_from_address(acc_uint64l_t) const;
|
virtual acc_uint64l_t elf_get_offset_from_address(acc_uint64l_t) const;
|
||||||
Elf64_Shdr const *elf_find_section_name(char const *) const;
|
Elf64_Shdr const *elf_find_section_name(char const *) const;
|
||||||
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
Elf64_Shdr const *elf_find_section_type(unsigned) const;
|
||||||
void const *elf_find_dynamic(unsigned) const;
|
void const *elf_find_dynamic(unsigned) const;
|
||||||
|
Elf64_Dyn const *elf_has_dynamic(unsigned) const;
|
||||||
acc_uint64l_t elf_unsigned_dynamic(unsigned) const;
|
acc_uint64l_t elf_unsigned_dynamic(unsigned) const;
|
||||||
|
|
||||||
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
|
||||||
|
unsigned char *note_body; // concatenated contents of PT_NOTEs, if any
|
||||||
|
unsigned note_size; // total size of PT_NOTEs
|
||||||
Elf64_Shdr const *shdri; // from input file
|
Elf64_Shdr const *shdri; // from input file
|
||||||
acc_uint64l_t page_mask; // AND clears the offset-within-page
|
acc_uint64l_t page_mask; // AND clears the offset-within-page
|
||||||
|
|
||||||
@@ -270,15 +295,29 @@ protected:
|
|||||||
l_info linfo;
|
l_info linfo;
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
cprElfHdr3 elfout;
|
__packed_struct(cprElfHdr4)
|
||||||
|
Elf64_Ehdr ehdr;
|
||||||
|
Elf64_Phdr phdr[4];
|
||||||
|
l_info linfo;
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
cprElfHdr4 elfout;
|
||||||
|
|
||||||
|
__packed_struct(cprElfShdr3)
|
||||||
|
Elf64_Shdr shdr[3];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
cprElfShdr3 shdrout;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 64 + 1*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr1) == 64 + 1*56 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 64 + 2*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr2) == 64 + 2*56 + 12)
|
||||||
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 64 + 3*56 + 12)
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr3) == 64 + 3*56 + 12)
|
||||||
|
COMPILE_TIME_ASSERT(sizeof(cprElfHdr4) == 64 + 4*56 + 12)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr1)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr2)
|
||||||
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr3)
|
||||||
|
COMPILE_TIME_ASSERT_ALIGNED1(cprElfHdr4)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -406,13 +445,21 @@ public:
|
|||||||
virtual const char *getFullName(const options_t *) const { return "i386-freebsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-freebsd.elf"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackNetBSDElf32x86 : public PackBSDElf32x86
|
class PackNetBSDElf32x86 : public PackLinuxElf32x86
|
||||||
{
|
{
|
||||||
typedef PackBSDElf32x86 super;
|
typedef PackLinuxElf32x86 super;
|
||||||
public:
|
public:
|
||||||
PackNetBSDElf32x86(InputFile *f);
|
PackNetBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackNetBSDElf32x86();
|
virtual ~PackNetBSDElf32x86();
|
||||||
|
virtual const char *getName() const { return "netbsd/elf386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-netbsd.elf"; }
|
||||||
|
protected:
|
||||||
|
virtual void buildLoader(const Filter *ft);
|
||||||
|
virtual void generateElfHdr(
|
||||||
|
OutputFile *,
|
||||||
|
void const *proto,
|
||||||
|
unsigned const brka
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
||||||
@@ -421,6 +468,7 @@ class PackOpenBSDElf32x86 : public PackBSDElf32x86
|
|||||||
public:
|
public:
|
||||||
PackOpenBSDElf32x86(InputFile *f);
|
PackOpenBSDElf32x86(InputFile *f);
|
||||||
virtual ~PackOpenBSDElf32x86();
|
virtual ~PackOpenBSDElf32x86();
|
||||||
|
virtual const char *getName() const { return "opnbsd/elf386"; }
|
||||||
virtual const char *getFullName(const options_t *) const { return "i386-openbsd.elf"; }
|
virtual const char *getFullName(const options_t *) const { return "i386-openbsd.elf"; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
+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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2001-2010 John F. Reiser
|
Copyright (C) 2001-2013 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
|
||||||
@@ -449,7 +449,7 @@ int PackLinuxI386::getLoaderPrefixSize() const
|
|||||||
// some ELF utitlity functions
|
// some ELF utitlity functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
// basic check of an Linux ELF Ehdr
|
// basic check of a Linux ELF Ehdr
|
||||||
int PackLinuxI386::checkEhdr(const Elf_LE32_Ehdr *ehdr) const
|
int PackLinuxI386::checkEhdr(const Elf_LE32_Ehdr *ehdr) const
|
||||||
{
|
{
|
||||||
const unsigned char * const buf = ehdr->e_ident;
|
const unsigned char * const buf = ehdr->e_ident;
|
||||||
@@ -601,11 +601,11 @@ void PackLinuxI386::patchLoaderChecksum()
|
|||||||
// checksum for loader + p_info
|
// checksum for loader + p_info
|
||||||
lp->l_checksum = 0;
|
lp->l_checksum = 0;
|
||||||
lp->l_magic = UPX_ELF_MAGIC;
|
lp->l_magic = UPX_ELF_MAGIC;
|
||||||
lp->l_lsize = (unsigned short) lsize;
|
set_te16(&lp->l_lsize, (unsigned short) lsize);
|
||||||
lp->l_version = (unsigned char) ph.version;
|
lp->l_version = (unsigned char) ph.version;
|
||||||
lp->l_format = (unsigned char) ph.format;
|
lp->l_format = (unsigned char) ph.format;
|
||||||
// INFO: lp->l_checksum is currently unused
|
// INFO: lp->l_checksum is currently unused
|
||||||
lp->l_checksum = upx_adler32(ptr, lsize);
|
set_te32(&lp->l_checksum, upx_adler32(ptr, lsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+7
-7
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
@@ -114,7 +114,7 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
|
|||||||
h3.phdr[2].p_align = 1;
|
h3.phdr[2].p_align = 1;
|
||||||
|
|
||||||
if (opt->o_unix.make_ptinterp) { // unusual "once per release"
|
if (opt->o_unix.make_ptinterp) { // unusual "once per release"
|
||||||
elfout = h3;
|
*(cprElfHdr3 *)(void *)&elfout = h3;
|
||||||
elfout.ehdr.e_phnum = 1;
|
elfout.ehdr.e_phnum = 1;
|
||||||
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
|
fo->write(&elfout, elfout.ehdr.e_ehsize + elfout.ehdr.e_phentsize);
|
||||||
}
|
}
|
||||||
@@ -124,12 +124,12 @@ void PackLinuxElf32x86interp::pack1(OutputFile *fo, Filter &)
|
|||||||
#undef E
|
#undef E
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
|
int PackLinuxElf32x86interp::pack2(OutputFile *fo, Filter &ft)
|
||||||
{
|
{
|
||||||
if (opt->o_unix.make_ptinterp) {
|
if (opt->o_unix.make_ptinterp) {
|
||||||
return; // ignore current input file!
|
return 1; // ignore current input file!
|
||||||
}
|
}
|
||||||
super::pack2(fo, ft);
|
return super::pack2(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PAGE_MASK
|
#undef PAGE_MASK
|
||||||
|
|||||||
+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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &); // build loader
|
virtual void pack3(OutputFile *, Filter &); // build loader
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2000-2010 John F. Reiser
|
Copyright (C) 2000-2013 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
|
||||||
|
|||||||
+263
-64
@@ -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-2010 John Reiser
|
Copyright (C) 2004-2013 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
|
||||||
@@ -351,7 +351,7 @@ PackMachBase<T>::buildMachLoader(
|
|||||||
|
|
||||||
int const GAP = 128; // must match stub/l_mac_ppc.S
|
int const GAP = 128; // must match stub/l_mac_ppc.S
|
||||||
int const NO_LAP = 64; // must match stub/src/*darwin*.S
|
int const NO_LAP = 64; // must match stub/src/*darwin*.S
|
||||||
segcmdo.vmsize += h.sz_unc - h.sz_cpr + GAP + NO_LAP;
|
segTEXT.vmsize = h.sz_unc - h.sz_cpr + GAP + NO_LAP;
|
||||||
|
|
||||||
addStubEntrySections(ft);
|
addStubEntrySections(ft);
|
||||||
|
|
||||||
@@ -429,11 +429,11 @@ void PackMachBase<T>::patchLoaderChecksum()
|
|||||||
// checksum for loader; also some PackHeader info
|
// checksum for loader; also some PackHeader info
|
||||||
lp->l_checksum = 0;
|
lp->l_checksum = 0;
|
||||||
lp->l_magic = UPX_MAGIC_LE32; // LE32 always
|
lp->l_magic = UPX_MAGIC_LE32; // LE32 always
|
||||||
lp->l_lsize = (unsigned short) lsize;
|
set_te16(&lp->l_lsize, (unsigned short) lsize);
|
||||||
lp->l_version = (unsigned char) ph.version;
|
lp->l_version = (unsigned char) ph.version;
|
||||||
lp->l_format = (unsigned char) ph.format;
|
lp->l_format = (unsigned char) ph.format;
|
||||||
// INFO: lp->l_checksum is currently unused
|
// INFO: lp->l_checksum is currently unused
|
||||||
lp->l_checksum = upx_adler32(ptr, lsize);
|
set_te32(&lp->l_checksum, upx_adler32(ptr, lsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
@@ -447,77 +447,211 @@ PackMachBase<T>::compare_segment_command(void const *const aa, void const *const
|
|||||||
unsigned const xb = b->cmd - lc_seg;
|
unsigned const xb = b->cmd - lc_seg;
|
||||||
if (xa < xb) return -1; // LC_SEGMENT first
|
if (xa < xb) return -1; // LC_SEGMENT first
|
||||||
if (xa > xb) return 1;
|
if (xa > xb) return 1;
|
||||||
|
// Beware 0==.vmsize (some MacOSX __DWARF debug info: a "comment")
|
||||||
|
if (a->vmsize!=0 && b->vmsize!=0) {
|
||||||
if (a->vmaddr < b->vmaddr) return -1; // ascending by .vmaddr
|
if (a->vmaddr < b->vmaddr) return -1; // ascending by .vmaddr
|
||||||
if (a->vmaddr > b->vmaddr) return 1;
|
if (a->vmaddr > b->vmaddr) return 1;
|
||||||
|
}
|
||||||
|
else { // 0==.vmsize goes last, except ordered by fileoff
|
||||||
|
if (a->vmsize) return -1; // 'a' is first
|
||||||
|
if (b->vmsize) return 1; // 'a' is last
|
||||||
|
if (a->fileoff < b->fileoff)
|
||||||
|
return -1;
|
||||||
|
if (a->fileoff > b->fileoff)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef PAGE_MASK
|
||||||
|
#undef PAGE_SIZE
|
||||||
|
#define PAGE_MASK (~0u<<12)
|
||||||
|
#define PAGE_SIZE (0u-PAGE_MASK)
|
||||||
|
|
||||||
|
#undef PAGE_MASK64
|
||||||
|
#undef PAGE_SIZE64
|
||||||
|
#define PAGE_MASK64 (~(acc_uint64l_t)0<<12)
|
||||||
|
#define PAGE_SIZE64 ((acc_uint64l_t)0-PAGE_MASK64)
|
||||||
|
|
||||||
|
// At 2013-02-03 part of the source for codesign was
|
||||||
|
// http://opensource.apple.com/source/cctools/cctools-836/libstuff/ofile.c
|
||||||
|
|
||||||
void PackMachPPC32::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
void PackMachPPC32::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
||||||
{
|
{
|
||||||
// offset of p_info in compressed file
|
// offset of p_info in compressed file
|
||||||
overlay_offset = sizeof(mhdro) + sizeof(segcmdo) + sizeof(threado) + sizeof(linfo);
|
overlay_offset = sizeof(mhdro) + sizeof(segZERO)
|
||||||
|
+ sizeof(segXHDR) + sizeof(secXHDR)
|
||||||
|
+ sizeof(segTEXT) + sizeof(secTEXT)
|
||||||
|
+ sizeof(segLINK) + sizeof(threado) + sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
overlay_offset += sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
|
||||||
super::pack4(fo, ft);
|
super::pack4(fo, ft);
|
||||||
segcmdo.filesize = fo->getBytesWritten();
|
unsigned const t = fo->getBytesWritten();
|
||||||
segcmdo.vmsize += segcmdo.filesize;
|
segTEXT.filesize = t;
|
||||||
|
segTEXT.vmsize += t; // utilize GAP + NO_LAP + sz_unc - sz_cpr
|
||||||
|
secTEXT.offset = overlay_offset - sizeof(linfo);
|
||||||
|
secTEXT.addr = segTEXT.vmaddr + secTEXT.offset;
|
||||||
|
secTEXT.size = segTEXT.vmsize - secTEXT.offset;
|
||||||
|
secXHDR.offset = overlay_offset - sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
secXHDR.offset -= sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
secXHDR.addr += secXHDR.offset;
|
||||||
|
unsigned foff1 = (PAGE_MASK & (~PAGE_MASK + segTEXT.filesize));
|
||||||
|
if (foff1 < segTEXT.vmsize)
|
||||||
|
foff1 += PAGE_SIZE; // codesign disallows overhang
|
||||||
|
segLINK.fileoff = foff1;
|
||||||
|
segLINK.vmaddr = segTEXT.vmaddr + foff1;
|
||||||
|
fo->seek(foff1 - 1, SEEK_SET); fo->write("", 1);
|
||||||
fo->seek(sizeof(mhdro), SEEK_SET);
|
fo->seek(sizeof(mhdro), SEEK_SET);
|
||||||
fo->rewrite(&segcmdo, sizeof(segcmdo));
|
fo->rewrite(&segZERO, sizeof(segZERO));
|
||||||
|
fo->rewrite(&segXHDR, sizeof(segXHDR));
|
||||||
|
fo->rewrite(&secXHDR, sizeof(secXHDR));
|
||||||
|
fo->rewrite(&segTEXT, sizeof(segTEXT));
|
||||||
|
fo->rewrite(&secTEXT, sizeof(secTEXT));
|
||||||
|
fo->rewrite(&segLINK, sizeof(segLINK));
|
||||||
fo->rewrite(&threado, sizeof(threado));
|
fo->rewrite(&threado, sizeof(threado));
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
fo->rewrite(&uuid_cmd, sizeof(uuid_cmd));
|
||||||
|
fo->rewrite(&linkitem, sizeof(linkitem));
|
||||||
|
}
|
||||||
fo->rewrite(&linfo, sizeof(linfo));
|
fo->rewrite(&linfo, sizeof(linfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackMachI386::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
void PackMachI386::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
||||||
{
|
{
|
||||||
// offset of p_info in compressed file
|
// offset of p_info in compressed file
|
||||||
overlay_offset = sizeof(mhdro) + sizeof(segcmdo) + sizeof(threado) + sizeof(linfo);
|
overlay_offset = sizeof(mhdro) + sizeof(segZERO)
|
||||||
|
+ sizeof(segXHDR) + sizeof(secXHDR)
|
||||||
|
+ sizeof(segTEXT) + sizeof(secTEXT)
|
||||||
|
+ sizeof(segLINK) + sizeof(threado) + sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
overlay_offset += sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
|
||||||
super::pack4(fo, ft);
|
super::pack4(fo, ft);
|
||||||
segcmdo.filesize = fo->getBytesWritten();
|
unsigned const t = fo->getBytesWritten();
|
||||||
segcmdo.vmsize += segcmdo.filesize;
|
segTEXT.filesize = t;
|
||||||
|
segTEXT.vmsize += t; // utilize GAP + NO_LAP + sz_unc - sz_cpr
|
||||||
|
secTEXT.offset = overlay_offset - sizeof(linfo);
|
||||||
|
secTEXT.addr = segTEXT.vmaddr + secTEXT.offset;
|
||||||
|
secTEXT.size = segTEXT.vmsize - secTEXT.offset;
|
||||||
|
secXHDR.offset = overlay_offset - sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
secXHDR.offset -= sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
secXHDR.addr += secXHDR.offset;
|
||||||
|
unsigned foff1 = (PAGE_MASK & (~PAGE_MASK + segTEXT.filesize));
|
||||||
|
if (foff1 < segTEXT.vmsize)
|
||||||
|
foff1 += PAGE_SIZE; // codesign disallows overhang
|
||||||
|
segLINK.fileoff = foff1;
|
||||||
|
segLINK.vmaddr = segTEXT.vmaddr + foff1;
|
||||||
|
fo->seek(foff1 - 1, SEEK_SET); fo->write("", 1);
|
||||||
fo->seek(sizeof(mhdro), SEEK_SET);
|
fo->seek(sizeof(mhdro), SEEK_SET);
|
||||||
fo->rewrite(&segcmdo, sizeof(segcmdo));
|
fo->rewrite(&segZERO, sizeof(segZERO));
|
||||||
|
fo->rewrite(&segXHDR, sizeof(segXHDR));
|
||||||
|
fo->rewrite(&secXHDR, sizeof(secXHDR));
|
||||||
|
fo->rewrite(&segTEXT, sizeof(segTEXT));
|
||||||
|
fo->rewrite(&secTEXT, sizeof(secTEXT));
|
||||||
|
fo->rewrite(&segLINK, sizeof(segLINK));
|
||||||
fo->rewrite(&threado, sizeof(threado));
|
fo->rewrite(&threado, sizeof(threado));
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
fo->rewrite(&uuid_cmd, sizeof(uuid_cmd));
|
||||||
|
fo->rewrite(&linkitem, sizeof(linkitem));
|
||||||
|
}
|
||||||
fo->rewrite(&linfo, sizeof(linfo));
|
fo->rewrite(&linfo, sizeof(linfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackMachAMD64::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
void PackMachAMD64::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
||||||
{
|
{
|
||||||
// offset of p_info in compressed file
|
// offset of p_info in compressed file
|
||||||
overlay_offset = sizeof(mhdro) + sizeof(segcmdo) + sizeof(threado) + sizeof(linfo);
|
overlay_offset = sizeof(mhdro) + sizeof(segZERO)
|
||||||
|
+ sizeof(segXHDR) + sizeof(secXHDR)
|
||||||
|
+ sizeof(segTEXT) + sizeof(secTEXT)
|
||||||
|
+ sizeof(segLINK) + sizeof(threado) + sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
overlay_offset += sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
|
||||||
super::pack4(fo, ft);
|
super::pack4(fo, ft);
|
||||||
segcmdo.filesize = fo->getBytesWritten();
|
unsigned const t = fo->getBytesWritten();
|
||||||
segcmdo.vmsize += segcmdo.filesize;
|
segTEXT.filesize = t;
|
||||||
|
segTEXT.vmsize += t; // utilize GAP + NO_LAP + sz_unc - sz_cpr
|
||||||
|
secTEXT.offset = overlay_offset - sizeof(linfo);
|
||||||
|
secTEXT.addr = segTEXT.vmaddr + secTEXT.offset;
|
||||||
|
secTEXT.size = segTEXT.vmsize - secTEXT.offset;
|
||||||
|
secXHDR.offset = overlay_offset - sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
secXHDR.offset -= sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
secXHDR.addr += secXHDR.offset;
|
||||||
|
unsigned foff1 = (PAGE_MASK & (~PAGE_MASK + segTEXT.filesize));
|
||||||
|
if (foff1 < segTEXT.vmsize)
|
||||||
|
foff1 += PAGE_SIZE; // codesign disallows overhang
|
||||||
|
segLINK.fileoff = foff1;
|
||||||
|
segLINK.vmaddr = segTEXT.vmaddr + foff1;
|
||||||
|
fo->seek(foff1 - 1, SEEK_SET); fo->write("", 1);
|
||||||
fo->seek(sizeof(mhdro), SEEK_SET);
|
fo->seek(sizeof(mhdro), SEEK_SET);
|
||||||
fo->rewrite(&segcmdo, sizeof(segcmdo));
|
fo->rewrite(&segZERO, sizeof(segZERO));
|
||||||
|
fo->rewrite(&segXHDR, sizeof(segXHDR));
|
||||||
|
fo->rewrite(&secXHDR, sizeof(secXHDR));
|
||||||
|
fo->rewrite(&segTEXT, sizeof(segTEXT));
|
||||||
|
fo->rewrite(&secTEXT, sizeof(secTEXT));
|
||||||
|
fo->rewrite(&segLINK, sizeof(segLINK));
|
||||||
fo->rewrite(&threado, sizeof(threado));
|
fo->rewrite(&threado, sizeof(threado));
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
fo->rewrite(&uuid_cmd, sizeof(uuid_cmd));
|
||||||
|
fo->rewrite(&linkitem, sizeof(linkitem));
|
||||||
|
}
|
||||||
fo->rewrite(&linfo, sizeof(linfo));
|
fo->rewrite(&linfo, sizeof(linfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackMachARMEL::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
void PackMachARMEL::pack4(OutputFile *fo, Filter &ft) // append PackHeader
|
||||||
{
|
{
|
||||||
// offset of p_info in compressed file
|
// offset of p_info in compressed file
|
||||||
overlay_offset = sizeof(mhdro) + sizeof(segcmdo) + sizeof(threado) + sizeof(linfo);
|
overlay_offset = sizeof(mhdro) + sizeof(segZERO)
|
||||||
|
+ sizeof(segXHDR) + sizeof(secXHDR)
|
||||||
|
+ sizeof(segTEXT) + sizeof(secTEXT)
|
||||||
|
+ sizeof(segLINK) + sizeof(threado) + sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
overlay_offset += sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
|
||||||
super::pack4(fo, ft);
|
super::pack4(fo, ft);
|
||||||
segcmdo.filesize = fo->getBytesWritten();
|
unsigned const t = fo->getBytesWritten();
|
||||||
segcmdo.vmsize += segcmdo.filesize;
|
segTEXT.filesize = t;
|
||||||
|
segTEXT.vmsize += t; // utilize GAP + NO_LAP + sz_unc - sz_cpr
|
||||||
|
secTEXT.offset = overlay_offset - sizeof(linfo);
|
||||||
|
secTEXT.addr = segTEXT.vmaddr + secTEXT.offset;
|
||||||
|
secTEXT.size = segTEXT.vmsize - secTEXT.offset;
|
||||||
|
secXHDR.offset = overlay_offset - sizeof(linfo);
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
secXHDR.offset -= sizeof(uuid_cmd) + sizeof(linkitem);
|
||||||
|
}
|
||||||
|
secXHDR.addr += secXHDR.offset;
|
||||||
|
unsigned foff1 = (PAGE_MASK & (~PAGE_MASK + segTEXT.filesize));
|
||||||
|
if (foff1 < segTEXT.vmsize)
|
||||||
|
foff1 += PAGE_SIZE; // codesign disallows overhang
|
||||||
|
segLINK.fileoff = foff1;
|
||||||
|
segLINK.vmaddr = segTEXT.vmaddr + foff1;
|
||||||
|
fo->seek(foff1 - 1, SEEK_SET); fo->write("", 1);
|
||||||
fo->seek(sizeof(mhdro), SEEK_SET);
|
fo->seek(sizeof(mhdro), SEEK_SET);
|
||||||
fo->rewrite(&segcmdo, sizeof(segcmdo));
|
fo->rewrite(&segZERO, sizeof(segZERO));
|
||||||
|
fo->rewrite(&segXHDR, sizeof(segXHDR));
|
||||||
|
fo->rewrite(&secXHDR, sizeof(secXHDR));
|
||||||
|
fo->rewrite(&segTEXT, sizeof(segTEXT));
|
||||||
|
fo->rewrite(&secTEXT, sizeof(secTEXT));
|
||||||
|
fo->rewrite(&segLINK, sizeof(segLINK));
|
||||||
fo->rewrite(&threado, sizeof(threado));
|
fo->rewrite(&threado, sizeof(threado));
|
||||||
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
|
fo->rewrite(&uuid_cmd, sizeof(uuid_cmd));
|
||||||
|
fo->rewrite(&linkitem, sizeof(linkitem));
|
||||||
|
}
|
||||||
fo->rewrite(&linfo, sizeof(linfo));
|
fo->rewrite(&linfo, sizeof(linfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef PAGE_MASK
|
|
||||||
#undef PAGE_SIZE
|
|
||||||
#define PAGE_MASK (~0u<<12)
|
|
||||||
#define PAGE_SIZE -PAGE_MASK
|
|
||||||
|
|
||||||
#undef PAGE_MASK64
|
|
||||||
#undef PAGE_SIZE64
|
|
||||||
#define PAGE_MASK64 (~(acc_uint64l_t)0<<12)
|
|
||||||
#define PAGE_SIZE64 -PAGE_MASK64
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PackMachBase<T>::pack4dylib( // append PackHeader
|
void PackMachBase<T>::pack4dylib( // append PackHeader
|
||||||
OutputFile *const fo,
|
OutputFile *const fo,
|
||||||
@@ -726,7 +860,7 @@ void PackMachPPC32::pack3(OutputFile *fo, Filter &ft) // append loader
|
|||||||
disp = 4+ len - sz_mach_headers; // 4: sizeof(instruction)
|
disp = 4+ len - sz_mach_headers; // 4: sizeof(instruction)
|
||||||
fo->write(&disp, sizeof(disp));
|
fo->write(&disp, sizeof(disp));
|
||||||
|
|
||||||
threado.state.srr0 = len + segcmdo.vmaddr; /* entry address */
|
threado.state.srr0 = len + segTEXT.vmaddr; /* entry address */
|
||||||
super::pack3(fo, ft);
|
super::pack3(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,7 +874,7 @@ void PackMachI386::pack3(OutputFile *fo, Filter &ft) // append loader
|
|||||||
disp = len - sz_mach_headers;
|
disp = len - sz_mach_headers;
|
||||||
fo->write(&disp, sizeof(disp));
|
fo->write(&disp, sizeof(disp));
|
||||||
|
|
||||||
threado.state.eip = len + sizeof(disp) + segcmdo.vmaddr; /* entry address */
|
threado.state.eip = len + sizeof(disp) + segTEXT.vmaddr; /* entry address */
|
||||||
super::pack3(fo, ft);
|
super::pack3(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -754,7 +888,7 @@ void PackMachAMD64::pack3(OutputFile *fo, Filter &ft) // append loader
|
|||||||
disp = len - sz_mach_headers;
|
disp = len - sz_mach_headers;
|
||||||
fo->write(&disp, sizeof(disp));
|
fo->write(&disp, sizeof(disp));
|
||||||
|
|
||||||
threado.state.rip = len + sizeof(disp) + segcmdo.vmaddr; /* entry address */
|
threado.state.rip = len + sizeof(disp) + segTEXT.vmaddr; /* entry address */
|
||||||
super::pack3(fo, ft);
|
super::pack3(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,7 +902,7 @@ void PackMachARMEL::pack3(OutputFile *fo, Filter &ft) // append loader
|
|||||||
disp = len - sz_mach_headers;
|
disp = len - sz_mach_headers;
|
||||||
fo->write(&disp, sizeof(disp));
|
fo->write(&disp, sizeof(disp));
|
||||||
|
|
||||||
threado.state.pc = len + sizeof(disp) + segcmdo.vmaddr; /* entry address */
|
threado.state.pc = len + sizeof(disp) + segTEXT.vmaddr; /* entry address */
|
||||||
super::pack3(fo, ft);
|
super::pack3(fo, ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,7 +1033,7 @@ void PackMachBase<T>::pack3(OutputFile *fo, Filter &ft)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void PackMachBase<T>::pack2(OutputFile *fo, Filter &ft) // append compressed body
|
int PackMachBase<T>::pack2(OutputFile *fo, Filter &ft) // append compressed body
|
||||||
{
|
{
|
||||||
unsigned const lc_seg = lc_segment[sizeof(Addr)>>3];
|
unsigned const lc_seg = lc_segment[sizeof(Addr)>>3];
|
||||||
Extent x;
|
Extent x;
|
||||||
@@ -976,7 +1110,10 @@ void PackMachBase<T>::pack2(OutputFile *fo, Filter &ft) // append compressed bo
|
|||||||
if (my_filetype!=Mach_header::MH_DYLIB)
|
if (my_filetype!=Mach_header::MH_DYLIB)
|
||||||
if ((off_t)total_in != file_size)
|
if ((off_t)total_in != file_size)
|
||||||
throwEOFException();
|
throwEOFException();
|
||||||
segcmdo.filesize = fo->getBytesWritten();
|
segTEXT.filesize = fo->getBytesWritten();
|
||||||
|
secTEXT.size = segTEXT.filesize - overlay_offset + sizeof(linfo);
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackMachPPC32::pack1_setup_threado(OutputFile *const fo)
|
void PackMachPPC32::pack1_setup_threado(OutputFile *const fo)
|
||||||
@@ -1025,34 +1162,82 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
|
|||||||
unsigned const lc_seg = lc_segment[sizeof(Addr)>>3];
|
unsigned const lc_seg = lc_segment[sizeof(Addr)>>3];
|
||||||
mhdro = mhdri;
|
mhdro = mhdri;
|
||||||
if (my_filetype==Mach_header::MH_EXECUTE) {
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
mhdro.ncmds = 2;
|
mhdro.ncmds = 5; // __ZERO, __XHDR, __TEXT, __LINKEDIT, THREAD_STATE
|
||||||
mhdro.sizeofcmds = sizeof(segcmdo) + my_thread_command_size;
|
mhdro.sizeofcmds = sizeof(segZERO)
|
||||||
|
+ sizeof(segXHDR) + sizeof(secXHDR)
|
||||||
|
+ sizeof(segTEXT) + sizeof(secTEXT) + sizeof(segLINK) +
|
||||||
|
my_thread_command_size /* + sizeof(uuid_cmd) + sizeof(linkitem) */ ;
|
||||||
mhdro.flags = Mach_header::MH_NOUNDEFS;
|
mhdro.flags = Mach_header::MH_NOUNDEFS;
|
||||||
}
|
}
|
||||||
fo->write(&mhdro, sizeof(mhdro));
|
fo->write(&mhdro, sizeof(mhdro));
|
||||||
|
|
||||||
segcmdo.cmd = lc_seg;
|
memset(&segZERO, 0, sizeof(segZERO));
|
||||||
segcmdo.cmdsize = sizeof(segcmdo);
|
segZERO.cmd = lc_seg;
|
||||||
strncpy((char *)segcmdo.segname, "__TEXT", sizeof(segcmdo.segname));
|
segZERO.cmdsize = sizeof(segZERO);
|
||||||
|
strncpy((char *)segZERO.segname, "__PAGEZERO", sizeof(segZERO.segname));
|
||||||
|
segZERO.vmsize = PAGE_SIZE;
|
||||||
|
|
||||||
|
segTEXT.cmd = lc_seg;
|
||||||
|
segTEXT.cmdsize = sizeof(segTEXT) + sizeof(secTEXT);
|
||||||
|
strncpy((char *)segTEXT.segname, "__TEXT", sizeof(segTEXT.segname));
|
||||||
if (my_filetype==Mach_header::MH_EXECUTE) {
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
segcmdo.vmaddr = PAGE_MASK64 & (~PAGE_MASK64 +
|
int k; // must ignore zero-length segments, which sort last
|
||||||
msegcmd[n_segment -1].vmsize + msegcmd[n_segment -1].vmaddr );
|
for (k=n_segment; --k>=0; )
|
||||||
|
if (msegcmd[k].vmsize!=0)
|
||||||
|
break;
|
||||||
|
segTEXT.vmaddr = PAGE_MASK64 & (~PAGE_MASK64 +
|
||||||
|
msegcmd[k].vmsize + msegcmd[k].vmaddr );
|
||||||
}
|
}
|
||||||
if (my_filetype==Mach_header::MH_DYLIB) {
|
if (my_filetype==Mach_header::MH_DYLIB) {
|
||||||
segcmdo.vmaddr = 0;
|
segTEXT.vmaddr = 0;
|
||||||
}
|
}
|
||||||
segcmdo.vmsize = 0; // adjust later
|
segTEXT.vmsize = 0; // adjust later
|
||||||
segcmdo.fileoff = 0;
|
segTEXT.fileoff = 0;
|
||||||
segcmdo.filesize = 0; // adjust later
|
segTEXT.filesize = 0; // adjust later
|
||||||
segcmdo.initprot = segcmdo.maxprot =
|
segTEXT.initprot = segTEXT.maxprot =
|
||||||
Mach_segment_command::VM_PROT_READ |
|
Mach_segment_command::VM_PROT_READ |
|
||||||
Mach_segment_command::VM_PROT_WRITE |
|
Mach_segment_command::VM_PROT_WRITE |
|
||||||
Mach_segment_command::VM_PROT_EXECUTE;
|
Mach_segment_command::VM_PROT_EXECUTE;
|
||||||
segcmdo.nsects = 0;
|
segTEXT.nsects = 1; // secTEXT
|
||||||
segcmdo.flags = 0;
|
segTEXT.flags = 0;
|
||||||
|
|
||||||
|
memset(&secTEXT, 0, sizeof(secTEXT));
|
||||||
|
strncpy((char *)secTEXT.sectname, "__text", sizeof(secTEXT.sectname));
|
||||||
|
memcpy(secTEXT.segname, segTEXT.segname, sizeof(secTEXT.segname));
|
||||||
|
secTEXT.align = 2; // (1<<2) ==> 4
|
||||||
|
|
||||||
|
segXHDR = segTEXT;
|
||||||
|
segXHDR.vmaddr = PAGE_SIZE;
|
||||||
|
segXHDR.vmsize = PAGE_SIZE;
|
||||||
|
segXHDR.filesize = PAGE_SIZE;
|
||||||
|
strncpy((char *)segXHDR.segname, "__XHDR", sizeof(segXHDR.segname));
|
||||||
|
|
||||||
|
memset(&secXHDR, 0, sizeof(secXHDR));
|
||||||
|
strncpy((char *)secXHDR.sectname, "__xhdr", sizeof(secXHDR.sectname));
|
||||||
|
memcpy(secXHDR.segname, segXHDR.segname, sizeof(secXHDR.segname));
|
||||||
|
secXHDR.addr = PAGE_SIZE;
|
||||||
|
secXHDR.size = 0; // empty so far
|
||||||
|
secXHDR.align = 2; // (1<<2) ==> 4
|
||||||
|
|
||||||
|
segLINK = segTEXT;
|
||||||
|
segLINK.cmdsize = sizeof(segLINK);
|
||||||
|
strncpy((char *)segLINK.segname, "__LINKEDIT", sizeof(segLINK.segname));
|
||||||
|
segLINK.nsects = 0;
|
||||||
|
segLINK.initprot = Mach_segment_command::VM_PROT_READ;
|
||||||
|
// Adjust later: .vmaddr .vmsize .fileoff .filesize
|
||||||
|
|
||||||
if (my_filetype==Mach_header::MH_EXECUTE) {
|
if (my_filetype==Mach_header::MH_EXECUTE) {
|
||||||
fo->write(&segcmdo, sizeof(segcmdo));
|
fo->write(&segZERO, sizeof(segZERO));
|
||||||
|
fo->write(&segXHDR, sizeof(segXHDR));
|
||||||
|
fo->write(&secXHDR, sizeof(secXHDR));
|
||||||
|
fo->write(&segTEXT, sizeof(segTEXT));
|
||||||
|
fo->write(&secTEXT, sizeof(secTEXT));
|
||||||
|
fo->write(&segLINK, sizeof(segLINK));
|
||||||
pack1_setup_threado(fo);
|
pack1_setup_threado(fo);
|
||||||
|
memset(&uuid_cmd, 0, sizeof(uuid_cmd));
|
||||||
|
fo->write(&uuid_cmd, sizeof(uuid_cmd));
|
||||||
|
memset(&linkitem, 0, sizeof(linkitem));
|
||||||
|
fo->write(&linkitem, sizeof(linkitem));
|
||||||
}
|
}
|
||||||
if (my_filetype==Mach_header::MH_DYLIB) {
|
if (my_filetype==Mach_header::MH_DYLIB) {
|
||||||
fo->write(rawmseg, mhdri.sizeofcmds);
|
fo->write(rawmseg, mhdri.sizeofcmds);
|
||||||
@@ -1073,7 +1258,11 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
fi->readx(&mhdri, sizeof(mhdri));
|
fi->readx(&mhdri, sizeof(mhdri));
|
||||||
rawmseg = (Mach_segment_command *)new char[(unsigned) mhdri.sizeofcmds];
|
rawmseg = (Mach_segment_command *)new char[(unsigned) mhdri.sizeofcmds];
|
||||||
fi->readx(rawmseg, mhdri.sizeofcmds);
|
fi->readx(rawmseg, mhdri.sizeofcmds);
|
||||||
overlay_offset = sizeof(mhdri) + mhdri.sizeofcmds + sizeof(linfo);
|
|
||||||
|
// FIXME forgot space left for LC_CODE_SIGNATURE;
|
||||||
|
// but PackUnix::canUnpack() sets overlay_offset anyway.
|
||||||
|
//overlay_offset = sizeof(mhdri) + mhdri.sizeofcmds + sizeof(linfo);
|
||||||
|
|
||||||
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));
|
||||||
@@ -1126,6 +1315,8 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
) {
|
) {
|
||||||
if (lc_seg==sc->cmd
|
if (lc_seg==sc->cmd
|
||||||
&& 0!=sc->filesize ) {
|
&& 0!=sc->filesize ) {
|
||||||
|
if (fo)
|
||||||
|
fo->seek(sc->fileoff, SEEK_SET);
|
||||||
unsigned filesize = sc->filesize;
|
unsigned filesize = sc->filesize;
|
||||||
unpackExtent(filesize, fo, total_in, total_out,
|
unpackExtent(filesize, fo, total_in, total_out,
|
||||||
c_adler, u_adler, false, sizeof(bhdr));
|
c_adler, u_adler, false, sizeof(bhdr));
|
||||||
@@ -1147,10 +1338,12 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
if (lc_seg==rc->cmd
|
if (lc_seg==rc->cmd
|
||||||
&& 0!=rc->filesize ) {
|
&& 0!=rc->filesize ) {
|
||||||
fi->seek(rc->fileoff, SEEK_SET);
|
fi->seek(rc->fileoff, SEEK_SET);
|
||||||
|
if (fo)
|
||||||
fo->seek(sc->fileoff, SEEK_SET);
|
fo->seek(sc->fileoff, SEEK_SET);
|
||||||
unsigned const len = rc->filesize;
|
unsigned const len = rc->filesize;
|
||||||
MemBuffer data(len);
|
MemBuffer data(len);
|
||||||
fi->readx(data, len);
|
fi->readx(data, len);
|
||||||
|
if (fo)
|
||||||
fo->write(data, len);
|
fo->write(data, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1159,14 +1352,14 @@ void PackMachBase<T>::unpack(OutputFile *fo)
|
|||||||
for (unsigned j = 0; j < ncmds; ++j) {
|
for (unsigned j = 0; j < ncmds; ++j) {
|
||||||
unsigned const size = find_SEGMENT_gap(j);
|
unsigned const size = find_SEGMENT_gap(j);
|
||||||
if (size) {
|
if (size) {
|
||||||
unsigned const where = msegcmd[k].fileoff +msegcmd[k].filesize;
|
unsigned const where = msegcmd[j].fileoff +msegcmd[j].filesize;
|
||||||
if (fo)
|
if (fo)
|
||||||
fo->seek(where, SEEK_SET);
|
fo->seek(where, SEEK_SET);
|
||||||
unpackExtent(size, fo, total_in, total_out,
|
unpackExtent(size, fo, total_in, total_out,
|
||||||
c_adler, u_adler, false, sizeof(bhdr));
|
c_adler, u_adler, false, sizeof(bhdr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
delete mhdr;
|
delete [] mhdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1207,19 +1400,19 @@ bool PackMachBase<T>::canPack()
|
|||||||
// Put LC_SEGMENT together at the beginning, ascending by .vmaddr.
|
// Put LC_SEGMENT together at the beginning, ascending by .vmaddr.
|
||||||
qsort(msegcmd, ncmds, sizeof(*msegcmd), compare_segment_command);
|
qsort(msegcmd, ncmds, sizeof(*msegcmd), compare_segment_command);
|
||||||
|
|
||||||
// Check that LC_SEGMENTs form one contiguous chunk of the file.
|
// Check alignment of non-null LC_SEGMENT.
|
||||||
for (unsigned j= 0; j < ncmds; ++j) {
|
for (unsigned j= 0; j < ncmds; ++j) {
|
||||||
if (lc_seg==msegcmd[j].cmd) {
|
if (lc_seg==msegcmd[j].cmd) {
|
||||||
if (~PAGE_MASK & (msegcmd[j].fileoff | msegcmd[j].vmaddr)) {
|
if (~PAGE_MASK & (msegcmd[j].fileoff | msegcmd[j].vmaddr)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (0 < j) {
|
if (msegcmd[j].vmsize==0)
|
||||||
unsigned const sz = PAGE_MASK
|
break; // was sorted last
|
||||||
& (~PAGE_MASK + msegcmd[j-1].filesize);
|
|
||||||
if ((sz + msegcmd[j-1].fileoff)!=msegcmd[j].fileoff) {
|
// We used to check that LC_SEGMENTS were contiguous,
|
||||||
return false;
|
// but apparently that is not needed anymore,
|
||||||
}
|
// and Google compilers generate strange layouts.
|
||||||
}
|
|
||||||
++n_segment;
|
++n_segment;
|
||||||
sz_segment = msegcmd[j].filesize + msegcmd[j].fileoff - msegcmd[0].fileoff;
|
sz_segment = msegcmd[j].filesize + msegcmd[j].fileoff - msegcmd[0].fileoff;
|
||||||
}
|
}
|
||||||
@@ -1351,15 +1544,19 @@ void PackMachFat::pack(OutputFile *fo)
|
|||||||
|
|
||||||
void PackMachFat::unpack(OutputFile *fo)
|
void PackMachFat::unpack(OutputFile *fo)
|
||||||
{
|
{
|
||||||
|
if (fo) { // test mode ("-t") sets fo = NULL
|
||||||
fo->seek(0, SEEK_SET);
|
fo->seek(0, SEEK_SET);
|
||||||
fo->write(&fat_head, sizeof(fat_head.fat) +
|
fo->write(&fat_head, sizeof(fat_head.fat) +
|
||||||
fat_head.fat.nfat_arch * sizeof(fat_head.arch[0]));
|
fat_head.fat.nfat_arch * sizeof(fat_head.arch[0]));
|
||||||
|
}
|
||||||
unsigned length;
|
unsigned length;
|
||||||
for (unsigned j=0; j < fat_head.fat.nfat_arch; ++j) {
|
for (unsigned j=0; j < fat_head.fat.nfat_arch; ++j) {
|
||||||
unsigned base = fo->unset_extent(); // actual length
|
unsigned base = (fo ? fo->unset_extent() : 0); // actual length
|
||||||
base += ~(~0u<<fat_head.arch[j].align) & (0-base); // align up
|
base += ~(~0u<<fat_head.arch[j].align) & (0-base); // align up
|
||||||
|
if (fo) {
|
||||||
fo->seek(base, SEEK_SET);
|
fo->seek(base, SEEK_SET);
|
||||||
fo->set_extent(base, ~0u);
|
fo->set_extent(base, ~0u);
|
||||||
|
}
|
||||||
|
|
||||||
ph.u_file_size = fat_head.arch[j].size;
|
ph.u_file_size = fat_head.arch[j].size;
|
||||||
fi->set_extent(fat_head.arch[j].offset, fat_head.arch[j].size);
|
fi->set_extent(fat_head.arch[j].offset, fat_head.arch[j].size);
|
||||||
@@ -1418,13 +1615,15 @@ void PackMachFat::unpack(OutputFile *fo)
|
|||||||
} break;
|
} break;
|
||||||
} // switch cputype
|
} // switch cputype
|
||||||
fat_head.arch[j].offset = base;
|
fat_head.arch[j].offset = base;
|
||||||
length = fo->unset_extent();
|
length = (fo ? fo->unset_extent() : 0);
|
||||||
fat_head.arch[j].size = length - base;
|
fat_head.arch[j].size = length - base;
|
||||||
}
|
}
|
||||||
|
if (fo) {
|
||||||
fo->unset_extent();
|
fo->unset_extent();
|
||||||
fo->seek(0, SEEK_SET);
|
fo->seek(0, SEEK_SET);
|
||||||
fo->rewrite(&fat_head, sizeof(fat_head.fat) +
|
fo->rewrite(&fat_head, sizeof(fat_head.fat) +
|
||||||
fat_head.fat.nfat_arch * sizeof(fat_head.arch[0]));
|
fat_head.fat.nfat_arch * sizeof(fat_head.arch[0]));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PackMachFat::canPack()
|
bool PackMachFat::canPack()
|
||||||
|
|||||||
+48
-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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -269,6 +269,25 @@ __packed_struct(Mach_twolevel_hints_command)
|
|||||||
#include "p_mach_enum.h"
|
#include "p_mach_enum.h"
|
||||||
__packed_struct_end()
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_linkedit_data_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
Word dataoff; // file offset of data in __LINKEDIT segment
|
||||||
|
Word datasize; // file size of data in __LINKEDIT segment
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
|
template <class TMachITypes>
|
||||||
|
__packed_struct(Mach_uuid_command)
|
||||||
|
typedef typename TMachITypes::Word Word;
|
||||||
|
|
||||||
|
Word cmd;
|
||||||
|
Word cmdsize;
|
||||||
|
unsigned char uuid[16];
|
||||||
|
__packed_struct_end()
|
||||||
|
|
||||||
template <class TMachITypes>
|
template <class TMachITypes>
|
||||||
__packed_struct(Mach_ppc_thread_state)
|
__packed_struct(Mach_ppc_thread_state)
|
||||||
typedef typename TMachITypes::Addr Addr;
|
typedef typename TMachITypes::Addr Addr;
|
||||||
@@ -392,6 +411,8 @@ struct MachClass_32
|
|||||||
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
||||||
typedef N_Mach::Mach_routines_command<MachITypes> Mach_routines_command;
|
typedef N_Mach::Mach_routines_command<MachITypes> Mach_routines_command;
|
||||||
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
||||||
|
typedef N_Mach::Mach_linkedit_data_command<MachITypes> Mach_linkedit_data_command;
|
||||||
|
typedef N_Mach::Mach_uuid_command<MachITypes> Mach_uuid_command;
|
||||||
typedef N_Mach::Mach_ppc_thread_state<MachITypes> Mach_ppc_thread_state;
|
typedef N_Mach::Mach_ppc_thread_state<MachITypes> Mach_ppc_thread_state;
|
||||||
typedef N_Mach::Mach_i386_thread_state<MachITypes> Mach_i386_thread_state;
|
typedef N_Mach::Mach_i386_thread_state<MachITypes> Mach_i386_thread_state;
|
||||||
typedef N_Mach::Mach_AMD64_thread_state<MachITypes> Mach_AMD64_thread_state;
|
typedef N_Mach::Mach_AMD64_thread_state<MachITypes> Mach_AMD64_thread_state;
|
||||||
@@ -428,6 +449,8 @@ struct MachClass_64
|
|||||||
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
typedef N_Mach::Mach_segsplit_info_command<MachITypes> Mach_segsplit_info_command;
|
||||||
typedef N_Mach::Mach_routines_command_64<MachITypes> Mach_routines_command;
|
typedef N_Mach::Mach_routines_command_64<MachITypes> Mach_routines_command;
|
||||||
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
typedef N_Mach::Mach_twolevel_hints_command<MachITypes> Mach_twolevel_hints_command;
|
||||||
|
typedef N_Mach::Mach_linkedit_data_command<MachITypes> Mach_linkedit_data_command;
|
||||||
|
typedef N_Mach::Mach_uuid_command<MachITypes> Mach_uuid_command;
|
||||||
|
|
||||||
static void compileTimeAssertions() {
|
static void compileTimeAssertions() {
|
||||||
BeLePolicy::compileTimeAssertions();
|
BeLePolicy::compileTimeAssertions();
|
||||||
@@ -452,6 +475,8 @@ typedef MachClass_Host32::Mach_dysymtab_command Mach32_dysymtab_command;
|
|||||||
typedef MachClass_Host32::Mach_segsplit_info_command Mach32_segsplit_info_command;
|
typedef MachClass_Host32::Mach_segsplit_info_command Mach32_segsplit_info_command;
|
||||||
typedef MachClass_Host32::Mach_routines_command Mach32_routines_command;
|
typedef MachClass_Host32::Mach_routines_command Mach32_routines_command;
|
||||||
typedef MachClass_Host32::Mach_twolevel_hints_command Mach32_twolevel_hints_command;
|
typedef MachClass_Host32::Mach_twolevel_hints_command Mach32_twolevel_hints_command;
|
||||||
|
typedef MachClass_Host32::Mach_linkedit_data_command Mach32_linkedit_data_command;
|
||||||
|
typedef MachClass_Host32::Mach_uuid_command Mach32_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_Host64::Mach_segment_command Mach64_segment_command;
|
typedef MachClass_Host64::Mach_segment_command Mach64_segment_command;
|
||||||
typedef MachClass_Host64::Mach_section_command Mach64_section_command;
|
typedef MachClass_Host64::Mach_section_command Mach64_section_command;
|
||||||
@@ -460,6 +485,8 @@ typedef MachClass_Host64::Mach_dysymtab_command Mach64_dysymtab_command;
|
|||||||
typedef MachClass_Host64::Mach_segsplit_info_command Mach64_segsplit_info_command;
|
typedef MachClass_Host64::Mach_segsplit_info_command Mach64_segsplit_info_command;
|
||||||
typedef MachClass_Host64::Mach_routines_command Mach64_routines_command;
|
typedef MachClass_Host64::Mach_routines_command Mach64_routines_command;
|
||||||
typedef MachClass_Host64::Mach_twolevel_hints_command Mach64_twolevel_hints_command;
|
typedef MachClass_Host64::Mach_twolevel_hints_command Mach64_twolevel_hints_command;
|
||||||
|
typedef MachClass_Host64::Mach_linkedit_data_command Mach64_linkedit_data_command;
|
||||||
|
typedef MachClass_Host64::Mach_uuid_command Mach64_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_BE32::Mach_segment_command MachBE32_segment_command;
|
typedef MachClass_BE32::Mach_segment_command MachBE32_segment_command;
|
||||||
typedef MachClass_BE32::Mach_section_command MachBE32_section_command;
|
typedef MachClass_BE32::Mach_section_command MachBE32_section_command;
|
||||||
@@ -468,6 +495,8 @@ typedef MachClass_BE32::Mach_dysymtab_command MachBE32_dysymtab_command;
|
|||||||
typedef MachClass_BE32::Mach_segsplit_info_command MachBE32_segsplit_info_command;
|
typedef MachClass_BE32::Mach_segsplit_info_command MachBE32_segsplit_info_command;
|
||||||
typedef MachClass_BE32::Mach_routines_command MachBE32_routines_command;
|
typedef MachClass_BE32::Mach_routines_command MachBE32_routines_command;
|
||||||
typedef MachClass_BE32::Mach_twolevel_hints_command MachBE32_twolevel_hints_command;
|
typedef MachClass_BE32::Mach_twolevel_hints_command MachBE32_twolevel_hints_command;
|
||||||
|
typedef MachClass_BE32::Mach_linkedit_data_command MachBE32_linkedit_data_command;
|
||||||
|
typedef MachClass_BE32::Mach_uuid_command MachBE32_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_BE64::Mach_segment_command MachBE64_segment_command;
|
typedef MachClass_BE64::Mach_segment_command MachBE64_segment_command;
|
||||||
typedef MachClass_BE64::Mach_section_command MachBE64_section_command;
|
typedef MachClass_BE64::Mach_section_command MachBE64_section_command;
|
||||||
@@ -476,6 +505,8 @@ typedef MachClass_BE64::Mach_dysymtab_command MachBE64_dysymtab_command;
|
|||||||
typedef MachClass_BE64::Mach_segsplit_info_command MachBE64_segsplit_info_command;
|
typedef MachClass_BE64::Mach_segsplit_info_command MachBE64_segsplit_info_command;
|
||||||
typedef MachClass_BE64::Mach_routines_command MachBE64_routines_command;
|
typedef MachClass_BE64::Mach_routines_command MachBE64_routines_command;
|
||||||
typedef MachClass_BE64::Mach_twolevel_hints_command MachBE64_twolevel_hints_command;
|
typedef MachClass_BE64::Mach_twolevel_hints_command MachBE64_twolevel_hints_command;
|
||||||
|
typedef MachClass_BE64::Mach_linkedit_data_command MachBE64_linkedit_data_command;
|
||||||
|
typedef MachClass_BE64::Mach_uuid_command MachBE64_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_LE32::Mach_segment_command MachLE32_segment_command;
|
typedef MachClass_LE32::Mach_segment_command MachLE32_segment_command;
|
||||||
typedef MachClass_LE32::Mach_section_command MachLE32_section_command;
|
typedef MachClass_LE32::Mach_section_command MachLE32_section_command;
|
||||||
@@ -484,6 +515,8 @@ typedef MachClass_LE32::Mach_dysymtab_command MachLE32_dysymtab_command;
|
|||||||
typedef MachClass_LE32::Mach_segsplit_info_command MachLE32_segsplit_info_command;
|
typedef MachClass_LE32::Mach_segsplit_info_command MachLE32_segsplit_info_command;
|
||||||
typedef MachClass_LE32::Mach_routines_command MachLE32_routines_command;
|
typedef MachClass_LE32::Mach_routines_command MachLE32_routines_command;
|
||||||
typedef MachClass_LE32::Mach_twolevel_hints_command MachLE32_twolevel_hints_command;
|
typedef MachClass_LE32::Mach_twolevel_hints_command MachLE32_twolevel_hints_command;
|
||||||
|
typedef MachClass_LE32::Mach_linkedit_data_command MachLE32_linkedit_data_command;
|
||||||
|
typedef MachClass_LE32::Mach_uuid_command MachLE32_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_LE64::Mach_segment_command MachLE64_segment_command;
|
typedef MachClass_LE64::Mach_segment_command MachLE64_segment_command;
|
||||||
typedef MachClass_LE64::Mach_section_command MachLE64_section_command;
|
typedef MachClass_LE64::Mach_section_command MachLE64_section_command;
|
||||||
@@ -492,6 +525,8 @@ typedef MachClass_LE64::Mach_dysymtab_command MachLE64_dysymtab_command;
|
|||||||
typedef MachClass_LE64::Mach_segsplit_info_command MachLE64_segsplit_info_command;
|
typedef MachClass_LE64::Mach_segsplit_info_command MachLE64_segsplit_info_command;
|
||||||
typedef MachClass_LE64::Mach_routines_command MachLE64_routines_command;
|
typedef MachClass_LE64::Mach_routines_command MachLE64_routines_command;
|
||||||
typedef MachClass_LE64::Mach_twolevel_hints_command MachLE64_twolevel_hints_command;
|
typedef MachClass_LE64::Mach_twolevel_hints_command MachLE64_twolevel_hints_command;
|
||||||
|
typedef MachClass_LE64::Mach_linkedit_data_command MachLE64_linkedit_data_command;
|
||||||
|
typedef MachClass_LE64::Mach_uuid_command MachLE64_uuid_command;
|
||||||
|
|
||||||
typedef MachClass_BE32::Mach_ppc_thread_state Mach_ppc_thread_state;
|
typedef MachClass_BE32::Mach_ppc_thread_state Mach_ppc_thread_state;
|
||||||
typedef MachClass_LE32::Mach_i386_thread_state Mach_i386_thread_state;
|
typedef MachClass_LE32::Mach_i386_thread_state Mach_i386_thread_state;
|
||||||
@@ -522,6 +557,8 @@ protected:
|
|||||||
typedef typename MachClass::Mach_segsplit_info_command Mach_segsplit_info_command;
|
typedef typename MachClass::Mach_segsplit_info_command Mach_segsplit_info_command;
|
||||||
typedef typename MachClass::Mach_routines_command Mach_routines_command;
|
typedef typename MachClass::Mach_routines_command Mach_routines_command;
|
||||||
typedef typename MachClass::Mach_twolevel_hints_command Mach_twolevel_hints_command;
|
typedef typename MachClass::Mach_twolevel_hints_command Mach_twolevel_hints_command;
|
||||||
|
typedef typename MachClass::Mach_linkedit_data_command Mach_linkedit_data_command;
|
||||||
|
typedef typename MachClass::Mach_uuid_command Mach_uuid_command;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PackMachBase(InputFile *, unsigned cpuid, unsigned filetype,
|
PackMachBase(InputFile *, unsigned cpuid, unsigned filetype,
|
||||||
@@ -532,7 +569,7 @@ public:
|
|||||||
|
|
||||||
// called by the generic pack()
|
// called by the generic pack()
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
virtual void pack3(OutputFile *, Filter &) = 0; // append loader
|
||||||
virtual void pack4(OutputFile *, Filter &) = 0; // append PackHeader
|
virtual void pack4(OutputFile *, Filter &) = 0; // append PackHeader
|
||||||
|
|
||||||
@@ -575,7 +612,14 @@ protected:
|
|||||||
Mach_header mhdri;
|
Mach_header mhdri;
|
||||||
|
|
||||||
Mach_header mhdro;
|
Mach_header mhdro;
|
||||||
Mach_segment_command segcmdo;
|
Mach_segment_command segZERO;
|
||||||
|
Mach_segment_command segXHDR; // location to put eXtra headers
|
||||||
|
Mach_section_command secXHDR;
|
||||||
|
Mach_segment_command segTEXT;
|
||||||
|
Mach_section_command secTEXT;
|
||||||
|
Mach_segment_command segLINK;
|
||||||
|
Mach_linkedit_data_command linkitem;
|
||||||
|
Mach_uuid_command uuid_cmd;
|
||||||
|
|
||||||
__packed_struct(b_info) // 12-byte header before each compressed block
|
__packed_struct(b_info) // 12-byte header before each compressed block
|
||||||
TE32 sz_unc; // uncompressed_size
|
TE32 sz_unc; // uncompressed_size
|
||||||
|
|||||||
+3
-2
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
Copyright (C) 2007-2010 John F. Reiser
|
Copyright (C) 2007-2013 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
|
||||||
@@ -52,7 +52,8 @@
|
|||||||
};
|
};
|
||||||
enum { // filetype
|
enum { // filetype
|
||||||
MH_EXECUTE = 2,
|
MH_EXECUTE = 2,
|
||||||
MH_DYLIB = 6
|
MH_DYLIB = 6,
|
||||||
|
MH_BUNDLE = 8 /* dynamically bound bundle file */
|
||||||
};
|
};
|
||||||
enum { // flags
|
enum { // flags
|
||||||
MH_NOUNDEFS = 1
|
MH_NOUNDEFS = 1
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2013 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
|
||||||
|
|||||||
+3
-3
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 Laszlo Molnar
|
||||||
Copyright (C) 2002-2010 Jens Medoch
|
Copyright (C) 2002-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+5
-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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -327,7 +327,9 @@ void PackTmt::unpack(OutputFile *fo)
|
|||||||
{
|
{
|
||||||
Filter ft(ph.level);
|
Filter ft(ph.level);
|
||||||
ft.init(ph.filter, 0);
|
ft.init(ph.filter, 0);
|
||||||
ft.cto = (unsigned char) (ph.version < 11 ? (get_le32(obuf+ph.u_len-12) >> 24) : ph.filter_cto);
|
ft.cto = (unsigned char) ph.filter_cto;
|
||||||
|
if (ph.version < 11)
|
||||||
|
ft.cto = (unsigned char) (get_le32(obuf+ph.u_len-12) >> 24);
|
||||||
ft.unfilter(obuf, ptr_diff(relocs, obuf));
|
ft.unfilter(obuf, ptr_diff(relocs, obuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+25
-12
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -130,7 +130,7 @@ int PackUnix::getStrategy(Filter &/*ft*/)
|
|||||||
return (opt->no_filter ? -3 : ((opt->filter > 0) ? -2 : 2));
|
return (opt->no_filter ? -3 : ((opt->filter > 0) ? -2 : 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackUnix::pack2(OutputFile *fo, Filter &ft)
|
int PackUnix::pack2(OutputFile *fo, Filter &ft)
|
||||||
{
|
{
|
||||||
// compress blocks
|
// compress blocks
|
||||||
unsigned total_in = 0;
|
unsigned total_in = 0;
|
||||||
@@ -142,6 +142,7 @@ void PackUnix::pack2(OutputFile *fo, Filter &ft)
|
|||||||
// ui_total_passes = 0;
|
// ui_total_passes = 0;
|
||||||
|
|
||||||
unsigned remaining = file_size;
|
unsigned remaining = file_size;
|
||||||
|
unsigned n_block = 0;
|
||||||
while (remaining > 0)
|
while (remaining > 0)
|
||||||
{
|
{
|
||||||
// FIXME: disable filters if we have more than one block.
|
// FIXME: disable filters if we have more than one block.
|
||||||
@@ -170,7 +171,8 @@ void PackUnix::pack2(OutputFile *fo, Filter &ft)
|
|||||||
// that is, AFTER filtering. We want BEFORE filtering,
|
// that is, AFTER filtering. We want BEFORE filtering,
|
||||||
// so that decompression checks the end-to-end checksum.
|
// so that decompression checks the end-to-end checksum.
|
||||||
unsigned const end_u_adler = upx_adler32(ibuf, ph.u_len, ph.u_adler);
|
unsigned const end_u_adler = upx_adler32(ibuf, ph.u_len, ph.u_adler);
|
||||||
compressWithFilters(&ft, OVERHEAD, NULL_cconf, filter_strategy);
|
compressWithFilters(&ft, OVERHEAD, NULL_cconf, filter_strategy,
|
||||||
|
!!n_block++); // check compression ratio only on first block
|
||||||
|
|
||||||
if (ph.c_len < ph.u_len) {
|
if (ph.c_len < ph.u_len) {
|
||||||
const upx_bytep tbuf = NULL;
|
const upx_bytep tbuf = NULL;
|
||||||
@@ -222,6 +224,8 @@ void PackUnix::pack2(OutputFile *fo, Filter &ft)
|
|||||||
if ((off_t)total_in != file_size) {
|
if ((off_t)total_in != file_size) {
|
||||||
throwEOFException();
|
throwEOFException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 1; // default: write end-of-compression bhdr next
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -231,11 +235,11 @@ PackUnix::patchLoaderChecksum()
|
|||||||
l_info *const lp = &linfo;
|
l_info *const lp = &linfo;
|
||||||
// checksum for loader; also some PackHeader info
|
// checksum for loader; also some PackHeader info
|
||||||
lp->l_magic = UPX_MAGIC_LE32; // LE32 always
|
lp->l_magic = UPX_MAGIC_LE32; // LE32 always
|
||||||
lp->l_lsize = (unsigned short) lsize;
|
set_te16(&lp->l_lsize, (unsigned short) lsize);
|
||||||
lp->l_version = (unsigned char) ph.version;
|
lp->l_version = (unsigned char) ph.version;
|
||||||
lp->l_format = (unsigned char) ph.format;
|
lp->l_format = (unsigned char) ph.format;
|
||||||
// INFO: lp->l_checksum is currently unused
|
// INFO: lp->l_checksum is currently unused
|
||||||
lp->l_checksum = upx_adler32(ptr, lsize);
|
set_te32(&lp->l_checksum, upx_adler32(ptr, lsize));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PackUnix::pack3(OutputFile *fo, Filter &/*ft*/)
|
void PackUnix::pack3(OutputFile *fo, Filter &/*ft*/)
|
||||||
@@ -283,12 +287,13 @@ void PackUnix::pack(OutputFile *fo)
|
|||||||
set_te32(&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
|
// append the compressed body
|
||||||
|
if (pack2(fo, ft)) {
|
||||||
// write block end marker (uncompressed size 0)
|
// write block end marker (uncompressed size 0)
|
||||||
b_info hdr; memset(&hdr, 0, sizeof(hdr));
|
b_info hdr; memset(&hdr, 0, sizeof(hdr));
|
||||||
set_le32(&hdr.sz_cpr, UPX_MAGIC_LE32);
|
set_le32(&hdr.sz_cpr, UPX_MAGIC_LE32);
|
||||||
fo->write(&hdr, sizeof(hdr));
|
fo->write(&hdr, sizeof(hdr));
|
||||||
|
}
|
||||||
|
|
||||||
pack3(fo, ft); // append loader
|
pack3(fo, ft); // append loader
|
||||||
|
|
||||||
@@ -498,18 +503,26 @@ void PackUnix::unpackExtent(unsigned wanted, OutputFile *fo,
|
|||||||
|
|
||||||
int PackUnix::canUnpack()
|
int PackUnix::canUnpack()
|
||||||
{
|
{
|
||||||
upx_byte buf[128];
|
int const small = 32 + sizeof(overlay_offset);
|
||||||
const int bufsize = sizeof(buf);
|
// Allow zero-filled last page, for Mac OS X code signing.
|
||||||
|
int bufsize = 2*4096 + 2*small +1;
|
||||||
|
if (bufsize > fi->st_size())
|
||||||
|
bufsize = fi->st_size();
|
||||||
|
MemBuffer buf(bufsize);
|
||||||
|
|
||||||
fi->seek(-bufsize, SEEK_END);
|
fi->seek(-bufsize, SEEK_END);
|
||||||
fi->readx(buf, bufsize);
|
fi->readx(buf, bufsize);
|
||||||
if (!getPackHeader(buf, bufsize, true)) // allow incompressible extents
|
int i = bufsize;
|
||||||
|
while (i > small && 0 == buf[--i]) { }
|
||||||
|
i -= small;
|
||||||
|
// allow incompressible extents
|
||||||
|
if (i < 0 || !getPackHeader(buf + i, bufsize - i, true))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
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_te32(buf+l);
|
overlay_offset = get_te32(buf + i + l);
|
||||||
if ((off_t)overlay_offset >= file_size)
|
if ((off_t)overlay_offset >= file_size)
|
||||||
throwCantUnpack("file corrupted");
|
throwCantUnpack("file corrupted");
|
||||||
|
|
||||||
|
|||||||
+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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -54,7 +54,7 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
// called by the generic pack()
|
// called by the generic pack()
|
||||||
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
virtual void pack1(OutputFile *, Filter &); // generate executable header
|
||||||
virtual void pack2(OutputFile *, Filter &); // append compressed data
|
virtual int pack2(OutputFile *, Filter &); // append compressed data
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
+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) 2004-2010 John Reiser
|
Copyright (C) 2004-2013 John Reiser
|
||||||
Copyright (C) 1996-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -1079,8 +1079,8 @@ void PackVmlinuxAMD64::defineDecompressorSymbols()
|
|||||||
// We assume a 32-bit boot loader, so we use the 32-bit convention
|
// We assume a 32-bit boot loader, so we use the 32-bit convention
|
||||||
// of "enter at the beginning" (startup_32). The 64-bit convention
|
// of "enter at the beginning" (startup_32). The 64-bit convention
|
||||||
// would be to use ehdri.e_entry (startup_64).
|
// would be to use ehdri.e_entry (startup_64).
|
||||||
linker->defineSymbol("ENTRY_POINT", phdri[0].p_paddr);
|
linker->defineSymbol("ENTRY_POINT", (unsigned) phdri[0].p_paddr);
|
||||||
linker->defineSymbol("PHYSICAL_START", phdri[0].p_paddr);
|
linker->defineSymbol("PHYSICAL_START", (unsigned) phdri[0].p_paddr);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
unsigned PackVmlinuxARMEL::write_vmlinux_head(
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
+29
-21
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
@@ -183,6 +183,8 @@ int PackW32Pe::readFileHeader()
|
|||||||
// the virtual memory manager only for pages which are not yet loaded.
|
// the virtual memory manager only for pages which are not yet loaded.
|
||||||
// of course it was impossible to debug this ;-)
|
// of course it was impossible to debug this ;-)
|
||||||
|
|
||||||
|
#define TLS_CB_ALIGNMENT 4u // alignment of tls callbacks
|
||||||
|
|
||||||
__packed_struct(tls)
|
__packed_struct(tls)
|
||||||
LE32 datastart; // VA tls init data start
|
LE32 datastart; // VA tls init data start
|
||||||
LE32 dataend; // VA tls init data end
|
LE32 dataend; // VA tls init data end
|
||||||
@@ -211,13 +213,6 @@ void PackW32Pe::processTls(Interval *iv) // pass 1
|
|||||||
unsigned v = get_le32(ibuf + tlsp->callbacks - ih.imagebase);
|
unsigned v = get_le32(ibuf + tlsp->callbacks - ih.imagebase);
|
||||||
|
|
||||||
//NEW: TLS callback support - Stefan Widmann
|
//NEW: TLS callback support - Stefan Widmann
|
||||||
#if 0
|
|
||||||
if (v != 0)
|
|
||||||
{
|
|
||||||
//fprintf(stderr, "TLS callbacks: 0x%0x -> 0x%0x\n", (int)tlsp->callbacks, v);
|
|
||||||
throwCantPack("TLS callbacks are not supported");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if(v != 0)
|
if(v != 0)
|
||||||
{
|
{
|
||||||
//count number of callbacks, just for information string - Stefan Widmann
|
//count number of callbacks, just for information string - Stefan Widmann
|
||||||
@@ -248,13 +243,16 @@ void PackW32Pe::processTls(Interval *iv) // pass 1
|
|||||||
if (pos >= tlsdatastart && pos < tlsdataend)
|
if (pos >= tlsdatastart && pos < tlsdataend)
|
||||||
iv->add(pos,type);
|
iv->add(pos,type);
|
||||||
|
|
||||||
//NEW: if TLS callbacks are used, we need two more DWORDS at the end of the TLS
|
sotls = sizeof(tls) + tlsdataend - tlsdatastart;
|
||||||
sotls = sizeof(tls) + tlsdataend - tlsdatastart + (use_tls_callbacks ? 8 : 0);
|
// if TLS callbacks are used, we need two more DWORDS at the end of the TLS
|
||||||
|
// ... and those dwords should be correctly aligned
|
||||||
|
if (use_tls_callbacks)
|
||||||
|
sotls = ALIGN_UP(sotls, TLS_CB_ALIGNMENT) + 8;
|
||||||
|
|
||||||
// the PE loader wants this stuff uncompressed
|
// the PE loader wants this stuff uncompressed
|
||||||
otls = new upx_byte[sotls];
|
otls = new upx_byte[sotls];
|
||||||
memset(otls,0,sotls);
|
memset(otls,0,sotls);
|
||||||
memcpy(otls,ibuf + IDADDR(PEDIR_TLS),0x18);
|
memcpy(otls,ibuf + IDADDR(PEDIR_TLS),sizeof(tls));
|
||||||
// WARNING: this can acces data in BSS
|
// WARNING: this can acces data in BSS
|
||||||
memcpy(otls + sizeof(tls),ibuf + tlsdatastart,sotls - sizeof(tls));
|
memcpy(otls + sizeof(tls),ibuf + tlsdatastart,sotls - sizeof(tls));
|
||||||
tlsindex = tlsp->tlsindex - ih.imagebase;
|
tlsindex = tlsp->tlsindex - ih.imagebase;
|
||||||
@@ -292,9 +290,9 @@ void PackW32Pe::processTls(Reloc *rel,const Interval *iv,unsigned newaddr) // pa
|
|||||||
rel->add(kc - ih.imagebase,iv->ivarr[ic].len);
|
rel->add(kc - ih.imagebase,iv->ivarr[ic].len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const unsigned tls_data_size = tlsp->dataend - tlsp->datastart;
|
||||||
tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase;
|
tlsp->datastart = newaddr + sizeof(tls) + ih.imagebase;
|
||||||
//NEW: subtract the size of the callback chain from dataend - Stefan Widmann
|
tlsp->dataend = tlsp->datastart + tls_data_size;
|
||||||
tlsp->dataend = newaddr + sotls + ih.imagebase - (use_tls_callbacks ? 8 : 0);
|
|
||||||
|
|
||||||
//NEW: if we have TLS callbacks to handle, we create a pointer to the new callback chain - Stefan Widmann
|
//NEW: if we have TLS callbacks to handle, we create a pointer to the new callback chain - Stefan Widmann
|
||||||
tlsp->callbacks = (use_tls_callbacks ? newaddr + sotls + ih.imagebase - 8 : 0);
|
tlsp->callbacks = (use_tls_callbacks ? newaddr + sotls + ih.imagebase - 8 : 0);
|
||||||
@@ -365,6 +363,7 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
unsigned iat;
|
unsigned iat;
|
||||||
LE32 *lookupt;
|
LE32 *lookupt;
|
||||||
unsigned npos;
|
unsigned npos;
|
||||||
|
unsigned original_position;
|
||||||
bool isk32;
|
bool isk32;
|
||||||
|
|
||||||
static int __acc_cdecl_qsort compare(const void *p1, const void *p2)
|
static int __acc_cdecl_qsort compare(const void *p1, const void *p2)
|
||||||
@@ -373,6 +372,8 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
const udll *u2 = * (const udll * const *) p2;
|
const udll *u2 = * (const udll * const *) p2;
|
||||||
if (u1->isk32) return -1;
|
if (u1->isk32) return -1;
|
||||||
if (u2->isk32) return 1;
|
if (u2->isk32) return 1;
|
||||||
|
if (!*u1->lookupt) return 1;
|
||||||
|
if (!*u2->lookupt) return -1;
|
||||||
int rc = strcasecmp(u1->name,u2->name);
|
int rc = strcasecmp(u1->name,u2->name);
|
||||||
if (rc) return rc;
|
if (rc) return rc;
|
||||||
if (u1->ordinal) return -1;
|
if (u1->ordinal) return -1;
|
||||||
@@ -399,11 +400,12 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
dlls[ic].iat = im->iat;
|
dlls[ic].iat = im->iat;
|
||||||
dlls[ic].lookupt = (LE32*) (ibuf + (im->oft ? im->oft : im->iat));
|
dlls[ic].lookupt = (LE32*) (ibuf + (im->oft ? im->oft : im->iat));
|
||||||
dlls[ic].npos = 0;
|
dlls[ic].npos = 0;
|
||||||
|
dlls[ic].original_position = ic;
|
||||||
dlls[ic].isk32 = strcasecmp(kernel32dll,dlls[ic].name) == 0;
|
dlls[ic].isk32 = strcasecmp(kernel32dll,dlls[ic].name) == 0;
|
||||||
|
|
||||||
soimport += strlen(dlls[ic].name) + 1 + 4;
|
soimport += strlen(dlls[ic].name) + 1 + 4;
|
||||||
|
|
||||||
for (LE32 *tarr = dlls[ic].lookupt; *tarr; tarr++)
|
for (IPTR_I(LE32, tarr, dlls[ic].lookupt); *tarr; tarr += 1)
|
||||||
{
|
{
|
||||||
if (*tarr & 0x80000000)
|
if (*tarr & 0x80000000)
|
||||||
{
|
{
|
||||||
@@ -415,10 +417,11 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned len = strlen(ibuf + *tarr + 2);
|
IPTR_I(const upx_byte, n, ibuf + *tarr + 2);
|
||||||
|
unsigned len = strlen(n);
|
||||||
soimport += len + 1;
|
soimport += len + 1;
|
||||||
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
if (dlls[ic].shname == NULL || len < strlen (dlls[ic].shname))
|
||||||
dlls[ic].shname = ibuf + *tarr + 2;
|
dlls[ic].shname = n;
|
||||||
}
|
}
|
||||||
soimport++; // separator
|
soimport++; // separator
|
||||||
}
|
}
|
||||||
@@ -510,8 +513,10 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
for (ic = 0; ic < dllnum; ic++)
|
for (ic = 0; ic < dllnum; ic++)
|
||||||
{
|
{
|
||||||
LE32 *tarr = idlls[ic]->lookupt;
|
LE32 *tarr = idlls[ic]->lookupt;
|
||||||
|
#if 0 && ENABLE_THIS_AND_UNCOMPRESSION_WILL_BREAK
|
||||||
if (!*tarr) // no imports from this dll
|
if (!*tarr) // no imports from this dll
|
||||||
continue;
|
continue;
|
||||||
|
#endif
|
||||||
set_le32(ppi,idlls[ic]->npos);
|
set_le32(ppi,idlls[ic]->npos);
|
||||||
set_le32(ppi+4,idlls[ic]->iat - rvamin);
|
set_le32(ppi+4,idlls[ic]->iat - rvamin);
|
||||||
ppi += 8;
|
ppi += 8;
|
||||||
@@ -579,7 +584,7 @@ unsigned PackW32Pe::processImports() // pass 1
|
|||||||
for (ic = 0; ic < dllnum; ic++, im++)
|
for (ic = 0; ic < dllnum; ic++, im++)
|
||||||
{
|
{
|
||||||
memset(im,FILLVAL,sizeof(*im));
|
memset(im,FILLVAL,sizeof(*im));
|
||||||
im->dllname = ptr_diff(idlls[ic]->name,ibuf); // I only need this info
|
im->dllname = ptr_diff(dlls[idlls[ic]->original_position].name,ibuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -829,7 +834,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
throwCantPack("PE32/EFIROM files are not yet supported");
|
throwCantPack("PE32/EFIROM files are not yet supported");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 14: //XBOX - will we ever see an XBOX file?
|
case 14: //XBOX - will we ever see a XBOX file?
|
||||||
{
|
{
|
||||||
throwCantPack("PE32/xbox files are not yet supported");
|
throwCantPack("PE32/xbox files are not yet supported");
|
||||||
break;
|
break;
|
||||||
@@ -912,7 +917,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
if (!isrtm && ((isection[ic].flags & (PEFL_WRITE|PEFL_SHARED))
|
if (!isrtm && ((isection[ic].flags & (PEFL_WRITE|PEFL_SHARED))
|
||||||
== (PEFL_WRITE|PEFL_SHARED)))
|
== (PEFL_WRITE|PEFL_SHARED)))
|
||||||
if (!opt->force)
|
if (!opt->force)
|
||||||
throwCantPack("writeable shared sections not supported (try --force)");
|
throwCantPack("writable shared sections not supported (try --force)");
|
||||||
if (jc && isection[ic].rawdataptr - jc > ih.filealign)
|
if (jc && isection[ic].rawdataptr - jc > ih.filealign)
|
||||||
throwCantPack("superfluous data between sections");
|
throwCantPack("superfluous data between sections");
|
||||||
fi->seek(isection[ic].rawdataptr,SEEK_SET);
|
fi->seek(isection[ic].rawdataptr,SEEK_SET);
|
||||||
@@ -1087,7 +1092,7 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
// still in a read only section by looking at the pe header of the
|
// still in a read only section by looking at the pe header of the
|
||||||
// file. If this check fails the runtime does "interesting" things
|
// file. If this check fails the runtime does "interesting" things
|
||||||
// like not running the floating point initialization code - the result
|
// like not running the floating point initialization code - the result
|
||||||
// is an R6002 runtime error.
|
// is a R6002 runtime error.
|
||||||
// These supposed to be read only addresses are covered by the sections
|
// These supposed to be read only addresses are covered by the sections
|
||||||
// UPX0 & UPX1 in the compressed files, so we have to patch the PE header
|
// UPX0 & UPX1 in the compressed files, so we have to patch the PE header
|
||||||
// in the memory. And the page on which the PE header is stored is read
|
// in the memory. And the page on which the PE header is stored is read
|
||||||
@@ -1180,9 +1185,12 @@ void PackW32Pe::pack(OutputFile *fo)
|
|||||||
|
|
||||||
//ic = s1addr + s1size - sotls - soloadconf; //ATTENTION: moved upwards to TLS callback handling - Stefan Widmann
|
//ic = s1addr + s1size - sotls - soloadconf; //ATTENTION: moved upwards to TLS callback handling - Stefan Widmann
|
||||||
//get address of TLS callback handler
|
//get address of TLS callback handler
|
||||||
|
if (use_tls_callbacks)
|
||||||
|
{
|
||||||
tls_handler_offset = linker->getSymbolOffset("PETLSC2");
|
tls_handler_offset = linker->getSymbolOffset("PETLSC2");
|
||||||
//add relocation entry for TLS callback handler
|
//add relocation entry for TLS callback handler
|
||||||
rel.add(tls_handler_offset + 4, 3);
|
rel.add(tls_handler_offset + 4, 3);
|
||||||
|
}
|
||||||
|
|
||||||
processTls(&rel,&tlsiv,ic);
|
processTls(&rel,&tlsiv,ic);
|
||||||
ODADDR(PEDIR_TLS) = sotls ? ic : 0;
|
ODADDR(PEDIR_TLS) = sotls ? ic : 0;
|
||||||
|
|||||||
+2
-2
@@ -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-2010 Markus Franz Xaver Johannes Oberhumer
|
Copyright (C) 1996-2013 Markus Franz Xaver Johannes Oberhumer
|
||||||
Copyright (C) 1996-2010 Laszlo Molnar
|
Copyright (C) 1996-2013 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
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user