1
0
mirror of https://github.com/upx/upx.git synced 2025-08-11 22:52:30 +08:00

src: fix building under freebsd; updates

This commit is contained in:
Markus F.X.J. Oberhumer
2023-06-27 12:59:24 +02:00
parent 060b01260d
commit f622871eb0
11 changed files with 1642 additions and 110 deletions

View File

@ -11,8 +11,8 @@ on: [push, workflow_dispatch]
env:
DEBIAN_FRONTEND: noninteractive
UPX_CMAKE_BUILD_FLAGS: --verbose
# 2023-06-24
ZIG_DIST_VERSION: 0.11.0-dev.3797+d82ab4fd8
# 2023-06-27
ZIG_DIST_VERSION: 0.11.0-dev.3859+88284c124
jobs:
job-rebuild-and-verify-stubs:

View File

@ -8,8 +8,8 @@ on:
workflow_dispatch:
env:
# 2023-06-24
ZIG_DIST_VERSION: 0.11.0-dev.3797+d82ab4fd8
# 2023-06-27
ZIG_DIST_VERSION: 0.11.0-dev.3859+88284c124
jobs:
job-linux-zigcc:

6
NEWS
View File

@ -524,12 +524,12 @@ Changes in 0.40 (05 Oct 1998)
* fixed a small but fatal bug in dos/sys introduced in 0.30
* fixed a rare bug in dos/exe
* worked around a bug in djgpp's strip 2.8
* djgpp/coff: Allegro packfile support should work now
* djgpp2/coff: Allegro packfile support should work now
* added dos/exeh compression method (works on 386+)
Changes in 0.30 (27 Jul 1998)
* fixed a serious bug in the 32-bit compressors - please don't use
djgpp/coff and watcom/le compressed files from previous versions,
djgpp2/coff and watcom/le compressed files from previous versions,
some of them are possibly damaged !
* the 16-bit uncompressors are a little bit shorter & faster
* fixed progress indicator for VESA and SVGA text modes
@ -540,5 +540,5 @@ Changes in 0.20 (05 Jul 1998)
Changes in 0.05 (26 May 1998)
* first public beta release
* based on experience gained from our previous packers DJP (1996),
* based on experience gained from our previous packers DJP (djgpp2/coff, 1996),
lzop (1996) and mfxpak (atari/tos, 1990)

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,4 @@
Packages:
+++-===========================-=======================================-============-================================================================================
Desired=Unknown/Install/Remove/Purge/Hold
ii 7zip 21.07+dfsg-4 amd64 7-Zip file archiver with a high compression ratio
@ -90,7 +91,7 @@ ii libboost-regex1.74.0:amd64 1.74.0-14ubuntu3 amd64
ii libbrotli1:amd64 1.0.9-2build6 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libbsd0:amd64 0.11.5-1 amd64 utility functions from BSD systems - shared library
ii libbz2-1.0:amd64 1.0.8-5build1 amd64 high-quality block-sorting file compressor library - runtime
ii libc-ares2:amd64 1.18.1-1ubuntu0.22.04.1 amd64 asynchronous name resolver
ii libc-ares2:amd64 1.18.1-1ubuntu0.22.04.2 amd64 asynchronous name resolver
ii libc-bin 2.35-0ubuntu3.1 amd64 GNU C Library: Binaries
ii libc-dev-bin 2.35-0ubuntu3.1 amd64 GNU C Library: Development binaries
ii libc6-dev-i386 2.35-0ubuntu3.1 amd64 GNU C Library: 32-bit development libraries for AMD64
@ -101,7 +102,7 @@ ii libc6-x32 2.35-0ubuntu3.1 amd64
ii libc6:amd64 2.35-0ubuntu3.1 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.35-0ubuntu3.1 i386 GNU C Library: Shared libraries
ii libcap-ng0:amd64 0.7.9-2.2build3 amd64 An alternate POSIX capabilities library
ii libcap2:amd64 1:2.44-1build3 amd64 POSIX 1003.1e capabilities (library)
ii libcap2:amd64 1:2.44-1ubuntu0.22.04.1 amd64 POSIX 1003.1e capabilities (library)
ii libcc1-0:amd64 12.1.0-2ubuntu1~22.04 amd64 GCC cc1 plugin for GDB
ii libcom-err2:amd64 1.46.5-2ubuntu1.1 amd64 common error description library
ii libcrypt-dev:amd64 1:4.4.27-1 amd64 libcrypt development files
@ -127,7 +128,7 @@ ii libgcc-s1:i386 12.1.0-2ubuntu1~22.04 i386
ii libgcrypt20:amd64 1.9.4-3ubuntu3 amd64 LGPL Crypto library - runtime library
ii libgdbm-compat4:amd64 1.23-1 amd64 GNU dbm database routines (legacy support runtime version)
ii libgdbm6:amd64 1.23-1 amd64 GNU dbm database routines (runtime version)
ii libglib2.0-0:amd64 2.72.4-0ubuntu2 amd64 GLib library of C routines
ii libglib2.0-0:amd64 2.72.4-0ubuntu2.2 amd64 GLib library of C routines
ii libgmp10:amd64 2:6.2.1+dfsg-3ubuntu1 amd64 Multiprecision arithmetic library
ii libgnutls30:amd64 3.7.3-4ubuntu1.2 amd64 GNU TLS library - main runtime library
ii libgomp1:amd64 12.1.0-2ubuntu1~22.04 amd64 GCC OpenMP (GOMP) support library
@ -228,8 +229,8 @@ ii libunistring2:amd64 1.0-1 amd64
ii libutempter0:amd64 1.2.1-2build2 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libuuid1:amd64 2.37.2-4ubuntu3 amd64 Universally Unique ID library
ii libuv1:amd64 1.43.0-1 amd64 asynchronous event notification library - runtime library
ii libx11-6:amd64 2:1.7.5-1 amd64 X11 client-side library
ii libx11-data 2:1.7.5-1 all X11 client-side library
ii libx11-6:amd64 2:1.7.5-1ubuntu0.2 amd64 X11 client-side library
ii libx11-data 2:1.7.5-1ubuntu0.2 all X11 client-side library
ii libx32asan6 11.3.0-1ubuntu1~22.04.1 amd64 AddressSanitizer -- a fast memory error detector (x32)
ii libx32atomic1 12.1.0-2ubuntu1~22.04 amd64 support library providing __atomic built-in functions (x32)
ii libx32gcc-11-dev 11.3.0-1ubuntu1~22.04.1 amd64 GCC support library (x32 development files)
@ -248,7 +249,7 @@ ii libxxhash0:amd64 0.8.1-1 amd64
ii libyaml-0-2:amd64 0.2.2-1build2 amd64 Fast YAML 1.1 parser and emitter library
ii libzstd-dev:amd64 1.4.8+dfsg-3build1 amd64 fast lossless compression algorithm -- development files
ii libzstd1:amd64 1.4.8+dfsg-3build1 amd64 fast lossless compression algorithm
ii linux-libc-dev:amd64 5.15.0-73.80 amd64 Linux Kernel Headers for development
ii linux-libc-dev:amd64 5.15.0-75.82 amd64 Linux Kernel Headers for development
ii login 1:4.8.1-2ubuntu2.1 amd64 system login tools
ii logsave 1.46.5-2ubuntu1.1 amd64 save the output of a command in a log file
ii lsb-base 11.1.0ubuntu4 all Linux Standard Base init script functionality
@ -291,7 +292,7 @@ ii rsync 3.2.7-0ubuntu0.22.04.2 amd64
ii screen 4.9.0-1 amd64 terminal multiplexer with VT100/ANSI terminal emulation
ii sed 4.8-1ubuntu2 amd64 GNU stream editor for filtering/transforming text
ii sensible-utils 0.0.17 all Utilities for sensible alternative selection
ii sysstat 12.5.2-2ubuntu0.1 amd64 system performance tools for Linux
ii sysstat 12.5.2-2ubuntu0.2 amd64 system performance tools for Linux
ii sysvinit-utils 3.01-1ubuntu1 amd64 System-V-like utilities
ii tar 1.34+dfsg-1ubuntu0.1.22.04.1 amd64 GNU version of the tar archiving utility
ii ubuntu-keyring 2021.03.26 all GnuPG keys of the Ubuntu archive
@ -300,11 +301,11 @@ ii universal-ctags 5.9.20210829.0-1 amd64
ii unzip 6.0-26ubuntu3.1 amd64 De-archiver for .zip files
ii usrmerge 25ubuntu2 all Convert the system to the merged /usr directories scheme
ii util-linux 2.37.2-4ubuntu3 amd64 miscellaneous system utilities
ii vim 2:8.2.3995-1ubuntu2.7 amd64 Vi IMproved - enhanced vi editor
ii vim-common 2:8.2.3995-1ubuntu2.7 all Vi IMproved - Common files
ii vim-runtime 2:8.2.3995-1ubuntu2.7 all Vi IMproved - Runtime files
ii vim 2:8.2.3995-1ubuntu2.8 amd64 Vi IMproved - enhanced vi editor
ii vim-common 2:8.2.3995-1ubuntu2.8 all Vi IMproved - Common files
ii vim-runtime 2:8.2.3995-1ubuntu2.8 all Vi IMproved - Runtime files
ii wget 1.21.2-2ubuntu1 amd64 retrieves files from the web
ii xxd 2:8.2.3995-1ubuntu2.7 amd64 tool to make (or reverse) a hex dump
ii xxd 2:8.2.3995-1ubuntu2.8 amd64 tool to make (or reverse) a hex dump
ii xz-utils 5.2.5-2ubuntu1 amd64 XZ-format compression utilities
ii zip 3.0-12build2 amd64 Archiver for .zip files
ii zlib1g-dev:amd64 1:1.2.11.dfsg-2ubuntu9.2 amd64 compression library - development
@ -316,3 +317,319 @@ ii zstd 1.4.8+dfsg-3build1 amd64
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
Packages sorted by Installed-Size:
741791 ===== TOTAL (313 packages)
52577 gcc-11 amd64
34444 libicu70 amd64
32780 vim-runtime all
28795 g++-11 amd64
28441 libperl5.34 amd64
26212 cpp-11 amd64
20742 cmake amd64
18721 libstdc++-11-dev amd64
18468 git amd64
17671 perl-modules-5.34 all
15293 zsh-common all
13894 libgcc-11-dev amd64
13592 libc6 amd64
13037 libc6-dev amd64
12561 libc6-x32 amd64
12479 libc6 i386
12200 libc6-i386 amd64
11311 gdb amd64
10876 lib32stdc++-11-dev amd64
10439 binutils-x86-64-linux-gnu amd64
10391 libx32stdc++-11-dev amd64
9866 cmake-data all
8248 libc6-dev-x32 amd64
8040 libpython3.10-stdlib amd64
7947 lib32gcc-11-dev amd64
7730 perl-base amd64
7518 libasan6 amd64
7261 libc6-dev-i386 amd64
7255 libtsan0 amd64
7127 libmagic-mgc amd64
7112 coreutils amd64
6988 libx32gcc-11-dev amd64
6734 linux-libc-dev amd64
6733 dpkg amd64
6659 lib32asan6 amd64
6570 libx32asan6 amd64
5902 python3.10-minimal amd64
5824 libssl3 amd64
5780 libpython3.10 amd64
5093 libpython3.10-minimal amd64
4249 ncurses-term all
4156 apt amd64
4147 ripgrep amd64
4082 libglib2.0-0 amd64
3923 vim amd64
3643 python2.7-minimal amd64
3506 re2c amd64
3487 gojq amd64
3405 libmpfr6 amd64
3399 util-linux amd64
3347 libaria2-0 amd64
3181 libapt-pkg6.0 amd64
3013 libboost-regex1.74.0 amd64
2961 liblsan0 amd64
2943 parallel all
2801 elfutils amd64
2784 libpython2.7-minimal amd64
2776 libbinutils amd64
2746 libstdc++6 amd64
2675 libubsan1 amd64
2662 lib32stdc++6 amd64
2537 libc-bin amd64
2518 libx32ubsan1 amd64
2510 fd-find amd64
2500 lib32ubsan1 amd64
2468 zsh amd64
2438 libx32stdc++6 amd64
2428 fzf amd64
2396 7zip amd64
2325 passwd amd64
2284 libgnutls30 amd64
2191 ht amd64
2159 libisl23 amd64
2097 libxml2 amd64
2053 openssl amd64
2009 universal-ctags amd64
1959 git-man all
1864 bash amd64
1854 aria2 amd64
1750 libdb5.3 amd64
1746 libunistring2 amd64
1655 zstd amd64
1602 libsqlite3-0 amd64
1516 e2fsprogs amd64
1472 sysstat amd64
1464 bash-completion all
1445 hyperfine amd64
1429 libx11-data all
1388 procps amd64
1386 libx11-6 amd64
1354 libgcrypt20 amd64
1328 libzstd-dev amd64
1292 libp11-kit0 amd64
1138 libpam-modules amd64
1052 libkrb5-3 amd64
1005 screen amd64
995 libsystemd0 amd64
990 p7zip amd64
984 wget amd64
960 tar amd64
888 login amd64
876 libarchive13 amd64
846 libzstd1 amd64
794 rsync amd64
787 libcurl4 amd64
784 libbrotli1 amd64
771 libcurl3-gnutls amd64
735 libsepol2 amd64
729 libdw1 amd64
720 libtirpc-dev amd64
717 perl amd64
686 lib32quadmath0 amd64
683 libpcre3 amd64
646 ncurses-bin amd64
621 libpcre2-8-0 amd64
620 python3.10 amd64
620 findutils amd64
615 libonig5 amd64
610 libsource-highlight4v5 amd64
608 adduser all
592 zlib1g-dev amd64
574 libext2fs2 amd64
565 libldap-2.5-0 amd64
558 libtinfo6 amd64
544 libtinfo5 amd64
544 libgmp10 amd64
531 zip amd64
512 debconf all
504 binutils-common amd64
502 libbabeltrace1 amd64
496 grep amd64
486 libssh-4 amd64
461 libreadline8 amd64
455 libgssapi-krb5-2 amd64
443 curl amd64
433 libexpat1 amd64
424 diffutils amd64
422 libncursesw6 amd64
416 make amd64
402 libsodium23 amd64
394 base-files amd64
393 ncurses-base all
390 ca-certificates all
389 mount amd64
382 libmount1 amd64
379 vim-common all
376 unzip amd64
372 xz-utils amd64
368 libssh2-1 amd64
356 libnettle8 amd64
350 ninja-build amd64
347 libudev1 amd64
347 libnsl-dev amd64
347 libjq1 amd64
336 libhogweed6 amd64
334 lib32gomp1 amd64
334 htop amd64
334 bsdutils amd64
329 libncurses6 amd64
328 sed amd64
324 gpgv amd64
324 cpio amd64
323 libblkid1 amd64
321 less amd64
320 libgomp1 amd64
320 libcrypt-dev amd64
318 libncurses5 amd64
312 libpam-runtime all
312 libctf-nobfd0 amd64
307 libsource-highlight-common all
306 libx32gomp1 amd64
300 libsemanage2 amd64
298 libc-dev-bin amd64
296 libquadmath0 amd64
292 libk5crypto3 amd64
291 libx32quadmath0 amd64
290 pax-utils amd64
290 liblzma5 amd64
277 xxd amd64
271 gcc-11-base amd64
266 gcc-12-base i386
266 gcc-12-base amd64
252 libuv1 amd64
252 libipc-run-perl all
252 libcrypt1 i386
250 libmpdec3 amd64
248 libpam-modules-bin amd64
245 rpcsvc-proto amd64
243 debianutils amd64
243 base-passwd amd64
240 moreutils amd64
240 gzip amd64
239 libctf0 amd64
235 libpam0g amd64
235 libjsoncpp25 amd64
232 ucf all
230 lz4 amd64
229 patch amd64
229 mawk amd64
228 libmagic1 amd64
225 libcrypt1 amd64
221 bfs amd64
220 libidn2-0 amd64
219 libtirpc3 amd64
219 librhash0 amd64
214 dash amd64
209 libsmartcols1 amd64
207 libselinux1 amd64
206 libxcb1 amd64
203 libnghttp2-14 amd64
200 usrmerge all
192 libelf1 amd64
189 libgpg-error0 amd64
182 patchelf amd64
180 libnl-3-200 amd64
171 zlib1g i386
170 libsasl2-2 amd64
167 libgcc-s1 i386
164 zlib1g amd64
164 libkrb5support0 amd64
163 lib32gcc-s1 amd64
161 lzip amd64
159 lzop amd64
159 liblzo2-2 amd64
156 libaudit1 amd64
145 libseccomp2 amd64
145 liblz4-1 amd64
144 libyaml-0-2 amd64
144 libcc1-0 amd64
141 librtmp1 amd64
140 libgcc-s1 amd64
136 libbsd0 amd64
135 libx32gcc-s1 amd64
134 libuuid1 amd64
133 libtasn1-6 amd64
133 init-system-helpers all
132 libipt2 amd64
131 libprocps8 amd64
125 libmpc3 amd64
123 libtimedate-perl all
123 libnsl2 amd64
122 python3-minimal amd64
120 libpopt0 amd64
115 libitm1 amd64
114 bzip2 amd64
113 libss2 amd64
113 lib32itm1 amd64
112 libc-ares2 amd64
112 binutils amd64
110 libio-pty-perl amd64
105 python2-minimal amd64
105 libx32itm1 amd64
101 libcom-err2 amd64
100 libgdbm6 amd64
100 libbz2-1.0 amd64
100 jq amd64
97 media-types all
97 logsave amd64
97 libxxhash0 amd64
96 libsensors5 amd64
96 libmspack0 amd64
95 libpsl5 amd64
93 libsasl2-modules-db amd64
91 libjansson4 amd64
90 python3 amd64
83 sysvinit-utils amd64
83 file amd64
82 cabextract amd64
80 readline-common all
79 libdebconfclient0 amd64
74 libasm1 amd64
71 libmd0 amd64
71 liberror-perl all
69 libffi8 amd64
67 libacl1 amd64
67 cpp amd64
66 lsb-release all
65 libgpm2 amd64
65 libdebuginfod1 amd64
65 libcap2 amd64
62 emacsen-common all
61 libnl-genl-3-200 amd64
59 sensible-utils all
58 lsb-base all
57 libattr1 amd64
51 libutempter0 amd64
51 hostname amd64
50 gcc amd64
47 libkeyutils1 amd64
45 libgdbm-compat4 amd64
45 libcap-ng0 amd64
45 libatomic1 amd64
43 libxdmcp6 amd64
43 libx32atomic1 amd64
42 libsensors-config all
41 ubuntu-keyring all
41 libdebuginfod-common all
39 libpython3-stdlib amd64
39 lib32atomic1 amd64
37 libsemanage-common all
37 chrpath amd64
35 libxau6 amd64
35 libtime-duration-perl all
32 libtirpc-common all
30 paxctl amd64
27 dh-elpa-helper all
23 libaudit-common all
20 distro-info-data all
16 g++ amd64
8 gcc-multilib amd64
6 gcc-11-multilib amd64
6 g++-multilib amd64
6 g++-11-multilib amd64

View File

@ -32,6 +32,16 @@
// NE - Native Endianness (aka host endianness)
// TE - Target Endianness (not used here, see various packers)
#if 1
// some platforms may provide their own system bswapXX() functions, so rename
#undef bswap16
#undef bswap32
#undef bswap64
#define bswap16 upx_bswap16
#define bswap32 upx_bswap32
#define bswap64 upx_bswap64
#endif
/*************************************************************************
// core - NE
**************************************************************************/

View File

@ -325,9 +325,9 @@ void PackDjgpp2::pack(OutputFile *fo) {
OutputFile::dump(opt->debug.dump_stub_loader, loader, lsize);
fo->write(obuf, data->size);
#if 0
printf("%-13s: coff hdr : %8ld bytes\n", getName(), (long) sizeof(coff_hdr));
printf("%-13s: loader : %8ld bytes\n", getName(), (long) lsize);
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) data->size);
printf("%-13s: coff hdr : %8d bytes\n", getName(), (int) sizeof(coff_hdr));
printf("%-13s: loader : %8d bytes\n", getName(), (int) lsize);
printf("%-13s: compressed : %8d bytes\n", getName(), (int) data->size);
#endif
// verify

View File

@ -579,22 +579,33 @@ void PackPs1::pack(OutputFile *fo) {
throwNotCompressible();
#if 0
printf("%-13s: uncompressed : %8ld bytes\n", getName(), (long) ph.u_len);
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) ph.c_len);
printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) lsize - h_len - pad_code);
printf("%-13s: header comp : %8ld bytes\n", getName(), (long) sz_cbh);
printf("%-13s: overlap : %8ld bytes\n", getName(), (long) overlap);
printf("%-13s: load address : %08X bytes\n", getName(), (unsigned int) oh.tx_ptr);
printf("%-13s: code entry : %08X bytes\n", getName(), (unsigned int) oh.epc);
printf("%-13s: bbs start : %08X bytes\n", getName(), (unsigned int) bss_start);
printf("%-13s: bbs end : %08X bytes\n", getName(), (unsigned int) bss_end);
printf("%-13s: eof in mem IF : %08X bytes\n", getName(), (unsigned int) ih.tx_ptr + ih.tx_len);
printf("%-13s: eof in mem OF : %08X bytes\n", getName(), (unsigned int) oh.tx_ptr + oh.tx_len);
printf("%-13s: uncompressed : %8d bytes\n", getName(), (int) ph.u_len);
printf("%-13s: compressed : %8d bytes\n", getName(), (int) ph.c_len);
printf("%-13s: decompressor : %8d bytes\n", getName(), (int) lsize - h_len - pad_code);
printf("%-13s: header comp : %8d bytes\n", getName(), (int) sz_cbh);
printf("%-13s: overlap : %8d bytes\n", getName(), (int) overlap);
printf("%-13s: load address : %08X bytes\n", getName(), (unsigned) oh.tx_ptr);
printf("%-13s: code entry : %08X bytes\n", getName(), (unsigned) oh.epc);
printf("%-13s: bbs start : %08X bytes\n", getName(), (unsigned) bss_start);
printf("%-13s: bbs end : %08X bytes\n", getName(), (unsigned) bss_end);
printf("%-13s: eof in mem IF : %08X bytes\n", getName(), (unsigned) ih.tx_ptr + ih.tx_len);
printf("%-13s: eof in mem OF : %08X bytes\n", getName(), (unsigned) oh.tx_ptr + oh.tx_len);
byte i = 0;
if (isCon) { if (foundBss) i = 1; }
else { i = 2; if (M_IS_LZMA(ph.method)) { if (!foundBss) i = 3; else i = 4; } }
const char *loader_method[] = { "con/stack", "con/bss", "cdb", "cdb/stack", "cdb/bss" };
char method_name[32+1]; set_method_name(method_name, sizeof(method_name), ph.method, ph.level);
if (isCon) {
if (foundBss)
i = 1;
} else {
i = 2;
if (M_IS_LZMA(ph.method)) {
if (!foundBss)
i = 3;
else
i = 4;
}
}
const char *loader_method[] = {"con/stack", "con/bss", "cdb", "cdb/stack", "cdb/bss"};
char method_name[32 + 1];
set_method_name(method_name, sizeof(method_name), ph.method, ph.level);
printf("%-13s: methods : %s, %s\n", getName(), method_name, loader_method[i]);
#endif
}

View File

@ -99,7 +99,7 @@ protected:
unsigned clear_dirty_stack_len;
unsigned copy_to_stack_len;
void reset() noexcept { memset(this, 0, sizeof(*this)); }
void reset() noexcept { mem_clear(this); }
};
LinkerSymbols symbols;
};

View File

@ -551,18 +551,16 @@ void PeFile64::processRelocs() // pass1
// deliberately corrupt. Sometimes it is even tuned to cause us trouble!
// Use an extra check to avoid AccessViolation (SIGSEGV) when appending
// the relocs into one array.
if ((4 * relocnum + 8192) < (sorelocs + 4*(2 + xcounts[2] + xcounts[1])))
if ((4 * relocnum + 8192) < (sorelocs + 4 * (2 + xcounts[2] + xcounts[1])))
throwCantUnpack("Invalid relocs");
// append relocs type "LOW" then "HIGH"
for (ic = 2; ic ; ic--)
{
memcpy(orelocs + sorelocs,fix[ic],4 * xcounts[ic]);
for (ic = 2; ic; ic--) {
memcpy(orelocs + sorelocs, fix[ic], 4 * xcounts[ic]);
sorelocs += 4 * xcounts[ic];
set_le32(orelocs + sorelocs,0);
if (xcounts[ic])
{
set_le32(orelocs + sorelocs, 0);
if (xcounts[ic]) {
sorelocs += 4;
big_relocs |= 2 * ic;
}
@ -1933,8 +1931,8 @@ unsigned PeFile::virta2objnum(unsigned addr, SPAN_0(pe_section_t) sect, unsigned
unsigned PeFile::tryremove(unsigned vaddr, unsigned objs) {
unsigned ic = virta2objnum(vaddr, isection, objs);
if (ic && ic == objs - 1) {
NO_fprintf(stderr, "removed section: %d size: %lx\n", ic, (long) isection[ic].size);
info("removed section: %d size: 0x%lx", ic, (long) isection[ic].size);
NO_fprintf(stderr, "removed section: %d size: 0x%x\n", ic, (int) isection[ic].size);
info("removed section: %d size: 0x%x", ic, (int) isection[ic].size);
objs--;
}
return objs;
@ -2322,6 +2320,7 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
const unsigned oobjs = last_section_rsrc_only ? 4 : has_ncsection ? 3 : 2;
////pe_section_t osection[oobjs];
pe_section_t osection[4];
memset(osection, 0, sizeof(osection));
// section 0 : bss
// 1 : [ident + header] + packed_data + unpacker + tls + loadconf
// 2 : not compressed data
@ -2361,7 +2360,6 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
// new PE header
memcpy(&oh, &ih, sizeof(oh));
oh.filealign = oh_filealign; // identsplit depends on this
memset(osection, 0, sizeof(osection));
oh.entry = upxsection;
oh.objects = oobjs;
@ -2449,7 +2447,6 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
// too idiot to use the data directories... M$ suxx 4 ever!
// ... even worse: exploder.exe in NiceTry also depends on this to
// locate version info
strcpy(osection[2].name, !last_section_rsrc_only && soresources ? ".rsrc" : "UPX2");
osection[0].vaddr = rvamin;
@ -2556,18 +2553,18 @@ void PeFile::pack0(OutputFile *fo, ht &ih, ht &oh, unsigned subsystem_mask,
}
#if 0
printf("%-13s: program hdr : %8ld bytes\n", getName(), (long) sizeof(oh));
printf("%-13s: sections : %8ld bytes\n", getName(), (long) sizeof(osection[0])*oobjs);
printf("%-13s: ident : %8ld bytes\n", getName(), (long) identsize);
printf("%-13s: compressed : %8ld bytes\n", getName(), (long) c_len);
printf("%-13s: decompressor : %8ld bytes\n", getName(), (long) codesize);
printf("%-13s: tls : %8ld bytes\n", getName(), (long) sotls);
printf("%-13s: aligned_tls : %8ld bytes\n", getName(), (long) aligned_sotls);
printf("%-13s: resources : %8ld bytes\n", getName(), (long) soresources);
printf("%-13s: imports : %8ld bytes\n", getName(), (long) soimpdlls);
printf("%-13s: exports : %8ld bytes\n", getName(), (long) soexport);
printf("%-13s: relocs : %8ld bytes\n", getName(), (long) soxrelocs);
printf("%-13s: loadconf : %8ld bytes\n", getName(), (long) soloadconf);
printf("%-13s: program hdr : %8d bytes\n", getName(), (int) sizeof(oh));
printf("%-13s: sections : %8d bytes\n", getName(), (int) sizeof(osection[0]) * oobjs);
printf("%-13s: ident : %8d bytes\n", getName(), (int) identsize);
printf("%-13s: compressed : %8d bytes\n", getName(), (int) c_len);
printf("%-13s: decompressor : %8d bytes\n", getName(), (int) codesize);
printf("%-13s: tls : %8d bytes\n", getName(), (int) sotls);
printf("%-13s: aligned_tls : %8d bytes\n", getName(), (int) aligned_sotls);
printf("%-13s: resources : %8d bytes\n", getName(), (int) soresources);
printf("%-13s: imports : %8d bytes\n", getName(), (int) soimpdlls);
printf("%-13s: exports : %8d bytes\n", getName(), (int) soexport);
printf("%-13s: relocs : %8d bytes\n", getName(), (int) soxrelocs);
printf("%-13s: loadconf : %8d bytes\n", getName(), (int) soloadconf);
#endif
// verify

View File

@ -179,8 +179,14 @@ private:
struct Stats {
upx_std_atomic(upx_uint32_t) global_alloc_counter;
upx_std_atomic(upx_uint32_t) global_dealloc_counter;
#if WITH_THREADS
// avoid link errors on some 32-bit platforms: undefined reference to __atomic_fetch_add_8
upx_std_atomic(size_t) global_total_bytes; // stats may overflow on 32-bit systems
upx_std_atomic(size_t) global_total_active_bytes;
#else
upx_std_atomic(upx_uint64_t) global_total_bytes;
upx_std_atomic(upx_uint64_t) global_total_active_bytes;
#endif
};
static Stats stats;
#if DEBUG