Compare commits

..

56 Commits

Author SHA1 Message Date
John Reiser 65b3dd7e52 risc-v 64-bit stubs build successfully in developer environment
This is the "bottom half" to add support for riscv64 to UPX.
Need update to stubtools for: gcc objcopy objdump ld
   Now using local cross tools /usr/bin/riscv64-linux-gnu-* on Ubuntu 24.04.
Need fix for riscv64-linux.elf-fold.h being 224 KB.
TODO: extend p_lx_elf.cpp  linker.cpp
TODO: implement nrv2d_d.S nrv2e_d.S lzma_d.S
TODO: testing  (using qemu-riscv64 and gdb-multiarch on Ubuntu 24.04)

        https://github.com/upx/upx/discussions/793

	modified:   src/stub/Makefile
	modified:   src/stub/scripts/xstrip.py
	modified:   src/stub/src/amd64-linux.elf-main2.c
	modified:   src/stub/src/arch/amd64/macros.S
	new file:   src/stub/src/arch/riscv/64/Makefile
	new file:   src/stub/src/arch/riscv/64/Makefile.extra
	new file:   src/stub/src/arch/riscv/64/macros.S
	new file:   src/stub/src/arch/riscv/64/nrv2b_d.S
	new file:   src/stub/src/arch/riscv/64/regs.h
	new file:   src/stub/src/riscv64-expand.S
	new file:   src/stub/src/riscv64-linux.elf-entry.S
	new file:   src/stub/src/riscv64-linux.elf-fold.S
	new file:   src/stub/src/riscv64-linux.elf-fold.lds
	new file:   src/stub/src/riscv64-linux.elf-help_umf.S
	new file:   src/stub/src/riscv64-linux.elf-main2.c
	modified:   src/stub/src/upxfd_linux.c
2025-11-01 08:59:05 -07:00
Markus F.X.J. Oberhumer b11f043d64 CI updates 2025-09-10 11:11:51 +02:00
John Reiser aef93548f9 Fix memfd_create in shared libraries on amd64 Linux < kernel 6.3
https://github.com/upx/upx/issues/929
	modified:   stub/src/amd64-linux.elf-so_fold.S
           plus generated .h .dump
2025-09-09 14:58:00 -07:00
John Reiser 26ca21f6cb arm.v4a: cancel_sigsegv
modified:   misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   src/stub/src/arm.v4a-linux.elf-entry.S
	modified:   src/stub/src/arm.v4a-linux.elf-fold.S
           plus generated .h .dump .map
2025-08-21 06:19:21 -07:00
Markus F.X.J. Oberhumer 404fb48668 CI updates 2025-08-21 00:21:15 +02:00
John Reiser e85e8bec5d New option --catch-sigsegv on amd64, arm64, arm.v4a
Catch SIGSEGV during de-compression, and print state info
("auto debug") using /proc/self/maps and gdb.
This was motivated by suspicion of unreliable hardware
which triggered "Heisenbugs": a crash which cannot be reproduced.
If SIGSGV occurs without the "auto debug" info, then that
implies an error user code after de-compression, often when
user code accesses /proc/self/exe, which is not the un-compressed file.
	modified:   misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   src/help.cpp
	modified:   src/main.cpp
	modified:   src/options.h
	modified:   src/p_lx_elf.cpp
	modified:   src/stub/Makefile
	modified:   src/stub/src/amd64-linux.elf-entry.S
	modified:   src/stub/src/amd64-linux.elf-fold.S
	modified:   src/stub/src/arm.v4a-linux.elf-entry.S
	modified:   src/stub/src/arm.v4a-linux.elf-fold.S
	modified:   src/stub/src/arm64-linux.elf-entry.S
	modified:   src/stub/src/arm64-linux.elf-fold.S
           plus generated .h .dump .map
2025-08-19 12:25:33 -07:00
John Reiser 4530e5c264 Fix upxfd_create for stubs on PowerPC64
https://github.com/upx/upx/issues/925
	modified:   misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   src/stub/src/powerpc64-linux.elf-fold.S
           plus generated .h
2025-08-16 16:00:11 -07:00
Markus F.X.J. Oberhumer 1188d2933b SIGSEGV: handle and pretty-print on arm64-linux 2025-08-10 09:55:12 +02:00
Markus F.X.J. Oberhumer 4e88556c94 SIGSEGV: handle and pretty-print on amd64-linux 2025-08-10 09:39:29 +02:00
Markus F.X.J. Oberhumer 1f0036a460 CI updates 2025-08-10 09:05:14 +02:00
Markus F.X.J. Oberhumer 5d30472ee2 CI updates 2025-08-04 16:05:44 +02:00
Markus F.X.J. Oberhumer 9866b9bca9 SIGSEGV: handle and pretty-print on amd64-linux 2025-08-01 00:49:27 +02:00
Markus F.X.J. Oberhumer bbf52cee67 CI updates 2025-07-30 23:09:28 +02:00
Markus F.X.J. Oberhumer b9b77965b7 CI updates 2025-07-30 01:40:30 +02:00
Markus F.X.J. Oberhumer 852666010e CI updates 2025-07-29 19:50:17 +02:00
John Reiser bbb886ae4d gcc 14.2.1-3 lax on signed-vs-unsigned compare
modified:   p_lx_elf.cpp
2025-07-25 07:14:33 -07:00
John Reiser b52d3e0772 Detect DT_HASH chain out-of-bounds
https://issues.oss-fuzz.com/u/1/issues/430110068
	modified:   p_lx_elf.cpp
2025-07-24 11:09:58 -07:00
Markus F.X.J. Oberhumer 27f8f4f62e CI updates 2025-07-25 18:20:14 +02:00
Markus F.X.J. Oberhumer 21ec7e7410 CI updates 2025-07-25 10:03:28 +02:00
Markus F.X.J. Oberhumer ae6d5303ba CI updates 2025-07-25 03:07:51 +02:00
Markus F.X.J. Oberhumer fbbc2bc874 CI updates 2025-07-23 14:33:29 +02:00
Markus F.X.J. Oberhumer 62f22d61e6 CI updates 2025-07-23 11:00:41 +02:00
Markus F.X.J. Oberhumer 3f1f76f8a3 CI updates 2025-07-21 15:57:03 +02:00
Markus F.X.J. Oberhumer 518712c613 CI updates 2025-07-21 12:26:30 +02:00
Markus F.X.J. Oberhumer c0c08c9f43 all: post-release version bump 2025-07-20 15:59:04 +02:00
Markus F.X.J. Oberhumer c4113b6bd6 all: prepare for release 2025-07-20 14:41:25 +02:00
Markus F.X.J. Oberhumer 4988868e61 CI updates 2025-07-20 13:58:38 +02:00
Markus F.X.J. Oberhumer 5a513ab16f CI updates 2025-07-20 12:21:56 +02:00
Markus F.X.J. Oberhumer f1a9d1bec9 CI updates 2025-07-20 00:38:43 +02:00
Markus F.X.J. Oberhumer 70a3acfded CI updates 2025-07-18 20:17:11 +02:00
Markus F.X.J. Oberhumer 3ec6a3cce0 CI updates 2025-07-18 12:42:37 +02:00
Markus F.X.J. Oberhumer dd0a8856cc CI updates 2025-07-18 11:44:36 +02:00
Markus F.X.J. Oberhumer c51a1130b8 CI updates 2025-07-17 20:47:19 +02:00
Markus F.X.J. Oberhumer 9851fba246 CI updates 2025-07-17 15:46:12 +02:00
Markus F.X.J. Oberhumer 8054543671 CI updates 2025-07-15 10:55:39 +02:00
Markus F.X.J. Oberhumer 17d0e897ba CI updates 2025-07-15 09:56:46 +02:00
Markus F.X.J. Oberhumer a7940fd19b CI updates 2025-07-07 18:01:00 +02:00
John Reiser 1fbd34035e shell trap on ERR to help locate failing commands
modified:   misc/testsuite/mimic_ctest.sh
2025-07-06 19:21:26 -07:00
John Reiser 945d9157fa PowerPC64 editing error affecting -fPIE
https://github.com/upx/upx/issues/918
	modified:   ../misc/testsuite/upx_testsuite_1-expected_sha256sums.sh
	modified:   stub/src/powerpc64-linux.elf-fold.S
          plus generated powerpc64*-linux.elf-fold.h
2025-07-05 18:10:46 -07:00
Markus F.X.J. Oberhumer 915bfbd82e CI updates 2025-07-05 22:23:13 +02:00
Markus F.X.J. Oberhumer ef01a73e8f CI updates 2025-06-26 11:54:26 +02:00
Markus F.X.J. Oberhumer 7e4e6a3cb1 CI updates 2025-06-26 11:30:46 +02:00
Markus F.X.J. Oberhumer ca97430db2 CI updates 2025-06-06 12:25:13 +02:00
Markus F.X.J. Oberhumer 7530643d1d CI updates 2025-06-01 14:55:43 +02:00
Markus F.X.J. Oberhumer 073cdb0d58 CI updates 2025-06-01 14:11:05 +02:00
Markus F.X.J. Oberhumer 9a93b5d1c1 CI updates 2025-05-31 15:44:22 +02:00
Markus F.X.J. Oberhumer 44ce469b84 CI updates 2025-05-31 13:54:04 +02:00
Markus F.X.J. Oberhumer 4d8d330f21 CI updates 2025-05-30 18:31:56 +02:00
Markus F.X.J. Oberhumer 793e1622ea CI updates 2025-05-29 12:04:43 +02:00
Markus F.X.J. Oberhumer 92a33fa0cc CI updates 2025-05-25 10:12:35 +02:00
John Reiser e8c49a2c35 Prevent SIGSEGV on de-compress of modified PE file
https://github.com/upx/upx/issues/863
	modified:   pefile.cpp
2025-05-13 10:51:59 -07:00
Markus F.X.J. Oberhumer d2e9db7112 CI updates 2025-05-10 13:55:49 +02:00
John Reiser b728b0e021 buildLinuxLoader needs more space
for shlib + lzma + Android
https://github.com/upx/upx/issues/913
	modified:   p_lx_elf.cpp
2025-05-07 13:52:58 -07:00
John Reiser a1ef410509 ELF DT_DYNSYM: fix checking of symbol table
Particularly JNI_OnLoad
https://github.com/upx/upx/issues/914
	modified:   p_lx_elf.cpp
2025-05-07 17:02:56 -07:00
Markus F.X.J. Oberhumer 24b4ec42e7 CI updates 2025-05-07 19:11:57 +02:00
Markus F.X.J. Oberhumer 52dde5789e all: post-release version bump 2025-05-06 14:01:35 +02:00
90 changed files with 19166 additions and 16261 deletions
+171 -63
View File
@@ -8,6 +8,8 @@ name: CI
on: [push, workflow_dispatch] on: [push, workflow_dispatch]
defaults: { run: { shell: bash } }
env: env:
CMAKE_REQUIRED_QUIET: 'OFF' CMAKE_REQUIRED_QUIET: 'OFF'
CMAKE_VERBOSE_MAKEFILE: 'ON' CMAKE_VERBOSE_MAKEFILE: 'ON'
@@ -19,9 +21,9 @@ env:
UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: 'ON' UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: 'ON'
UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1 UPX_DEBUG_TEST_FLOAT_DIVISION_BY_ZERO: 1
UPX_DEBUG_TEST_LIBC_QSORT: 1 UPX_DEBUG_TEST_LIBC_QSORT: 1
ZSTD_CLEVEL: 9 ZSTD_CLEVEL: 17
# 2025-03-05 # 2025-08-19
ZIG_DIST_VERSION: 0.14.0 ZIG_DIST_VERSION: 0.15.1
jobs: jobs:
job-rebuild-and-verify-stubs: job-rebuild-and-verify-stubs:
@@ -61,7 +63,7 @@ jobs:
run: | run: |
export PATH="$(readlink -en ../deps/bin-upx-20221212):$PATH" export PATH="$(readlink -en ../deps/bin-upx-20221212):$PATH"
make -C src/stub maintainer-clean extra-clean make -C src/stub maintainer-clean extra-clean
git status || true git status || true # make sure the stub files got deleted
make -C src/stub extra-all all make -C src/stub extra-all all
if ! git diff --quiet; then git diff; exit 1; fi if ! git diff --quiet; then git diff; exit 1; fi
- run: bash ./misc/scripts/check_whitespace_git.sh - run: bash ./misc/scripts/check_whitespace_git.sh
@@ -74,6 +76,72 @@ jobs:
run: | run: |
make -C doc clean all make -C doc clean all
if ! git diff --quiet; then git diff || true; fi # ignore diff error if ! git diff --quiet; then git diff || true; fi # ignore diff error
- name: Clean up
run: |
git ls-files -z --others --ignored --exclude-standard ./src/stub | xargs -0r rm -v --
find ./src/stub/src -type d -name tmp -print0 | xargs -0r rmdir -v --
- run: git status --ignored || true
job-linux-cmake-0: # uses cmake + make
if: true
needs: [ job-rebuild-and-verify-stubs ]
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-22.04 }
- { os: ubuntu-24.04 }
- { os: ubuntu-22.04-arm }
- { os: ubuntu-24.04-arm }
name: ${{ format('{0}', matrix.os) }}-0
runs-on: ${{ matrix.os }}
steps:
- run: uname -a; pwd; id; umask
- run: sudo apt-get update
- run: sudo apt-get install -y dmidecode gdb parallel valgrind
- run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- run: sudo dmidecode -q || true
- run: sudo dmidecode || true
- uses: actions/checkout@v5
with: { submodules: true }
- run: make build/extra/gcc/all
- run: make build/extra/clang/all
- run: ls -l build/*/*/*/upx* || true
- run: file build/*/*/*/upx* || true
- name: Make artifact
run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}-0" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N"
(cd build && shopt -s nullglob && cp -ai --parents */upx{,.exe} */*/*/upx{,.exe} "../tmp/artifact/$N")
if command -v hardlink >/dev/null; then (cd "tmp/artifact/$N" && hardlink .) fi
(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst")
echo "artifact_name=$N" >> $GITHUB_ENV
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run install tests
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs"
DESTDIR="Install with make 2" parallel -kv --lb 'make build/extra/{}+install' ::: $jobs
- name: Mimic ctest tests SIGSEGV
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
- name: Run ctest tests
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
- name: Mimic ctest tests with Valgrind
run: |
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
# clang/debug does not work before valgrind-3.20, see https://bugs.kde.org/show_bug.cgi?id=452758
jobs="gcc/debug gcc/release clang/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
job-linux-cmake: # uses cmake + make job-linux-cmake: # uses cmake + make
if: true if: true
@@ -82,8 +150,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
# { os: ubuntu-20.04, use_extra: true } - { os: ubuntu-22.04, use_extra: true }
- { os: ubuntu-22.04, use_extra: true, use_wine: true }
- { os: ubuntu-24.04, use_extra: true, use_wine: true } - { os: ubuntu-24.04, use_extra: true, use_wine: true }
name: ${{ format('{0}', matrix.os) }} name: ${{ format('{0}', matrix.os) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -94,6 +161,7 @@ jobs:
run: | run: |
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
sudo apt-get update && sudo apt-get upgrade -y sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y dmidecode gdb libc6-dbg:i386 parallel valgrind
sudo apt-get install -y g++-multilib g++-mingw-w64-i686 g++-mingw-w64-x86-64 sudo apt-get install -y g++-multilib g++-mingw-w64-i686 g++-mingw-w64-x86-64
# make sure that we use posix-threads (pthread/winpthreads) and NOT win32-threads # make sure that we use posix-threads (pthread/winpthreads) and NOT win32-threads
for f in i686-w64-mingw32-g++ i686-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc; do for f in i686-w64-mingw32-g++ i686-w64-mingw32-gcc x86_64-w64-mingw32-g++ x86_64-w64-mingw32-gcc; do
@@ -101,14 +169,19 @@ jobs:
ls -l /usr/bin/${f}* ls -l /usr/bin/${f}*
done done
ls -l /etc/alternatives/*mingw* || true ls -l /etc/alternatives/*mingw* || true
sudo apt-get install -y libc6-dbg:i386 valgrind - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
if: ${{ matrix.use_extra }}
- run: sudo dmidecode -q || true
if: ${{ matrix.use_extra }}
- run: sudo dmidecode || true
if: ${{ matrix.use_extra }}
- name: Install Wine - name: Install Wine
if: ${{ matrix.use_extra && matrix.use_wine }} if: ${{ matrix.use_extra && matrix.use_wine }}
run: | run: |
sudo apt-get install -y wine wine32:i386 wine64 sudo apt-get install -y wine wine32:i386 wine64
ls -l /usr/bin/wine* ls -l /usr/bin/wine*
mkdir -p -v ~/.wine && wineboot --init mkdir -p -v ~/.wine && wineboot --init
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
@@ -128,6 +201,8 @@ jobs:
if: ${{ matrix.use_extra }} if: ${{ matrix.use_extra }}
- run: make build/extra/cross-windows-mingw64/all - run: make build/extra/cross-windows-mingw64/all
if: ${{ matrix.use_extra }} if: ${{ matrix.use_extra }}
- run: ls -l build/*/*/*/upx* || true
- run: file build/*/*/*/upx* || true
- name: Make artifact - name: Make artifact
run: | run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
@@ -153,6 +228,16 @@ jobs:
run: | run: |
(cd build/extra/gcc/release && DESTDIR="$PWD/Install with cmake" cmake --install .) (cd build/extra/gcc/release && DESTDIR="$PWD/Install with cmake" cmake --install .)
(cd build/extra/gcc/release && DESTDIR="$PWD/Install with make" make install) (cd build/extra/gcc/release && DESTDIR="$PWD/Install with make" make install)
jobs="gcc/debug gcc/release clang/debug clang/release"
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
DESTDIR="Install with make 2" parallel -kv --lb 'make build/extra/{}+install' ::: $jobs
- name: Mimic ctest tests SIGSEGV
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest_sigsegv.sh' ::: $jobs
- name: Run ctest tests - name: Run ctest tests
run: | run: |
jobs="gcc/debug gcc/release clang/debug clang/release" jobs="gcc/debug gcc/release clang/debug clang/release"
@@ -161,12 +246,6 @@ jobs:
command -v wine >/dev/null && jobs="$jobs cross-windows-mingw64/debug cross-windows-mingw64/release" command -v wine >/dev/null && jobs="$jobs cross-windows-mingw64/debug cross-windows-mingw64/release"
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs CTEST_JOBS=2 parallel -kv --lb 'make build/extra/{}+test' ::: $jobs
- name: Mimic ctest tests
run: |
jobs="gcc/debug gcc/release clang/debug clang/release"
test "${{ matrix.use_extra }}" = "true" && jobs="$jobs gcc-m32/debug gcc-m32/release"
echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/extra/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
- name: Mimic ctest tests with Valgrind - name: Mimic ctest tests with Valgrind
if: true # note: valgrind is SLOW if: true # note: valgrind is SLOW
run: | run: |
@@ -215,7 +294,8 @@ jobs:
# NOTE: macos does not have "env -C"; only with brew coreutils # NOTE: macos does not have "env -C"; only with brew coreutils
- { os: macos-13, gcc: gcc-12, gxx: g++-12, testsuite: true } - { os: macos-13, gcc: gcc-12, gxx: g++-12, testsuite: true }
- { os: macos-14, gcc: gcc-13, gxx: g++-13, testsuite: true } - { os: macos-14, gcc: gcc-13, gxx: g++-13, testsuite: true }
- { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true } # { os: macos-15, gcc: gcc-14, gxx: g++-14, testsuite: true }
- { os: macos-15, testsuite: true }
name: ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }} name: ${{ format('{0} {1}{2}', matrix.os, matrix.xcode_version && 'xcode-' || '', matrix.xcode_version) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
@@ -229,7 +309,7 @@ jobs:
test -z "$HOMEBREW_PREFIX" && HOMEBREW_PREFIX="$(brew --prefix)" test -z "$HOMEBREW_PREFIX" && HOMEBREW_PREFIX="$(brew --prefix)"
echo "HOMEBREW_PREFIX=$HOMEBREW_PREFIX" >> $GITHUB_ENV echo "HOMEBREW_PREFIX=$HOMEBREW_PREFIX" >> $GITHUB_ENV
# testsuite needs working "readlink -en" and "sha256sum -b" # testsuite needs working "readlink -en" and "sha256sum -b"
packages="ninja parallel util-linux" packages="parallel util-linux"
test -e "$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin/readlink" || packages="$packages coreutils" test -e "$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin/readlink" || packages="$packages coreutils"
if test -n "$packages"; then if test -n "$packages"; then
echo "===== brew leaves:"; brew leaves; echo "===== brew list:"; brew list --versions echo "===== brew leaves:"; brew leaves; echo "===== brew list:"; brew list --versions
@@ -242,7 +322,7 @@ jobs:
# TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now # TODO FIXME: UPX on macos-13+ is broken => disable run-packed for now
macos-1[345]) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;; macos-1[345]) echo "UPX_CONFIG_DISABLE_RUN_PACKED_TEST=ON" >> $GITHUB_ENV ;;
esac esac
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
if: ${{ matrix.testsuite }} if: ${{ matrix.testsuite }}
@@ -265,6 +345,8 @@ jobs:
run: | run: |
make UPX_XTARGET=xtarget/cross-darwin-arm64 xtarget/all \ make UPX_XTARGET=xtarget/cross-darwin-arm64 xtarget/all \
CC="clang -target arm64-apple-darwin" CXX="clang++ -target arm64-apple-darwin" CC="clang -target arm64-apple-darwin" CXX="clang++ -target arm64-apple-darwin"
- run: ls -l build/*/*/*/upx* || true
- run: file build/*/*/*/upx* || true
- name: Make artifact - name: Make artifact
run: | run: |
X="${{ matrix.xcode_version }}"; test -n "$X" && X="-xcode-$X" X="${{ matrix.xcode_version }}"; test -n "$X" && X="-xcode-$X"
@@ -328,24 +410,45 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, vsarch: amd64 } # { name: windows-2019-amd64, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 } - { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: windows-2022-arm64, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 }
# { name: windows-2022-arm64ec, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true }
- { name: windows-2022-i386, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
- { name: windows-2025-amd64, os: windows-2025, vsversion: 2022, vsarch: amd64 }
- { name: windows-2025-arm64, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 }
- { name: windows-2025-arm64ec, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, use_arm64ec: true }
- { name: windows-2025-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('{0}', matrix.name) }} name: ${{ format('{0}', matrix.name) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: { submodules: true } with: { submodules: true }
- name: Check out test suite - name: Check out test suite
run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
- uses: ilammy/msvc-dev-cmd@v1 - uses: ilammy/msvc-dev-cmd@v1
with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' } with: { vsversion: '${{ matrix.vsversion }}', arch: '${{ matrix.vsarch }}' }
- name: Set platform
run: |
if [[ "${{ matrix.vsarch }}" == amd64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A x64" >> $GITHUB_ENV
elif [[ "${{ matrix.use_arm64ec }}" == "true" ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64EC" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == amd64_arm64 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64" >> $GITHUB_ENV
echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV
elif [[ "${{ matrix.vsarch }}" == amd64_x86 ]]; then true;
echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A Win32" >> $GITHUB_ENV
fi
- run: make build/debug - run: make build/debug
- run: make build/release - run: make build/release
- run: shopt -s globstar; ls -ld build/**/upx* || true
- run: shopt -s globstar; file build/**/upx* || true
- name: Make artifact - name: Make artifact
shell: bash
run: | run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N" mkdir -p "tmp/artifact/$N"
DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/debug" cmake --install build/debug --config Debug DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/debug" cmake --install build/debug --config Debug
DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/release" cmake --install build/release --config Release DESTDIR="$PWD/tmp/artifact/$N/InstallWithCMake/InstallWithDestdir/release" cmake --install build/release --config Release
@@ -366,12 +469,16 @@ jobs:
run: | run: |
ctest --test-dir build/debug --parallel 8 -C Debug ctest --test-dir build/debug --parallel 8 -C Debug
ctest --test-dir build/release --parallel 8 -C Release ctest --test-dir build/release --parallel 8 -C Release
- name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: |
env -C build/debug/Debug upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
- name: Run test suite build/release - name: Run test suite build/release
if: ${{ matrix.vsarch != 'amd64_arm64' }} if: ${{ matrix.vsarch != 'amd64_arm64' }}
shell: bash
run: | run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)" export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
env -C build/release/Release bash "$PWD"/misc/testsuite/upx_testsuite_1.sh env -C build/release/Release upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh
job-windows-toolchains: # build "by hand" using cmd.exe job-windows-toolchains: # build "by hand" using cmd.exe
if: github.repository_owner == 'upx' if: github.repository_owner == 'upx'
@@ -380,13 +487,13 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64 } # { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64 }
- { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64 } - { name: amd64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64 }
- { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_arm64 } # { name: arm64-win64-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_arm64 }
- { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 } - { name: arm64-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64 }
- { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' } - { name: arm64ec-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' }
# { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' } # { name: arm64x-win64-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' }
- { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_x86 } # { name: i386-win32-vs2019, os: windows-2019, vsversion: 2019, vsarch: amd64_x86 }
- { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 } - { name: i386-win32-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 }
name: ${{ format('windows {0}', matrix.name) }} name: ${{ format('windows {0}', matrix.name) }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@@ -395,10 +502,9 @@ jobs:
B: release B: release
steps: steps:
- run: git config --global core.autocrlf false - run: git config --global core.autocrlf false
- uses: actions/checkout@v4 - uses: actions/checkout@v5
with: { submodules: true } with: { submodules: true }
- name: Prepare sources and Check out test suite - name: Prepare sources and Check out test suite
shell: bash
run: | run: |
git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite
mkdir -p -v build/$C/$B/{bzip2,ucl,upx,zlib,zstd} mkdir -p -v build/$C/$B/{bzip2,ucl,upx,zlib,zstd}
@@ -446,8 +552,9 @@ jobs:
@rem set UPX_LIBS=%BDIR%\bzip2\bzip2.lib %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib %BDIR%\zstd\zstd.lib @rem set UPX_LIBS=%BDIR%\bzip2\bzip2.lib %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib %BDIR%\zstd\zstd.lib
set sources=%s%\*.cpp %s%\check\*.cpp %s%\compress\*.cpp %s%\console\*.cpp %s%\filter\*.cpp %s%\util\*.cpp set sources=%s%\*.cpp %s%\check\*.cpp %s%\compress\*.cpp %s%\console\*.cpp %s%\filter\*.cpp %s%\util\*.cpp
%RUN_CL% -J -O2 -W4 -WX -std:c++17 -Zc:__cplusplus -EHsc -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% %UPX_DEFS% -I%H%\vendor -Feupx.exe %sources% %UPX_LIBS% /link ${{ matrix.link_machine_flags }} setargv.obj %RUN_CL% -J -O2 -W4 -WX -std:c++17 -Zc:__cplusplus -EHsc -DUPX_VERSION_GITREV="""%GITREV%""" %DEFS% %UPX_DEFS% -I%H%\vendor -Feupx.exe %sources% %UPX_LIBS% /link ${{ matrix.link_machine_flags }} setargv.obj
- run: shopt -s globstar; ls -ld build/**/upx* || true
- run: shopt -s globstar; file build/**/upx* || true
- name: Make artifact - name: Make artifact
shell: bash
run: | run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-windows-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N/$B" mkdir -p "tmp/artifact/$N/$B"
@@ -457,23 +564,12 @@ jobs:
- name: ${{ format('Upload artifact {0}', env.artifact_name) }} - name: ${{ format('Upload artifact {0}', env.artifact_name) }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: { name: '${{ env.artifact_name }}', path: tmp/artifact } with: { name: '${{ env.artifact_name }}', path: tmp/artifact }
- name: Run basic tests - name: Mimic ctest tests
if: ${{ matrix.vsarch != 'amd64_arm64' }} if: ${{ matrix.vsarch != 'amd64_arm64' }}
run: | run: |
$ErrorActionPreference = 'stop' env -C build/$C/$B/upx upx_exe=./upx.exe bash "$PWD"/misc/testsuite/mimic_ctest.sh
$ErrorView = 'NormalView'
cd $Env:H\build\$Env:C\$Env:B\upx
$Env:UPX = "--no-color --no-progress"
.\upx.exe --version
.\upx.exe --sysinfo -v
.\upx.exe upx.exe -o upx_packed.exe
dir *.exe
.\upx.exe -l upx_packed.exe
.\upx.exe -t upx_packed.exe
.\upx_packed.exe --version
- name: Run test suite - name: Run test suite
if: ${{ matrix.vsarch != 'amd64_arm64' }} if: ${{ matrix.vsarch != 'amd64_arm64' }}
shell: bash
run: | run: |
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)" export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
env -C build/$C/$B/upx upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh env -C build/$C/$B/upx upx_exe=./upx.exe bash "$PWD"/misc/testsuite/upx_testsuite_1.sh
@@ -487,17 +583,19 @@ jobs:
include: include:
# only build a few selected targets => more targets are tested in the Weekly CI # only build a few selected targets => more targets are tested in the Weekly CI
- { zig_target: aarch64-linux-musl, qemu: qemu-aarch64 } - { zig_target: aarch64-linux-musl, qemu: qemu-aarch64 }
- { zig_target: aarch64-macos.11.0-none } - { zig_target: aarch64-linux-musl, qemu: qemu-aarch64, zig_pic: -fPIE, container: 'alpine:3.18' }
- { zig_target: aarch64-macos-none }
- { zig_target: aarch64-windows-gnu } - { zig_target: aarch64-windows-gnu }
- { zig_target: arm-linux-musleabihf, qemu: qemu-arm } - { zig_target: arm-linux-musleabihf, qemu: qemu-arm }
- { zig_target: armeb-linux-musleabihf, qemu: qemu-armeb } - { zig_target: armeb-linux-musleabihf, qemu: qemu-armeb }
- { zig_target: i386-linux-gnu.2.3.4, zig_flags: -march=i586 } - { zig_target: i386-linux-gnu.2.3.4, zig_flags: -march=i586 }
- { zig_target: i386-linux-gnu.2.17, zig_flags: -march=i586 } - { zig_target: i386-linux-gnu.2.17, zig_flags: -march=i586 }
- { zig_target: i386-linux-musl, zig_flags: -march=i586, qemu: qemu-i386 } - { zig_target: i386-linux-musl, zig_flags: -march=i586, qemu: qemu-i386 }
- { zig_target: i386-linux-musl, zig_flags: -march=i586, qemu: qemu-i386, zig_pic: -fPIE }
- { zig_target: i386-windows-gnu } - { zig_target: i386-windows-gnu }
- { zig_target: mips-linux-musleabi, zig_flags: -msoft-float, qemu: qemu-mips } - { zig_target: mips-linux-musleabi, qemu: qemu-mips }
- { zig_target: mips-linux-musleabihf, qemu: qemu-mips } - { zig_target: mips-linux-musleabihf, qemu: qemu-mips }
- { zig_target: mipsel-linux-musleabi, zig_flags: -msoft-float, qemu: qemu-mipsel } - { zig_target: mipsel-linux-musleabi, qemu: qemu-mipsel }
- { zig_target: mipsel-linux-musleabihf, qemu: qemu-mipsel } - { zig_target: mipsel-linux-musleabihf, qemu: qemu-mipsel }
# { zig_target: mips-linux-musleabi-mips32r2, zig_flags: -march=mips32r2, qemu: qemu-mips } # { zig_target: mips-linux-musleabi-mips32r2, zig_flags: -march=mips32r2, qemu: qemu-mips }
# { zig_target: mips-linux-musleabi-mips32r3, zig_flags: -march=mips32r3, qemu: qemu-mips } # { zig_target: mips-linux-musleabi-mips32r3, zig_flags: -march=mips32r3, qemu: qemu-mips }
@@ -505,18 +603,20 @@ jobs:
# { zig_target: mips-linux-musleabi-mips32r6, zig_flags: -march=mips32r6, qemu: qemu-mips } # { zig_target: mips-linux-musleabi-mips32r6, zig_flags: -march=mips32r6, qemu: qemu-mips }
- { zig_target: powerpc-linux-musleabihf, qemu: qemu-ppc } - { zig_target: powerpc-linux-musleabihf, qemu: qemu-ppc }
- { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64 } - { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64 }
- { zig_target: powerpc64-linux-musl, qemu: qemu-ppc64, zig_pic: -fPIE }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le } - { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le }
- { zig_target: powerpc64le-linux-musl, qemu: qemu-ppc64le, zig_pic: -fPIE }
- { zig_target: x86_64-linux-gnu.2.3.4, qemu: qemu-x86_64 } # can use QEMU because of gcompat - { zig_target: x86_64-linux-gnu.2.3.4, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-gnu.2.17, qemu: qemu-x86_64 } # can use QEMU because of gcompat - { zig_target: x86_64-linux-gnu.2.17, qemu: qemu-x86_64 } # can use QEMU because of gcompat
- { zig_target: x86_64-linux-musl, qemu: qemu-x86_64 } - { zig_target: x86_64-linux-musl, qemu: qemu-x86_64 }
- { zig_target: x86_64-macos.11.0-none } - { zig_target: x86_64-linux-musl, qemu: qemu-x86_64, zig_pic: -fPIE, container: 'alpine:3.18' }
- { zig_target: x86_64-macos-none }
- { zig_target: x86_64-windows-gnu } - { zig_target: x86_64-windows-gnu }
name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: 'alpine:3.21' container: ${{ matrix.container || 'alpine:3.22' }}
#container: ${{ contains(matrix.qemu, 'qemu-ppc64') && 'alpine:3.19' || 'alpine:3.21' }}
#container: ${{ (matrix.qemu == 'qemu-ppc64') && 'alpine:edge' || 'alpine:3.21' }}
env: env:
container: ${{ matrix.container || 'alpine:3.22' }}
UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: '' UPX_CONFIG_HAVE_WORKING_BUILD_RPATH: ''
# for zig-cc wrapper scripts (see below): # for zig-cc wrapper scripts (see below):
ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING ZIG_CPPFLAGS: -DUPX_DOCTEST_CONFIG_MULTITHREADING
@@ -525,19 +625,19 @@ jobs:
ZIG_TARGET: ${{ matrix.zig_target }} ZIG_TARGET: ${{ matrix.zig_target }}
steps: steps:
- run: uname -a; pwd; id; umask - run: uname -a; pwd; id; umask
- name: Install Alpine Linux container packages shell: sh
if: ${{ job.container }} - name: ${{ format('Install packages {0}', env.container) }}
shell: sh shell: sh
run: | run: |
apk update && apk upgrade && apk add bash cmake curl file git make parallel patch tar util-linux xz zstd apk update && apk upgrade && apk add bash cmake curl dmidecode file gdb git make parallel patch strace sudo tar util-linux xz zstd
# set PATH like in Ubuntu # set PATH like in Ubuntu
echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV echo "PATH=$HOME/.local/bin:$PATH" >> $GITHUB_ENV
git config --global --add safe.directory '*' # needed when running in a container git config --global --add safe.directory '*' # needed when running in a container
mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi) mkdir -p ~/.parallel && : > ~/.parallel/$(echo 6305-4721 | tr 0-7 leticlwi)
- uses: actions/checkout@v4 - run: (sudo dmidecode | sed -n -e '/System Information/,/^$/p') || true
- uses: actions/checkout@v5
with: { submodules: true } with: { submodules: true }
- name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }} - name: ${{ format('Install Zig {0}', env.ZIG_DIST_VERSION) }}
shell: bash
run: | run: |
rev=$(git rev-parse --short=7 HEAD) rev=$(git rev-parse --short=7 HEAD)
echo "UPX_GITREV_SHORT=$rev" >> $GITHUB_ENV echo "UPX_GITREV_SHORT=$rev" >> $GITHUB_ENV
@@ -553,9 +653,12 @@ jobs:
mkdir -p -v ~/.local/bin mkdir -p -v ~/.local/bin
cd ~/.local/bin cd ~/.local/bin
ZIG_DIST_NAME=zig-linux-x86_64-${ZIG_DIST_VERSION} ZIG_DIST_NAME=zig-linux-x86_64-${ZIG_DIST_VERSION}
ZIG_DIST_NAME=zig-x86_64-linux-${ZIG_DIST_VERSION}
#curl -sS -L -O https://ziglang.org/builds/${ZIG_DIST_NAME}.tar.xz #curl -sS -L -O https://ziglang.org/builds/${ZIG_DIST_NAME}.tar.xz
curl -sS -L -O https://ziglang.org/download/0.14.0/${ZIG_DIST_NAME}.tar.xz #curl -sS -L -O https://ziglang.org/download/0.14.1/${ZIG_DIST_NAME}.tar.xz
curl -sS -L -O https://ziglang.org/download/0.15.1/${ZIG_DIST_NAME}.tar.xz
ls -l ${ZIG_DIST_NAME}.tar.xz ls -l ${ZIG_DIST_NAME}.tar.xz
file ${ZIG_DIST_NAME}.tar.xz || true
tar -xoJf ${ZIG_DIST_NAME}.tar.xz tar -xoJf ${ZIG_DIST_NAME}.tar.xz
rm ${ZIG_DIST_NAME}.tar.xz rm ${ZIG_DIST_NAME}.tar.xz
ln -s -v ${ZIG_DIST_NAME}/zig zig ln -s -v ${ZIG_DIST_NAME}/zig zig
@@ -563,7 +666,7 @@ jobs:
echo -n 'zig version: '; zig version echo -n 'zig version: '; zig version
# patch zig # patch zig
ls -la "$HOME" "$GITHUB_WORKSPACE" || true ls -la "$HOME" "$GITHUB_WORKSPACE" || true
#(cd ${ZIG_DIST_NAME} && patch --verbose -p1 -i "$GITHUB_WORKSPACE"/misc/patches/zig/0001-x.patch) (cd ${ZIG_DIST_NAME} && patch --verbose -p1 -i "$GITHUB_WORKSPACE"/misc/patches/zig/0001-x.patch)
# create wrapper scripts (needed for CMake) # create wrapper scripts (needed for CMake)
log= log=
log='set -x\n' log='set -x\n'
@@ -578,7 +681,7 @@ jobs:
[[ $ZIG_TARGET == mips-linux-musleabihf-* ]] && ZIG_TARGET=mips-linux-musleabihf [[ $ZIG_TARGET == mips-linux-musleabihf-* ]] && ZIG_TARGET=mips-linux-musleabihf
[[ $ZIG_TARGET == mipsel-linux-musleabi-* ]] && ZIG_TARGET=mipsel-linux-musleabi [[ $ZIG_TARGET == mipsel-linux-musleabi-* ]] && ZIG_TARGET=mipsel-linux-musleabi
[[ $ZIG_TARGET == mipsel-linux-musleabihf-* ]] && ZIG_TARGET=mipsel-linux-musleabihf [[ $ZIG_TARGET == mipsel-linux-musleabihf-* ]] && ZIG_TARGET=mipsel-linux-musleabihf
ZIG_TARGET=${ZIG_TARGET/i386-/x86-} # i386 => x86 ZIG_TARGET=${ZIG_TARGET/#i386-/x86-} # i386 => x86
echo "ZIG_TARGET=$ZIG_TARGET" >> $GITHUB_ENV echo "ZIG_TARGET=$ZIG_TARGET" >> $GITHUB_ENV
# update ZIG_FLAGS # update ZIG_FLAGS
# -fPIE is for compilation only => also use the correct linker flag "-pie" # -fPIE is for compilation only => also use the correct linker flag "-pie"
@@ -593,6 +696,11 @@ jobs:
ZIG_FLAGS="$ZIG_FLAGS -fno-sanitize=all" ZIG_FLAGS="$ZIG_FLAGS -fno-sanitize=all"
echo "UPX_CONFIG_DISABLE_SANITIZE=ON" >> $GITHUB_ENV echo "UPX_CONFIG_DISABLE_SANITIZE=ON" >> $GITHUB_ENV
fi fi
if [[ $ZIG_TARGET == *-linux-gnu.2.[456789] ]]; then true;
# glibc-2.x: ld.lld: error: undefined symbol: pwritev64
ZIG_FLAGS="$ZIG_FLAGS -fno-sanitize=all"
echo "UPX_CONFIG_DISABLE_SANITIZE=ON" >> $GITHUB_ENV
fi
echo "ZIG_FLAGS=$ZIG_FLAGS" >> $GITHUB_ENV echo "ZIG_FLAGS=$ZIG_FLAGS" >> $GITHUB_ENV
- run: set -x; zig version; zig-cc --version || true; zig-cxx --version || true - run: set -x; zig version; zig-cc --version || true; zig-cxx --version || true
- run: zig-cc -E -x c -dM /dev/null # list predefined macros for C - run: zig-cc -E -x c -dM /dev/null # list predefined macros for C
@@ -601,14 +709,13 @@ jobs:
run: | run: |
make UPX_XTARGET=zig/${ZIG_TARGET}${ZIG_PIC} xtarget/release \ make UPX_XTARGET=zig/${ZIG_TARGET}${ZIG_PIC} xtarget/release \
CC="zig-cc" CXX="zig-cxx" CMAKE_AR="$HOME/.local/bin/zig-ar" CMAKE_RANLIB="$HOME/.local/bin/zig-ranlib" CC="zig-cc" CXX="zig-cxx" CMAKE_AR="$HOME/.local/bin/zig-ar" CMAKE_RANLIB="$HOME/.local/bin/zig-ranlib"
file build/zig/${ZIG_TARGET}${ZIG_PIC}/release/upx*
- name: ${{ format('Build Debug with zig-cc -target {0} {1}', env.ZIG_TARGET, env.ZIG_PIC) }} - name: ${{ format('Build Debug with zig-cc -target {0} {1}', env.ZIG_TARGET, env.ZIG_PIC) }}
run: | run: |
make UPX_XTARGET=zig/${ZIG_TARGET}${ZIG_PIC} xtarget/debug \ make UPX_XTARGET=zig/${ZIG_TARGET}${ZIG_PIC} xtarget/debug \
CC="zig-cc" CXX="zig-cxx" CMAKE_AR="$HOME/.local/bin/zig-ar" CMAKE_RANLIB="$HOME/.local/bin/zig-ranlib" CC="zig-cc" CXX="zig-cxx" CMAKE_AR="$HOME/.local/bin/zig-ar" CMAKE_RANLIB="$HOME/.local/bin/zig-ranlib"
file build/zig/${ZIG_TARGET}${ZIG_PIC}/debug/upx* - run: ls -l build/*/*/*/upx* || true
- run: file build/*/*/*/upx* || true
- name: ${{ format('Make artifact from upx-{0}-{1}', github.ref_name, env.UPX_GITREV_SHORT) }} - name: ${{ format('Make artifact from upx-{0}-{1}', github.ref_name, env.UPX_GITREV_SHORT) }}
shell: bash
run: | run: |
N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-zigcc-${{ matrix.zig_target }}${ZIG_PIC}" | sed 's/[^0-9a-zA-Z_.-]/-/g') N=$(echo "upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-zigcc-${{ matrix.zig_target }}${ZIG_PIC}" | sed 's/[^0-9a-zA-Z_.-]/-/g')
mkdir -p "tmp/artifact/$N" mkdir -p "tmp/artifact/$N"
@@ -656,7 +763,8 @@ jobs:
echo "===== parallel jobs: $jobs" echo "===== parallel jobs: $jobs"
parallel -kv --lb 'cd build/zig/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs parallel -kv --lb 'cd build/zig/{} && bash ../../../../misc/testsuite/mimic_ctest.sh' ::: $jobs
- name: Mimic ctest tests with Valgrind - name: Mimic ctest tests with Valgrind
if: ${{ matrix.zig_target == 'x86_64-linux-musl' || contains(matrix.zig_target, 'x86_64-linux-gnu.2') }} #if: ${{ matrix.zig_target == 'x86_64-linux-musl' || contains(matrix.zig_target, 'x86_64-linux-gnu.2') }}
if: false
run: | run: |
export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW export UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS=ON # valgrind is SLOW
apk add coreutils valgrind apk add coreutils valgrind
@@ -25,7 +25,7 @@ jobs:
issues: write issues: write
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@v9 - uses: actions/stale@v10
with: with:
operations-per-run: 300 operations-per-run: 300
exempt-all-milestones: true exempt-all-milestones: true
+2
View File
@@ -1,6 +1,8 @@
/.cache* /.cache*
/.idea/
/.hg* /.hg*
/.vscode* /.vscode*
/.zed/
/CMakeCache* /CMakeCache*
/CMakeFiles* /CMakeFiles*
/CTest* /CTest*
+7 -3
View File
@@ -30,6 +30,8 @@ endif()
# support functions and some utility # support functions and some utility
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake")
upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR) upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR)
upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM)
upx_print_env_var(CC CXX CPPFLAGS CFLAGS CXXFLAGS)
#*********************************************************************** #***********************************************************************
# options # options
@@ -62,13 +64,15 @@ option(UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS "Do not run exhaustive tests"
# init # init
#*********************************************************************** #***********************************************************************
set(UPX_VERSION_STRING "5.0.1") # this should match src/version.h set(UPX_VERSION_STRING "5.0.3") # this should match src/version.h
upx_cmake_include_hook(2_init) upx_cmake_include_hook(2_init)
# Disallow in-source build. Note that you will still have to manually # Disallow in-source build. Note that you will still have to manually
# clean up a few files if you accidentally try an in-source build. # clean up a few files if you accidentally try an in-source build.
upx_disallow_in_source_build() if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/.git")
upx_disallow_in_source_build()
endif()
# global settings # global settings
if(${CMAKE_VERSION} VERSION_GREATER "3.14.99" AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) if(${CMAKE_VERSION} VERSION_GREATER "3.14.99" AND NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
@@ -89,7 +93,6 @@ upx_cache_bool_vars(OFF
UPX_CONFIG_DISABLE_SAVE_TEMPS UPX_CONFIG_DISABLE_SHARED_LIBS UPX_CONFIG_REQUIRE_THREADS UPX_CONFIG_DISABLE_SAVE_TEMPS UPX_CONFIG_DISABLE_SHARED_LIBS UPX_CONFIG_REQUIRE_THREADS
) )
upx_cache_bool_vars(ON UPX_CONFIG_EXPECT_THREADS) upx_cache_bool_vars(ON UPX_CONFIG_EXPECT_THREADS)
upx_print_env_var(CC CXX)
# determine Git revision # determine Git revision
set(GITREV_SHORT "") set(GITREV_SHORT "")
@@ -466,6 +469,7 @@ if(NOT CMAKE_CROSSCOMPILING OR CMAKE_CROSSCOMPILING_EMULATOR)
# IMPORTANT NOTE: these tests can only work if the host executable format # IMPORTANT NOTE: these tests can only work if the host executable format
# is supported by UPX! # is supported by UPX!
include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/self_pack_test.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/self_pack_test.cmake")
upx_self_pack_test()
endif() endif()
endif() endif()
+26 -9
View File
@@ -26,8 +26,13 @@ endif
.DEFAULT_GOAL = build/release .DEFAULT_GOAL = build/release
run_cmake_config = $(CMAKE) -S . -B $1 $(UPX_CMAKE_CONFIG_FLAGS) -DCMAKE_BUILD_TYPE=$2 .NOTPARALLEL: # because the actual builds use "cmake --parallel"
run_cmake_build = $(CMAKE) --build $1 $(UPX_CMAKE_BUILD_FLAGS) --config $2 .PHONY: PHONY
.SECONDEXPANSION:
.SUFFIXES:
run_cmake_config = $(CMAKE) -S . -B "$1" $(UPX_CMAKE_CONFIG_FLAGS) -DCMAKE_BUILD_TYPE="$2"
run_cmake_build = $(CMAKE) --build "$1" $(UPX_CMAKE_BUILD_FLAGS) --config "$2"
# avoid re-running run_cmake_config if .upx_cmake_config_done.txt already exists # avoid re-running run_cmake_config if .upx_cmake_config_done.txt already exists
run_config = $(if $(wildcard $1/CMakeFiles/.*_cmake_config_done.txt),,$(call run_cmake_config,$1,$2)) run_config = $(if $(wildcard $1/CMakeFiles/.*_cmake_config_done.txt),,$(call run_cmake_config,$1,$2))
run_build = $(call run_cmake_build,$1,$2) run_build = $(call run_cmake_build,$1,$2)
@@ -40,11 +45,6 @@ build/release: PHONY
$(call run_config,$@,Release) $(call run_config,$@,Release)
$(call run_build,$@,Release) $(call run_build,$@,Release)
.NOTPARALLEL: # because the actual builds use "cmake --parallel"
.PHONY: PHONY
.SECONDEXPANSION:
.SUFFIXES:
# shortcuts (all => debug + release) # shortcuts (all => debug + release)
debug: build/debug PHONY debug: build/debug PHONY
release: build/release PHONY release: build/release PHONY
@@ -72,9 +72,26 @@ all+test build/all+test: build/debug+test build/release+test PHONY
test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
# #***********************************************************************
# install
#***********************************************************************
build/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug
build/%/debug+install: $$(dir $$@)debug PHONY; cd "$(dir $@)debug" && $(CMAKE) --install . --config Debug
build/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release
build/%/release+install: $$(dir $$@)release PHONY; cd "$(dir $@)release" && $(CMAKE) --install . --config Release
build/%/all+install: $$(dir $$@)debug+install $$(dir $$@)release+install PHONY ;
# shortcuts
debug+install: build/debug+install PHONY
release+install: build/release+install PHONY
all+install build/all+install: build/debug+install build/release+install PHONY
install: $$(patsubst %+install,%,$$(.DEFAULT_GOAL))+install PHONY
#***********************************************************************
# END of Makefile # END of Makefile
# #***********************************************************************
# extra pre-defined build configurations and some utility; optional # extra pre-defined build configurations and some utility; optional
-include ./Makevars-local.mk -include ./Makevars-local.mk
+6
View File
@@ -2,6 +2,12 @@
User visible changes for UPX User visible changes for UPX
================================================================== ==================================================================
Changes in 5.0.3 (XX XXX XXXX):
* bug fixes - see https://github.com/upx/upx/milestone/21
Changes in 5.0.2 (20 Jul 2025):
* bug fixes - see https://github.com/upx/upx/milestone/20
Changes in 5.0.1 (06 May 2025): Changes in 5.0.1 (06 May 2025):
* bug fixes - see https://github.com/upx/upx/milestone/19 * bug fixes - see https://github.com/upx/upx/milestone/19
+1 -1
View File
@@ -91,7 +91,7 @@ Copyright (C) 2000-2025 John F. Reiser
UPX is distributed with full source code under the terms of the UPX is distributed with full source code under the terms of the
GNU General Public License v2+; either under the pure GPLv2+ (see GNU General Public License v2+; either under the pure GPLv2+ (see
the file COPYING), or (at your option) under the GPLv+2 with special the file COPYING), or (at your option) under the GPLv2+ with special
exceptions and restrictions granting the free usage for all binaries exceptions and restrictions granting the free usage for all binaries
including commercial programs (see the file LICENSE). including commercial programs (see the file LICENSE).
Generated
+1 -1
View File
@@ -55,7 +55,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "UPX 1" .IX Title "UPX 1"
.TH UPX 1 2025-05-06 "upx 5.0.1" " " .TH UPX 1 2025-07-21 "upx 5.0.3" " "
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
+1 -1
View File
@@ -42,7 +42,7 @@ function(upx_print_info)
upx_print_var(CMAKE_${lang}_COMPILER_ID) upx_print_var(CMAKE_${lang}_COMPILER_ID)
upx_print_var(CMAKE_${lang}_SIMULATE_ID) upx_print_var(CMAKE_${lang}_SIMULATE_ID)
upx_print_var(CMAKE_${lang}_COMPILER_VERSION) upx_print_var(CMAKE_${lang}_COMPILER_VERSION)
upx_print_var(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT ) upx_print_var(CMAKE_${lang}_COMPILER_FRONTEND_VARIANT)
upx_print_var(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID) upx_print_var(CMAKE_${lang}_COMPILER_ARCHITECTURE_ID)
upx_print_var(CMAKE_${lang}_PLATFORM_ID) upx_print_var(CMAKE_${lang}_PLATFORM_ID)
upx_print_var(CMAKE_${lang}_COMPILER_ABI) upx_print_var(CMAKE_${lang}_COMPILER_ABI)
+35 -26
View File
@@ -10,6 +10,8 @@
# is supported by UPX! # is supported by UPX!
#*********************************************************************** #***********************************************************************
function(upx_self_pack_test)
set(emu "") set(emu "")
if(DEFINED CMAKE_CROSSCOMPILING_EMULATOR) if(DEFINED CMAKE_CROSSCOMPILING_EMULATOR)
set(emu "${CMAKE_CROSSCOMPILING_EMULATOR}") set(emu "${CMAKE_CROSSCOMPILING_EMULATOR}")
@@ -114,35 +116,42 @@ endif()
if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS) if(NOT UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS)
foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma) foreach(method IN ITEMS nrv2b nrv2d nrv2e lzma)
foreach(level IN ITEMS 1 2 3 4 5 6 7) foreach(level IN ITEMS 1 2 3 4 5 6 7)
set(s "${method}-${level}") foreach(small IN ITEMS normal small)
upx_add_test(upx-self-pack-${s} upx --${method} -${level} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe}) set(s "${method}-${level}")
upx_add_test(upx-list-${s} upx -l upx-packed-${s}${exe}) set(ss "")
upx_add_test(upx-fileinfo-${s} upx --fileinfo upx-packed-${s}${exe}) if(small MATCHES "small")
upx_add_test(upx-test-${s} upx -t upx-packed-${s}${exe}) set(s "${method}-${level}-${small}")
upx_add_test(upx-unpack-${s} upx -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe}) set(ss "--small")
upx_add_test(upx-compare-${s} "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-${s}${exe}) endif()
upx_test_depends(upx-list-${s} upx-self-pack-${s}) upx_add_test(upx-self-pack-${s} upx --${method} -${level} ${ss} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe})
upx_test_depends(upx-fileinfo-${s} upx-self-pack-${s}) upx_add_test(upx-list-${s} upx -l upx-packed-${s}${exe})
upx_test_depends(upx-test-${s} upx-self-pack-${s}) upx_add_test(upx-fileinfo-${s} upx --fileinfo upx-packed-${s}${exe})
upx_test_depends(upx-unpack-${s} upx-self-pack-${s}) upx_add_test(upx-test-${s} upx -t upx-packed-${s}${exe})
upx_test_depends(upx-compare-${s} "upx-unpack;upx-unpack-${s}") upx_add_test(upx-unpack-${s} upx -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe})
if(method MATCHES "lzma") upx_add_test(upx-compare-${s} "${CMAKE_COMMAND}" -E compare_files upx-unpacked${exe} upx-unpacked-${s}${exe})
set_tests_properties(upx-self-pack-${s} PROPERTIES COST "3${level}") upx_test_depends(upx-list-${s} upx-self-pack-${s})
else() upx_test_depends(upx-fileinfo-${s} upx-self-pack-${s})
set_tests_properties(upx-self-pack-${s} PROPERTIES COST "2${level}") upx_test_depends(upx-test-${s} upx-self-pack-${s})
endif() upx_test_depends(upx-unpack-${s} upx-self-pack-${s})
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST) upx_test_depends(upx-compare-${s} "upx-unpack;upx-unpack-${s}")
upx_add_test(upx-run-packed-${s} ${emu} ./upx-packed-${s}${exe} --version-short) if(method MATCHES "lzma")
upx_test_depends(upx-run-packed-${s} upx-self-pack-${s}) set_tests_properties(upx-self-pack-${s} PROPERTIES COST "3${level}")
endif() else()
set_tests_properties(upx-self-pack-${s} PROPERTIES COST "2${level}")
endif()
if(NOT UPX_CONFIG_DISABLE_RUN_PACKED_TEST)
set(i 0)
while(${i} LESS 20)
math(EXPR i "${i} + 1")
upx_add_test(upx-run-packed-${s}-${i} ${emu} ./upx-packed-${s}${exe} --version-short)
upx_test_depends(upx-run-packed-${s}-${i} upx-self-pack-${s})
endwhile()
endif()
endforeach()
endforeach() endforeach()
endforeach() endforeach()
endif() # UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS endif() # UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS
# clean up endfunction()
set(emu "")
set(exe "")
set(upx_self_exe "")
set(fo "")
# vim:set ft=cmake ts=4 sw=4 tw=0 et: # vim:set ft=cmake ts=4 sw=4 tw=0 et:
+11
View File
@@ -0,0 +1,11 @@
#
# UPX "CMake" build file; see https://cmake.org/
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
if(NOT DEFINED USE_STRICT_DEFAULTS)
# use strict config defaults for Git developer builds
set(USE_STRICT_DEFAULTS TRUE CACHE INTERNAL "" FORCE)
endif()
# vim:set ft=cmake ts=4 sw=4 tw=0 et:
+17 -2
View File
@@ -65,6 +65,13 @@ build/extra/clang-lto-auto/release: PHONY; $(call run_config_and_build,$@,Releas
build/extra/clang-lto-auto/%: export CC = clang -flto=auto build/extra/clang-lto-auto/%: export CC = clang -flto=auto
build/extra/clang-lto-auto/%: export CXX = clang++ -flto=auto build/extra/clang-lto-auto/%: export CXX = clang++ -flto=auto
# force building with clang/clang++ -pie
build/extra/clang-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/clang-pie/release: PHONY; $(call run_config_and_build,$@,Release)
build/extra/clang-pie/%: export CC = clang -pie -fPIE -Wno-unused-command-line-argument
build/extra/clang-pie/%: export CXX = clang++ -pie -fPIE -Wno-unused-command-line-argument
build/extra/clang-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
# force building with clang/clang++ -static # force building with clang/clang++ -static
build/extra/clang-static/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/clang-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/clang-static/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/clang-static/release: PHONY; $(call run_config_and_build,$@,Release)
@@ -140,6 +147,13 @@ build/extra/gcc-lto-auto/release: PHONY; $(call run_config_and_build,$@,Release)
build/extra/gcc-lto-auto/%: export CC = gcc -flto=auto build/extra/gcc-lto-auto/%: export CC = gcc -flto=auto
build/extra/gcc-lto-auto/%: export CXX = g++ -flto=auto build/extra/gcc-lto-auto/%: export CXX = g++ -flto=auto
# force building with gcc/g++ -pie
build/extra/gcc-pie/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/gcc-pie/release: PHONY; $(call run_config_and_build,$@,Release)
build/extra/gcc-pie/%: export CC = gcc -pie -fPIE
build/extra/gcc-pie/%: export CXX = g++ -pie -fPIE
build/extra/gcc-pie/%: export UPX_CONFIG_DISABLE_SHARED_LIBS = ON
# force building with gcc/g++ -static # force building with gcc/g++ -static
build/extra/gcc-static/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/gcc-static/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/gcc-static/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/gcc-static/release: PHONY; $(call run_config_and_build,$@,Release)
@@ -177,7 +191,7 @@ build/extra/gcc-std-cxx23/%: export CXX = g++ -std=gnu++2b
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD = ON
build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON build/extra/gcc-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD = ON
# force building with gcc/g++ C++26 (EXPERIMENTAL; need gcc-14) # force building with gcc/g++ C++26 (and C23)
build/extra/gcc-std-cxx26/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/gcc-std-cxx26/debug: PHONY; $(call run_config_and_build,$@,Debug)
build/extra/gcc-std-cxx26/release: PHONY; $(call run_config_and_build,$@,Release) build/extra/gcc-std-cxx26/release: PHONY; $(call run_config_and_build,$@,Release)
build/extra/gcc-std-cxx26/%: export CC = gcc -std=gnu23 build/extra/gcc-std-cxx26/%: export CC = gcc -std=gnu23
@@ -250,7 +264,7 @@ build/analyze/clang-analyzer/%: export CCC_CXX ?= clang++
# run clang-tidy: uses file compile_commands.json from an existing clang build; # run clang-tidy: uses file compile_commands.json from an existing clang build;
# does not create any actual files, so purely PHONY # does not create any actual files, so purely PHONY
CLANG_TIDY_BUILD_BASE = build/extra/clang CLANG_TIDY_BUILD_BASE = build/extra/clang
RUN_CLANG_TIDY = time python3 ./misc/analyze/clang-tidy/run-clang-tidy.py -p $< RUN_CLANG_TIDY = time python3 ./misc/analyze/clang-tidy/run-clang-tidy.py -p "$<"
RUN_CLANG_TIDY_WERROR = $(RUN_CLANG_TIDY) '-warnings-as-errors=*' RUN_CLANG_TIDY_WERROR = $(RUN_CLANG_TIDY) '-warnings-as-errors=*'
build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY build/analyze/clang-tidy-upx/debug build/analyze/clang-tidy-upx/release: $$(CLANG_TIDY_BUILD_BASE)/$$(notdir $$@) PHONY
$(RUN_CLANG_TIDY_WERROR) -config-file ./.clang-tidy '/src/.*\.cpp' $(RUN_CLANG_TIDY_WERROR) -config-file ./.clang-tidy '/src/.*\.cpp'
@@ -319,6 +333,7 @@ $(call check_undefined,__add_cmake_config)
__add_cmake_config = $(and $($1),-D$1="$($1)") __add_cmake_config = $(and $($1),-D$1="$($1)")
# pass common CMake settings # pass common CMake settings
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_INSTALL_PREFIX)
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE)
# pass common CMake toolchain settings # pass common CMake toolchain settings
UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE) UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE)
+5 -5
View File
@@ -8,15 +8,15 @@ ENV LANG=C.UTF-8
RUN dpkg --add-architecture i386 \ RUN dpkg --add-architecture i386 \
&& apt-get update && apt-get upgrade -y \ && apt-get update && apt-get upgrade -y \
&& apt-get install -y --no-install-recommends \ && apt-get install -y --no-install-recommends \
aria2 bash bash-completion ca-certificates curl git less libmpc3 \ aria2 bash bash-completion ca-certificates coreutils curl diffutils findutils git grep gzip \
make ncurses-term perl-base tar time wget xz-utils \ less libmpc3 make ncurses-term perl-base sed sudo tar time util-linux wget xz-utils \
libc6:i386 zlib1g:i386 \ libc6:i386 zlib1g:i386 \
# the following packages are not required for rebuilding the stubs, but # the following packages are not required for rebuilding the stubs, but
# they do make the image *much* more convenient and also allow building # they do make the image *much* more convenient and also allow building
# the full UPX binary inside the container via CMake: # the full UPX binary inside the container via CMake:
7zip bat bfs btop bubblewrap busybox bzip2 bzip3 cabextract ccache chrpath cmake cpio \ 7zip bat bfs btop bubblewrap busybox bzip2 bzip3 cabextract ccache chrpath cmake cpio \
dash diffstat direnv elfutils execstack eza fd-find file fish fzf \ dash diffstat direnv dmidecode elfutils execstack eza fd-find file fish fzf \
g++ gawk gdb gojq ht htop hyperfine jq ksh \ g++ gawk gdb gh gojq ht htop hyperfine jq just ksh \
lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \ lftp libzstd-dev lsb-release lsd lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
p7zip parallel patch patchelf patchutils pax-utils proot \ p7zip parallel patch patchelf patchutils pax-utils proot \
python3 python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \ python3 python3-pyasn1 python3-pycryptodome python3-pycurl python3-tomli python3-tomli-w \
@@ -62,7 +62,7 @@ RUN cd /root \
# install official UPX release binaries into /usr/local/bin; not required but convenient for testing # install official UPX release binaries into /usr/local/bin; not required but convenient for testing
RUN cd /root \ RUN cd /root \
&& curl -sS -L -O https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \ && curl -sS -L -O https://github.com/upx/upx/releases/download/v3.91/upx-3.91-amd64_linux.tar.bz2 \
&& xzversions="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 5.0.0" \ && xzversions="3.92 3.93 3.94 3.95 3.96 4.0.0 4.0.1 4.0.2 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 5.0.0 5.0.1 5.0.2" \
&& for v in $xzversions; do curl -sS -L -O https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \ && for v in $xzversions; do curl -sS -L -O https://github.com/upx/upx/releases/download/v${v}/upx-${v}-amd64_linux.tar.xz; done \
&& for f in ./upx-*.tar.*; do tar -xoaf $f; done \ && for f in ./upx-*.tar.*; do tar -xoaf $f; done \
&& for v in 3.91 $xzversions; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \ && for v in 3.91 $xzversions; do d=upx-${v}-amd64_linux; ./$d/upx -qq -d $d/upx -o /usr/local/bin/upx-${v}; done \
+108 -100
View File
@@ -2,7 +2,7 @@ Packages:
+++-=============================-=================================-============-================================================================================ +++-=============================-=================================-============-================================================================================
Desired=Unknown/Install/Remove/Purge/Hold Desired=Unknown/Install/Remove/Purge/Hold
ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio ii 7zip 23.01+dfsg-11 amd64 7-Zip file archiver with a high compression ratio
ii apt 2.7.14build2 amd64 commandline package manager ii apt 2.8.3 amd64 commandline package manager
ii aria2 1.37.0+debian-1build3 amd64 High speed download utility ii aria2 1.37.0+debian-1build3 amd64 High speed download utility
ii base-files 13ubuntu10.2 amd64 Debian base system miscellaneous files ii base-files 13ubuntu10.2 amd64 Debian base system miscellaneous files
ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files ii base-passwd 3.6.3build1 amd64 Debian base system master password and group files
@@ -10,11 +10,11 @@ ii bash 5.2.21-2ubuntu4 amd64
ii bash-completion 1:2.11-8 all programmable completion for the bash shell ii bash-completion 1:2.11-8 all programmable completion for the bash shell
ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration ii bat 0.24.0-1build1 amd64 cat(1) clone with syntax highlighting and git integration
ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1) ii bfs 3.1.2-1build1 amd64 Breadth-first version of find(1)
ii binutils 2.42-4ubuntu2.4 amd64 GNU assembler, linker and binary utilities ii binutils 2.42-4ubuntu2.5 amd64 GNU assembler, linker and binary utilities
ii binutils-common:amd64 2.42-4ubuntu2.4 amd64 Common files for the GNU assembler, linker and binary utilities ii binutils-common:amd64 2.42-4ubuntu2.5 amd64 Common files for the GNU assembler, linker and binary utilities
ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.4 amd64 GNU binary utilities, for x86-64-linux-gnu target ii binutils-x86-64-linux-gnu 2.42-4ubuntu2.5 amd64 GNU binary utilities, for x86-64-linux-gnu target
ii bsdextrautils 2.39.3-9ubuntu6.2 amd64 extra utilities from 4.4BSD-Lite ii bsdextrautils 2.39.3-9ubuntu6.3 amd64 extra utilities from 4.4BSD-Lite
ii bsdutils 1:2.39.3-9ubuntu6.2 amd64 basic utilities from 4.4BSD-Lite ii bsdutils 1:2.39.3-9ubuntu6.3 amd64 basic utilities from 4.4BSD-Lite
ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats ii btop 1.3.0-1 amd64 Modern and colorful command line resource monitor that shows usage and stats
ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation ii bubblewrap 0.9.0-1ubuntu0.1 amd64 utility for unprivileged chroot and namespace manipulation
ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems ii busybox 1:1.36.1-6ubuntu3.1 amd64 Tiny utilities for small and embedded systems
@@ -38,10 +38,11 @@ ii debconf 1.5.86ubuntu1 all
ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian ii debianutils 5.17build1 amd64 Miscellaneous utilities specific to Debian
ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file ii diffstat 1.66-1build1 amd64 produces graph of changes introduced by a diff file
ii diffutils 1:3.10-1build1 amd64 File comparison utilities ii diffutils 1:3.10-1build1 amd64 File comparison utilities
ii direnv 2.32.1-2ubuntu0.24.04.2 amd64 Utility to set directory specific environment variables ii direnv 2.32.1-2ubuntu0.24.04.3 amd64 Utility to set directory specific environment variables
ii dmidecode 3.5-3ubuntu0.1 amd64 SMBIOS/DMI table decoder
ii dpkg 1.22.6ubuntu6.1 amd64 Debian package management system ii dpkg 1.22.6ubuntu6.1 amd64 Debian package management system
ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities ii e2fsprogs 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system utilities
ii elfutils 0.190-1.1build4.1 amd64 collection of utilities to handle ELF objects ii elfutils 0.190-1.1ubuntu0.1 amd64 collection of utilities to handle ELF objects
ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility ii execstack 0.0.20131005-1.1ubuntu1 amd64 ELF GNU_STACK program header editing utility
ii eza 0.18.2-1 amd64 Modern replacement for ls ii eza 0.18.2-1 amd64 Modern replacement for ls
ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find ii fd-find 9.0.0-1 amd64 Simple, fast and user-friendly alternative to find
@@ -49,7 +50,7 @@ ii file 1:5.45-3build1 amd64
ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs ii findutils 4.9.0-5build1 amd64 utilities for finding files--find, xargs
ii fish 3.7.0-1 amd64 friendly interactive shell ii fish 3.7.0-1 amd64 friendly interactive shell
ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files) ii fish-common 3.7.0-1 all friendly interactive shell (architecture-independent files)
ii fzf 0.44.1-1ubuntu0.2 amd64 general-purpose command-line fuzzy finder ii fzf 0.44.1-1ubuntu0.3 amd64 general-purpose command-line fuzzy finder
ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler ii g++ 4:13.2.0-7ubuntu1 amd64 GNU C++ compiler
ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler ii g++-13 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler
ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support) ii g++-13-multilib 13.3.0-6ubuntu2~24.04 amd64 GNU C++ compiler (multilib support)
@@ -67,19 +68,21 @@ ii gcc-14-base:i386 14.2.0-4ubuntu2~24.04 i386
ii gcc-multilib 4:13.2.0-7ubuntu1 amd64 GNU C compiler (multilib files) ii gcc-multilib 4:13.2.0-7ubuntu1 amd64 GNU C compiler (multilib files)
ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture ii gcc-x86-64-linux-gnu 4:13.2.0-7ubuntu1 amd64 GNU C compiler for the amd64 architecture
ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger ii gdb 15.0.50.20240403-0ubuntu1 amd64 GNU Debugger
ii git 1:2.43.0-1ubuntu7.2 amd64 fast, scalable, distributed revision control system ii gh 2.45.0-1ubuntu0.3 amd64 GitHub CLI, GitHubs official command line tool
ii git-man 1:2.43.0-1ubuntu7.2 all fast, scalable, distributed revision control system (manual pages) ii git 1:2.43.0-1ubuntu7.3 amd64 fast, scalable, distributed revision control system
ii gojq 0.12.13-1ubuntu0.24.04.2 amd64 pure Go implementation of jq (program) ii git-man 1:2.43.0-1ubuntu7.3 all fast, scalable, distributed revision control system (manual pages)
ii gpgv 2.4.4-2ubuntu17 amd64 GNU privacy guard - signature verification tool ii gojq 0.12.13-1ubuntu0.24.04.3 amd64 pure Go implementation of jq (program)
ii gpgv 2.4.4-2ubuntu17.3 amd64 GNU privacy guard - signature verification tool
ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep ii grep 3.11-4build1 amd64 GNU grep, egrep and fgrep
ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components) ii groff-base 1.23.0-3build2 amd64 GNU troff text-formatting system (base system components)
ii gzip 1.12-1ubuntu3 amd64 GNU compression utilities ii gzip 1.12-1ubuntu3.1 amd64 GNU compression utilities
ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name ii hostname 3.23+nmu2ubuntu2 amd64 utility to set/show the host name or domain name
ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables ii ht 2.1.0+repack1-5 amd64 Viewer/editor/analyser (mostly) for executables
ii htop 3.3.0-4build1 amd64 interactive processes viewer ii htop 3.3.0-4build1 amd64 interactive processes viewer
ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool ii hyperfine 1.18.0-2build1 amd64 Command-line benchmarking tool
ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems ii init-system-helpers 1.66ubuntu1 all helper tools for all init systems
ii jq 1.7.1-3build1 amd64 lightweight and flexible command-line JSON processor ii jq 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor
ii just 1.21.0-1 amd64 Save and run project-specific commands
ii ksh 20240113 all transitional package ii ksh 20240113 all transitional package
ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell ii ksh93u+m 1.0.8-1 amd64 AT&T KornShell
ii less 590-2ubuntu2.1 amd64 pager program similar to more ii less 590-2ubuntu2.1 amd64 pager program similar to more
@@ -95,33 +98,34 @@ ii lib32stdc++-13-dev 13.3.0-6ubuntu2~24.04 amd64
ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version) ii lib32stdc++6 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (32 bit Version)
ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit) ii lib32ubsan1 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (32bit)
ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library ii libacl1:amd64 2.3.2-1build1.1 amd64 access control list - shared library
ii libapt-pkg6.0t64:amd64 2.7.14build2 amd64 package management runtime library ii libapparmor1:amd64 4.0.1really4.0.1-0ubuntu0.24.04.4 amd64 changehat AppArmor library
ii libarchive13t64:amd64 3.7.2-2ubuntu0.3 amd64 Multi-format archive and compression library (shared library) ii libapt-pkg6.0t64:amd64 2.8.3 amd64 package management runtime library
ii libarchive13t64:amd64 3.7.2-2ubuntu0.5 amd64 Multi-format archive and compression library (shared library)
ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2 ii libaria2-0:amd64 1.37.0+debian-1build3 amd64 C++ library interface to aria2
ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector ii libasan8:amd64 14.2.0-4ubuntu2~24.04 amd64 AddressSanitizer -- a fast memory error detector
ii libasm1t64:amd64 0.190-1.1build4.1 amd64 library with a programmable assembler interface ii libasm1t64:amd64 0.190-1.1ubuntu0.1 amd64 library with a programmable assembler interface
ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components ii libassuan0:amd64 2.5.6-1build1 amd64 IPC library for the GnuPG components
ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions ii libatomic1:amd64 14.2.0-4ubuntu2~24.04 amd64 support library providing __atomic built-in functions
ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library ii libattr1:amd64 1:2.5.2-1build1.1 amd64 extended attribute handling - shared library
ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files ii libaudit-common 1:3.1.2-2.1build1.1 all Dynamic library for security auditing - common files
ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing ii libaudit1:amd64 1:3.1.2-2.1build1.1 amd64 Dynamic library for security auditing
ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries ii libbabeltrace1:amd64 1.5.11-3build3 amd64 Babeltrace conversion libraries
ii libbinutils:amd64 2.42-4ubuntu2.4 amd64 GNU binary utilities (private shared library) ii libbinutils:amd64 2.42-4ubuntu2.5 amd64 GNU binary utilities (private shared library)
ii libblkid1:amd64 2.39.3-9ubuntu6.2 amd64 block device ID library ii libblkid1:amd64 2.39.3-9ubuntu6.3 amd64 block device ID library
ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries) ii libbrotli1:amd64 1.1.0-2build2 amd64 library implementing brotli encoder and decoder (shared libraries)
ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library ii libbsd0:amd64 0.12.1-1build1.1 amd64 utility functions from BSD systems - shared library
ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime ii libbz2-1.0:amd64 1.0.8-5.1build0.1 amd64 high-quality block-sorting file compressor library - runtime
ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime ii libbzip3-0:amd64 1.4.0-1 amd64 better, faster and stronger spiritual successor to bzip2 - runtime
ii libc-bin 2.39-0ubuntu8.4 amd64 GNU C Library: Binaries ii libc-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Binaries
ii libc-dev-bin 2.39-0ubuntu8.4 amd64 GNU C Library: Development binaries ii libc-dev-bin 2.39-0ubuntu8.5 amd64 GNU C Library: Development binaries
ii libc6-dbg:amd64 2.39-0ubuntu8.4 amd64 GNU C Library: detached debugging symbols ii libc6-dbg:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: detached debugging symbols
ii libc6-dev-i386 2.39-0ubuntu8.4 amd64 GNU C Library: 32-bit development libraries for AMD64 ii libc6-dev-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit development libraries for AMD64
ii libc6-dev-x32 2.39-0ubuntu8.4 amd64 GNU C Library: X32 ABI Development Libraries for AMD64 ii libc6-dev-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Development Libraries for AMD64
ii libc6-dev:amd64 2.39-0ubuntu8.4 amd64 GNU C Library: Development Libraries and Header Files ii libc6-dev:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Development Libraries and Header Files
ii libc6-i386 2.39-0ubuntu8.4 amd64 GNU C Library: 32-bit shared libraries for AMD64 ii libc6-i386 2.39-0ubuntu8.5 amd64 GNU C Library: 32-bit shared libraries for AMD64
ii libc6-x32 2.39-0ubuntu8.4 amd64 GNU C Library: X32 ABI Shared libraries for AMD64 ii libc6-x32 2.39-0ubuntu8.5 amd64 GNU C Library: X32 ABI Shared libraries for AMD64
ii libc6:amd64 2.39-0ubuntu8.4 amd64 GNU C Library: Shared libraries ii libc6:amd64 2.39-0ubuntu8.5 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.39-0ubuntu8.4 i386 GNU C Library: Shared libraries ii libc6:i386 2.39-0ubuntu8.5 i386 GNU C Library: Shared libraries
ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library ii libcap-ng0:amd64 0.8.4-2build2 amd64 alternate POSIX capabilities library
ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library) ii libcap2:amd64 1:2.66-5ubuntu2.2 amd64 POSIX 1003.1e capabilities (library)
ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver ii libcares2:amd64 1.27.0-1.0ubuntu1 amd64 asynchronous name resolver
@@ -129,18 +133,18 @@ ii libcc1-0:amd64 14.2.0-4ubuntu2~24.04 amd64
ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library ii libcom-err2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 common error description library
ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files ii libcrypt-dev:amd64 1:4.4.36-4build1 amd64 libcrypt development files
ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library ii libcrypt1:amd64 1:4.4.36-4build1 amd64 libcrypt shared library
ii libctf-nobfd0:amd64 2.42-4ubuntu2.4 amd64 Compact C Type Format library (runtime, no BFD dependency) ii libctf-nobfd0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, no BFD dependency)
ii libctf0:amd64 2.42-4ubuntu2.4 amd64 Compact C Type Format library (runtime, BFD dependency) ii libctf0:amd64 2.42-4ubuntu2.5 amd64 Compact C Type Format library (runtime, BFD dependency)
ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour) ii libcurl3t64-gnutls:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (GnuTLS flavour)
ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour) ii libcurl4t64:amd64 8.5.0-2ubuntu10.6 amd64 easy-to-use client-side URL transfer library (OpenSSL flavour)
ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime] ii libdb5.3t64:amd64 5.3.28+dfsg2-7 amd64 Berkeley v5.3 Database Libraries [runtime]
ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library) ii libdebconfclient0:amd64 0.271ubuntu3 amd64 Debian Configuration Management System (C-implementation library)
ii libdebuginfod-common 0.190-1.1build4.1 all configuration to enable the Debian debug info server ii libdebuginfod-common 0.190-1.1ubuntu0.1 all configuration to enable the Debian debug info server
ii libdebuginfod1t64:amd64 0.190-1.1build4.1 amd64 library to interact with debuginfod (development files) ii libdebuginfod1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to interact with debuginfod (development files)
ii libdw1t64:amd64 0.190-1.1build4.1 amd64 library that provides access to the DWARF debug information ii libdw1t64:amd64 0.190-1.1ubuntu0.1 amd64 library that provides access to the DWARF debug information
ii libelf1t64:amd64 0.190-1.1build4.1 amd64 library to read and write ELF files ii libelf1t64:amd64 0.190-1.1ubuntu0.1 amd64 library to read and write ELF files
ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way ii liberror-perl 0.17029-2 all Perl module for error/exception handling in an OO-ish way
ii libexpat1:amd64 2.6.1-2ubuntu0.2 amd64 XML parsing C library - runtime library ii libexpat1:amd64 2.6.1-2ubuntu0.3 amd64 XML parsing C library - runtime library
ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries ii libext2fs2t64:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 ext2/ext3/ext4 file system libraries
ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime ii libffi8:amd64 3.4.6-1build1 amd64 Foreign Function Interface library runtime
ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files) ii libgcc-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GCC support library (development files)
@@ -150,13 +154,13 @@ ii libgcrypt20:amd64 1.10.3-2build1 amd64
ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version) ii libgdbm-compat4t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (legacy support runtime version)
ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version) ii libgdbm6t64:amd64 1.23-5.1build1 amd64 GNU dbm database routines (runtime version)
ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library ii libgit2-1.7:amd64 1.7.2+ds-1ubuntu3 amd64 low-level Git library
ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.2 amd64 GLib library of C routines ii libglib2.0-0t64:amd64 2.80.0-6ubuntu3.4 amd64 GLib library of C routines
ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library ii libgmp10:amd64 2:6.3.0+dfsg-2ubuntu6.1 amd64 Multiprecision arithmetic library
ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.3 amd64 GNU TLS library - main runtime library ii libgnutls30t64:amd64 3.8.3-1.1ubuntu3.4 amd64 GNU TLS library - main runtime library
ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library ii libgomp1:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC OpenMP (GOMP) support library
ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library ii libgpg-error0:amd64 1.47-3build2.1 amd64 GnuPG development runtime library
ii libgprofng0:amd64 2.42-4ubuntu2.4 amd64 GNU Next Generation profiler (runtime library) ii libgprofng0:amd64 2.42-4ubuntu2.5 amd64 GNU Next Generation profiler (runtime library)
ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.5 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism ii libgssapi-krb5-2:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - krb5 GSS-API Mechanism
ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis ii libhiredis1.1.0:amd64 1.2.0-6ubuntu3 amd64 minimalistic C client library for Redis
ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos) ii libhogweed6t64:amd64 3.9.1-2.2build1.1 amd64 low level cryptographic library (public-key cryptos)
ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C ii libhttp-parser2.9:amd64 2.9.4-6build1 amd64 parser for HTTP messages written in C
@@ -169,23 +173,23 @@ ii libipt2 2.0.6-1build1 amd64
ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints ii libisl23:amd64 0.26-3build1.1 amd64 manipulating sets and relations of integer points bounded by linear constraints
ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library ii libitm1:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Transactional Memory Library
ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data ii libjansson4:amd64 2.14-2build2 amd64 C library for encoding, decoding and manipulating JSON data
ii libjq1:amd64 1.7.1-3build1 amd64 lightweight and flexible command-line JSON processor - shared library ii libjq1:amd64 1.7.1-3ubuntu0.24.04.1 amd64 lightweight and flexible command-line JSON processor - shared library
ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++ ii libjsoncpp25:amd64 1.9.5-6build1 amd64 library for reading and writing JSON for C++
ii libk5crypto3:amd64 1.20.1-6ubuntu2.5 amd64 MIT Kerberos runtime libraries - Crypto Library ii libk5crypto3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Crypto Library
ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library) ii libkeyutils1:amd64 1.6.3-3build1 amd64 Linux Key Management Utilities (library)
ii libkrb5-3:amd64 1.20.1-6ubuntu2.5 amd64 MIT Kerberos runtime libraries ii libkrb5-3:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries
ii libkrb5support0:amd64 1.20.1-6ubuntu2.5 amd64 MIT Kerberos runtime libraries - Support library ii libkrb5support0:amd64 1.20.1-6ubuntu2.6 amd64 MIT Kerberos runtime libraries - Support library
ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries ii libldap2:amd64 2.6.7+dfsg-1~exp1ubuntu8.2 amd64 OpenLDAP libraries
ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime) ii liblsan0:amd64 14.2.0-4ubuntu2~24.04 amd64 LeakSanitizer -- a memory leak detector (runtime)
ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version ii libluajit-5.1-2:amd64 2.1.0+git20231223.c525bcb+dfsg-1 amd64 Just in time compiler for Lua - library version
ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files ii libluajit-5.1-common 2.1.0+git20231223.c525bcb+dfsg-1 all Just in time compiler for Lua - common files
ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime ii liblz4-1:amd64 1.9.4-1build1.1 amd64 Fast LZ compression algorithm library - runtime
ii liblzma5:amd64 5.6.1+really5.4.5-1build0.1 amd64 XZ-format compression library ii liblzma5:amd64 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression library
ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library ii liblzo2-2:amd64 2.10-2build4 amd64 data compression library
ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file) ii libmagic-mgc 1:5.45-3build1 amd64 File type determination library using "magic" numbers (compiled magic file)
ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library ii libmagic1t64:amd64 1:5.45-3build1 amd64 Recognize the type of data in a file using "magic" numbers - library
ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library ii libmd0:amd64 1.1.0-2build1.1 amd64 message digest functions from BSD systems - shared library
ii libmount1:amd64 2.39.3-9ubuntu6.2 amd64 device mounting library ii libmount1:amd64 2.39.3-9ubuntu6.3 amd64 device mounting library
ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library ii libmpc3:amd64 1.3.1-1build1.1 amd64 multiple precision complex floating-point library
ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation ii libmpfr6:amd64 4.2.1-1build1.1 amd64 multiple precision floating-point computation
ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library ii libmsgpackc2:amd64 4.0.0-3build1 amd64 binary-based efficient object serialization library
@@ -199,22 +203,22 @@ ii libnl-genl-3-200:amd64 3.7.0-0.3build1.1 amd64
ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads ii libnpth0t64:amd64 1.6-3.1build1 amd64 replacement for GNU Pth using system threads
ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library ii libonig5:amd64 6.9.9-1build1 amd64 regular expressions library
ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime ii libp11-kit0:amd64 0.25.3-4ubuntu2.1 amd64 library for loading and coordinating access to PKCS#11 modules - runtime
ii libpam-modules-bin 1.5.3-5ubuntu5.1 amd64 Pluggable Authentication Modules for PAM - helper binaries ii libpam-modules-bin 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM - helper binaries
ii libpam-modules:amd64 1.5.3-5ubuntu5.1 amd64 Pluggable Authentication Modules for PAM ii libpam-modules:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules for PAM
ii libpam-runtime 1.5.3-5ubuntu5.1 all Runtime support for the PAM library ii libpam-runtime 1.5.3-5ubuntu5.4 all Runtime support for the PAM library
ii libpam0g:amd64 1.5.3-5ubuntu5.1 amd64 Pluggable Authentication Modules library ii libpam0g:amd64 1.5.3-5ubuntu5.4 amd64 Pluggable Authentication Modules library
ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files ii libpcre2-32-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library - 32 bit runtime files
ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files ii libpcre2-8-0:amd64 10.42-4ubuntu2.1 amd64 New Perl Compatible Regular Expression Library- 8 bit runtime files
ii libperl5.38t64:amd64 5.38.2-3.2build2.1 amd64 shared Perl library ii libperl5.38t64:amd64 5.38.2-3.2ubuntu0.1 amd64 shared Perl library
ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library ii libpipeline1:amd64 1.5.7-2 amd64 Unix process pipeline manipulation library
ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters ii libpopt0:amd64 1.19+dfsg-1build1 amd64 lib for parsing cmdline parameters
ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc ii libproc2-0:amd64 2:4.0.4-4ubuntu3.2 amd64 library for accessing process information from /proc
ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries) ii libpsl5t64:amd64 0.21.2-1.1build1 amd64 Library for Public Suffix List (shared libraries)
ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7) ii libpython2.7-minimal:amd64 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version) ii libpython3-stdlib:amd64 3.12.3-0ubuntu2 amd64 interactive high-level object-oriented language (default python3 version)
ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.5 amd64 Minimal subset of the Python language (version 3.12) ii libpython3.12-minimal:amd64 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12)
ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.5 amd64 Interactive high-level object-oriented language (standard library, version 3.12) ii libpython3.12-stdlib:amd64 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (standard library, version 3.12)
ii libpython3.12t64:amd64 3.12.3-1ubuntu0.5 amd64 Shared Python runtime library (version 3.12) ii libpython3.12t64:amd64 3.12.3-1ubuntu0.7 amd64 Shared Python runtime library (version 3.12)
ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library ii libquadmath0:amd64 14.2.0-4ubuntu2~24.04 amd64 GCC Quad-Precision Math Library
ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries ii libreadline8t64:amd64 8.2-4build1 amd64 GNU readline and history libraries, run-time libraries
ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing ii librhash0:amd64 1.4.3-3build1 amd64 shared library for hash functions computing
@@ -228,19 +232,19 @@ ii libsemanage2:amd64 3.5-1build5 amd64
ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files ii libsensors-config 1:3.6.0-9build1 all lm-sensors configuration files
ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors ii libsensors5:amd64 1:3.6.0-9build1 amd64 library to read temperature/voltage/fan sensors
ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies ii libsepol2:amd64 3.5-2build1 amd64 SELinux library for manipulating binary security policies
ii libsframe1:amd64 2.42-4ubuntu2.4 amd64 Library to handle the SFrame format (runtime library) ii libsframe1:amd64 2.42-4ubuntu2.5 amd64 Library to handle the SFrame format (runtime library)
ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way ii libsigsegv2:amd64 2.14-1ubuntu2 amd64 Library for handling page faults in a portable way
ii libsmartcols1:amd64 2.39.3-9ubuntu6.2 amd64 smart column output alignment library ii libsmartcols1:amd64 2.39.3-9ubuntu6.3 amd64 smart column output alignment library
ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library ii libsource-highlight-common 3.1.9-4.3build1 all architecture-independent files for source highlighting library
ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library ii libsource-highlight4t64:amd64 3.1.9-4.3build1 amd64 source highlighting library
ii libsqlite3-0:amd64 3.45.1-1ubuntu2.1 amd64 SQLite 3 shared library ii libsqlite3-0:amd64 3.45.1-1ubuntu2.3 amd64 SQLite 3 shared library
ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library ii libss2:amd64 1.47.0-2.4~exp1ubuntu4.1 amd64 command-line interface parsing library
ii libssh-4:amd64 0.10.6-2build2 amd64 tiny C SSH library (OpenSSL flavor) ii libssh-4:amd64 0.10.6-2ubuntu0.1 amd64 tiny C SSH library (OpenSSL flavor)
ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library ii libssh2-1t64:amd64 1.11.0-4.1build2 amd64 SSH2 client-side library
ii libssl3t64:amd64 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - shared libraries ii libssl3t64:amd64 3.0.13-0ubuntu3.5 amd64 Secure Sockets Layer toolkit - shared libraries
ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files) ii libstdc++-13-dev:amd64 13.3.0-6ubuntu2~24.04 amd64 GNU Standard C++ Library v3 (development files)
ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3 ii libstdc++6:amd64 14.2.0-4ubuntu2~24.04 amd64 GNU Standard C++ Library v3
ii libsystemd0:amd64 255.4-1ubuntu8.5 amd64 systemd utility library ii libsystemd0:amd64 255.4-1ubuntu8.10 amd64 systemd utility library
ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator ii libtalloc2:amd64 2.4.2-1build2 amd64 hierarchical pool based memory allocator
ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime) ii libtasn1-6:amd64 4.19.0-3ubuntu0.24.04.1 amd64 Manage ASN.1 structures (runtime)
ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input ii libtermkey1:amd64 0.22-1 amd64 library for processing keyboard input
@@ -251,13 +255,13 @@ ii libtree-sitter0:amd64 0.20.8-2 amd64
ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime) ii libtsan2:amd64 14.2.0-4ubuntu2~24.04 amd64 ThreadSanitizer -- a Valgrind-based detector of data races (runtime)
ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime) ii libubsan1:amd64 14.2.0-4ubuntu2~24.04 amd64 UBSan -- undefined behaviour sanitizer (runtime)
ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library ii libuchardet0:amd64 0.0.8-1build1 amd64 universal charset detection library - shared library
ii libudev1:amd64 255.4-1ubuntu8.5 amd64 libudev shared library ii libudev1:amd64 255.4-1ubuntu8.10 amd64 libudev shared library
ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library ii libunibilium4:amd64 2.1.0-3 amd64 simple, self-contained terminfo library
ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C ii libunistring5:amd64 1.1-2build1.1 amd64 Unicode string library for C
ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime ii libunwind8:amd64 1.6.2-3build1.1 amd64 library to determine the call-chain of a program - runtime
ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library ii liburing2:amd64 2.5-1build1 amd64 Linux kernel io_uring access library - shared library
ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime) ii libutempter0:amd64 1.2.1-3build1 amd64 privileged helper for utmp/wtmp updates (runtime)
ii libuuid1:amd64 2.39.3-9ubuntu6.2 amd64 Universally Unique ID library ii libuuid1:amd64 2.39.3-9ubuntu6.3 amd64 Universally Unique ID library
ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library ii libuv1t64:amd64 1.48.0-1.1build1 amd64 asynchronous event notification library - runtime library
ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library ii libvterm0:amd64 0.3.3-2build1 amd64 abstract terminal library
ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library ii libwrap0:amd64 7.6.q-33 amd64 Wietse Venema's TCP wrappers library
@@ -276,12 +280,12 @@ ii libx32ubsan1 14.2.0-4ubuntu2~24.04 amd64
ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library ii libxau6:amd64 1:1.0.9-1build6 amd64 X11 authorisation library
ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding ii libxcb1:amd64 1.15-1ubuntu2 amd64 X C Binding
ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library ii libxdmcp6:amd64 1:1.1.3-0ubuntu6 amd64 X11 Display Manager Control Protocol library
ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.2 amd64 GNOME XML library ii libxml2:amd64 2.9.14+dfsg-1.3ubuntu3.3 amd64 GNOME XML library
ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash ii libxxhash0:amd64 0.8.2-2build1 amd64 shared library for xxhash
ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library ii libyaml-0-2:amd64 0.2.5-1build1 amd64 Fast YAML 1.1 parser and emitter library
ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files ii libzstd-dev:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm -- development files
ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm ii libzstd1:amd64 1.5.5+dfsg2-2build1.1 amd64 fast lossless compression algorithm
ii linux-libc-dev:amd64 6.8.0-55.57 amd64 Linux Kernel Headers for development ii linux-libc-dev:amd64 6.8.0-64.67 amd64 Linux Kernel Headers for development
ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools ii login 1:4.13+dfsg1-4ubuntu3.2 amd64 system login tools
ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file ii logsave 1.47.0-2.4~exp1ubuntu4.1 amd64 save the output of a command in a log file
ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation) ii lsb-release 12.0-2 all Linux Standard Base version reporting utility (minimal implementation)
@@ -297,7 +301,7 @@ ii media-types 10.1.0 all
ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package ii minify 2.20.17-1 amd64 CLI implementation of the Go minify library package
ii mksh 59c-37 amd64 MirBSD Korn Shell ii mksh 59c-37 amd64 MirBSD Korn Shell
ii moreutils 0.69-1 amd64 additional Unix utilities ii moreutils 0.69-1 amd64 additional Unix utilities
ii mount 2.39.3-9ubuntu6.2 amd64 tools for mounting and manipulating filesystems ii mount 2.39.3-9ubuntu6.3 amd64 tools for mounting and manipulating filesystems
ii musl:amd64 1.2.4-2 amd64 standard C library ii musl:amd64 1.2.4-2 amd64 standard C library
ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions ii ncurses-base 6.4+20240113-1ubuntu2 all basic terminal type definitions
ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages ii ncurses-bin 6.4+20240113-1ubuntu2 amd64 terminal-related programs and man pages
@@ -314,9 +318,9 @@ ii patch 2.7.6-7build3 amd64
ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables ii patchelf 0.18.0-1.1build1 amd64 modify properties of ELF executables
ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches ii patchutils 0.4.2-1build3 amd64 Utilities to work with patches
ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool ii pax-utils 1.3.7-1 amd64 Security-focused ELF files checking tool
ii perl 5.38.2-3.2build2.1 amd64 Larry Wall's Practical Extraction and Report Language ii perl 5.38.2-3.2ubuntu0.1 amd64 Larry Wall's Practical Extraction and Report Language
ii perl-base 5.38.2-3.2build2.1 amd64 minimal Perl system ii perl-base 5.38.2-3.2ubuntu0.1 amd64 minimal Perl system
ii perl-modules-5.38 5.38.2-3.2build2.1 all Core Perl modules ii perl-modules-5.38 5.38.2-3.2ubuntu0.1 all Core Perl modules
ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities ii procps 2:4.0.4-4ubuntu3.2 amd64 /proc file system utilities
ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users ii proot 5.1.0-1.3 amd64 emulate chroot, bind mount and binfmt_misc for non-root users
ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7) ii python2.7-minimal 2.7.18-8+deb11u1 amd64 Minimal subset of the Python language (version 2.7)
@@ -333,8 +337,8 @@ ii python3-tomli-w 1.0.0-2 all
ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3) ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3)
ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3 ii python3-yaml 6.0.1-2build2 amd64 YAML parser and emitter for Python3
ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library ii python3-zstd 1.5.5.1-1build1 amd64 python bindings to Yann Collet ZSTD compression library
ii python3.12 3.12.3-1ubuntu0.5 amd64 Interactive high-level object-oriented language (version 3.12) ii python3.12 3.12.3-1ubuntu0.7 amd64 Interactive high-level object-oriented language (version 3.12)
ii python3.12-minimal 3.12.3-1ubuntu0.5 amd64 Minimal subset of the Python language (version 3.12) ii python3.12-minimal 3.12.3-1ubuntu0.7 amd64 Minimal subset of the Python language (version 3.12)
ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust ii re2c 3.1-1build1 amd64 lexer generator for C, C++, Go and Rust
ii readline-common 8.2-4build1 all GNU readline and history libraries, common files ii readline-common 8.2-4build1 all GNU readline and history libraries, common files
ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern ii ripgrep 14.1.0-1 amd64 Recursively searches directories for a regex pattern
@@ -345,20 +349,20 @@ ii sed 4.9-2build1 amd64
ii sensible-utils 0.0.22 all Utilities for sensible alternative selection ii sensible-utils 0.0.22 all Utilities for sensible alternative selection
ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer ii socat 1.8.0.0-4build3 amd64 multipurpose relay for bidirectional data transfer
ii strace 6.8-0ubuntu2 amd64 System call tracer ii strace 6.8-0ubuntu2 amd64 System call tracer
ii sudo 1.9.15p5-3ubuntu5.24.04.1 amd64 Provide limited super user privileges to specific users
ii sysstat 12.6.1-2 amd64 system performance tools for Linux ii sysstat 12.6.1-2 amd64 system performance tools for Linux
ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities ii sysvinit-utils 3.08-6ubuntu3 amd64 System-V-like utilities
ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility ii tar 1.35+dfsg-3build1 amd64 GNU version of the tar archiving utility
ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage ii time 1.9-0.2build1 amd64 GNU time program for measuring CPU resource usage
ii tzdata 2024b-0ubuntu0.24.04.1 all time zone and daylight-saving time data ii tzdata 2025b-0ubuntu0.24.04.1 all time zone and daylight-saving time data
ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive ii ubuntu-keyring 2023.11.28.1 all GnuPG keys of the Ubuntu archive
ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files ii ucf 3.0043+nmu1 all Update Configuration File(s): preserve user changes to config files
ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions ii universal-ctags 5.9.20210829.0-1 amd64 build tag file indexes of source code definitions
ii unminimize 0.2.1 amd64 Un-minimize your minimial images or setup
ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files ii unzip 6.0-28ubuntu4.1 amd64 De-archiver for .zip files
ii util-linux 2.39.3-9ubuntu6.2 amd64 miscellaneous system utilities ii util-linux 2.39.3-9ubuntu6.3 amd64 miscellaneous system utilities
ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools ii valgrind 1:3.22.0-0ubuntu3 amd64 instrumentation framework for building dynamic analysis tools
ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web ii wget 1.21.4-1ubuntu4.1 amd64 retrieves files from the web
ii xz-utils 5.6.1+really5.4.5-1build0.1 amd64 XZ-format compression utilities ii xz-utils 5.6.1+really5.4.5-1ubuntu0.2 amd64 XZ-format compression utilities
ii yash 2.55-2 amd64 yet another shell ii yash 2.55-2 amd64 yet another shell
ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents ii yq 3.1.0-3 all Command-line YAML processor - jq wrapper for YAML documents
ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files ii zip 3.0-13ubuntu0.2 amd64 Archiver for .zip files
@@ -374,9 +378,10 @@ ii zstd 1.5.5+dfsg2-2build1.1 amd64
||/ Name Version Architecture Description ||/ Name Version Architecture Description
Packages sorted by Installed-Size: Packages sorted by Installed-Size:
971255 ===== TOTAL (368 packages) 1023146 ===== TOTAL (372 packages)
76943 valgrind amd64 76943 valgrind amd64
61333 gcc-13-x86-64-linux-gnu amd64 61333 gcc-13-x86-64-linux-gnu amd64
44381 gh amd64
36493 cmake amd64 36493 cmake amd64
35919 libicu74 amd64 35919 libicu74 amd64
33545 g++-13-x86-64-linux-gnu amd64 33545 g++-13-x86-64-linux-gnu amd64
@@ -396,21 +401,21 @@ Packages sorted by Installed-Size:
12004 libc6-x32 amd64 12004 libc6-x32 amd64
11989 libc6-i386 amd64 11989 libc6-i386 amd64
11549 binutils-x86-64-linux-gnu amd64 11549 binutils-x86-64-linux-gnu amd64
11182 libc6-dbg amd64 11172 libc6-dbg amd64
10984 cmake-data all 10984 cmake-data all
10791 libasan8 amd64 10791 libasan8 amd64
9704 libx32asan8 amd64 9704 libx32asan8 amd64
9539 lib32asan8 amd64 9539 lib32asan8 amd64
9017 libpython3.12-stdlib amd64 9022 libpython3.12-stdlib amd64
8917 libpython3.12t64 amd64 8924 libpython3.12t64 amd64
8902 libtsan2 amd64 8902 libtsan2 amd64
8335 libmagic-mgc amd64 8335 libmagic-mgc amd64
8296 lib32gcc-13-dev amd64 8296 lib32gcc-13-dev amd64
8119 libc6-dev-x32 amd64 8119 libc6-dev-x32 amd64
7924 python3.12-minimal amd64 7926 python3.12-minimal amd64
7913 perl-base amd64 7913 perl-base amd64
7531 libx32gcc-13-dev amd64 7531 libx32gcc-13-dev amd64
7359 linux-libc-dev amd64 7460 linux-libc-dev amd64
7226 lib32stdc++-13-dev amd64 7226 lib32stdc++-13-dev amd64
7059 libx32stdc++-13-dev amd64 7059 libx32stdc++-13-dev amd64
7024 direnv amd64 7024 direnv amd64
@@ -422,12 +427,12 @@ Packages sorted by Installed-Size:
6158 7zip amd64 6158 7zip amd64
5219 bat amd64 5219 bat amd64
5210 ripgrep amd64 5210 ripgrep amd64
5179 libpython3.12-minimal amd64 5180 libpython3.12-minimal amd64
4897 libhwasan0 amd64 4897 libhwasan0 amd64
4341 ncurses-term all 4341 ncurses-term all
4244 minify amd64 4244 minify amd64
4193 libglib2.0-0t64 amd64 4193 libglib2.0-0t64 amd64
4103 apt amd64 4108 apt amd64
4074 gojq amd64 4074 gojq amd64
3956 python3-pycryptodome amd64 3956 python3-pycryptodome amd64
3833 libgprofng0 amd64 3833 libgprofng0 amd64
@@ -435,6 +440,8 @@ Packages sorted by Installed-Size:
3738 fzf amd64 3738 fzf amd64
3721 groff-base amd64 3721 groff-base amd64
3605 python2.7-minimal amd64 3605 python2.7-minimal amd64
3568 just amd64
3468 sudo amd64
3443 fish amd64 3443 fish amd64
3441 re2c amd64 3441 re2c amd64
3438 util-linux amd64 3438 util-linux amd64
@@ -442,13 +449,13 @@ Packages sorted by Installed-Size:
3403 libaria2-0 amd64 3403 libaria2-0 amd64
3382 fd-find amd64 3382 fd-find amd64
3364 libubsan1 amd64 3364 libubsan1 amd64
3244 libapt-pkg6.0t64 amd64 3249 libapt-pkg6.0t64 amd64
3181 libx32ubsan1 amd64 3181 libx32ubsan1 amd64
3111 ksh93u+m amd64 3111 ksh93u+m amd64
3110 libstdc++6 amd64 3110 libstdc++6 amd64
3104 lib32ubsan1 amd64 3104 lib32ubsan1 amd64
2995 parallel all 2995 parallel all
2957 elfutils amd64 2958 elfutils amd64
2928 man-db amd64 2928 man-db amd64
2894 lib32stdc++6 amd64 2894 lib32stdc++6 amd64
2810 libx32stdc++6 amd64 2810 libx32stdc++6 amd64
@@ -456,10 +463,10 @@ Packages sorted by Installed-Size:
2431 zsh amd64 2431 zsh amd64
2419 passwd amd64 2419 passwd amd64
2352 libgnutls30t64 amd64 2352 libgnutls30t64 amd64
2346 libbinutils amd64 2350 libbinutils amd64
2191 ht amd64 2191 ht amd64
2183 libc-bin amd64 2183 libc-bin amd64
2163 git-man all 2162 git-man all
2103 strace amd64 2103 strace amd64
2079 libxml2 amd64 2079 libxml2 amd64
2032 libisl23 amd64 2032 libisl23 amd64
@@ -473,7 +480,7 @@ Packages sorted by Installed-Size:
1761 libdb5.3t64 amd64 1761 libdb5.3t64 amd64
1757 libunistring5 amd64 1757 libunistring5 amd64
1736 gawk amd64 1736 gawk amd64
1730 libsqlite3-0 amd64 1731 libsqlite3-0 amd64
1712 libp11-kit0 amd64 1712 libp11-kit0 amd64
1634 mksh amd64 1634 mksh amd64
1610 socat amd64 1610 socat amd64
@@ -484,7 +491,7 @@ Packages sorted by Installed-Size:
1452 sysstat amd64 1452 sysstat amd64
1448 yash amd64 1448 yash amd64
1396 libgcrypt20 amd64 1396 libgcrypt20 amd64
1382 tzdata all 1387 tzdata all
1362 libx11-6 amd64 1362 libx11-6 amd64
1342 libx11-data all 1342 libx11-data all
1322 zlib1g-dev amd64 1322 zlib1g-dev amd64
@@ -492,23 +499,23 @@ Packages sorted by Installed-Size:
1237 libzstd-dev amd64 1237 libzstd-dev amd64
1237 libgit2-1.7 amd64 1237 libgit2-1.7 amd64
1186 libmpfr6 amd64 1186 libmpfr6 amd64
1145 libpam-modules amd64 1150 libpam-modules amd64
1142 eza amd64 1142 eza amd64
1136 zoxide amd64 1136 zoxide amd64
1025 libsystemd0 amd64 1026 libsystemd0 amd64
1015 libkrb5-3 amd64 1015 libkrb5-3 amd64
996 screen amd64 996 screen amd64
925 libcurl4t64 amd64 925 libcurl4t64 amd64
916 wget amd64 916 wget amd64
906 libcurl3t64-gnutls amd64 906 libcurl3t64-gnutls amd64
904 libarchive13t64 amd64 905 libarchive13t64 amd64
884 login amd64 884 login amd64
852 busybox amd64 852 busybox amd64
843 libbrotli1 amd64 843 libbrotli1 amd64
812 lua-luv amd64 812 lua-luv amd64
785 musl amd64 785 musl amd64
781 rsync amd64 781 rsync amd64
765 libdw1t64 amd64 766 libdw1t64 amd64
761 libzstd1 amd64 761 libzstd1 amd64
751 libsepol2 amd64 751 libsepol2 amd64
745 libsource-highlight4t64 amd64 745 libsource-highlight4t64 amd64
@@ -534,7 +541,7 @@ Packages sorted by Installed-Size:
521 curl amd64 521 curl amd64
512 python3-yaml amd64 512 python3-yaml amd64
508 libbabeltrace1 amd64 508 libbabeltrace1 amd64
496 libssh-4 amd64 497 libssh-4 amd64
493 debconf all 493 debconf all
467 libreadline8t64 amd64 467 libreadline8t64 amd64
452 diffutils amd64 452 diffutils amd64
@@ -546,9 +553,9 @@ Packages sorted by Installed-Size:
415 libssh2-1t64 amd64 415 libssh2-1t64 amd64
404 make amd64 404 make amd64
389 python3-pyasn1 all 389 python3-pyasn1 all
388 libexpat1 amd64
386 ca-certificates all 386 ca-certificates all
384 ncurses-base all 384 ncurses-base all
384 libexpat1 amd64
379 liblzma5 amd64 379 liblzma5 amd64
375 unzip amd64 375 unzip amd64
373 libgomp1 amd64 373 libgomp1 amd64
@@ -566,7 +573,7 @@ Packages sorted by Installed-Size:
337 gpgv amd64 337 gpgv amd64
336 libncurses6 amd64 336 libncurses6 amd64
328 cpio amd64 328 cpio amd64
314 libudev1 amd64 315 libudev1 amd64
311 libx32quadmath0 amd64 311 libx32quadmath0 amd64
309 less amd64 309 less amd64
307 libctf-nobfd0 amd64 307 libctf-nobfd0 amd64
@@ -594,6 +601,7 @@ Packages sorted by Installed-Size:
232 libctf0 amd64 232 libctf0 amd64
231 moreutils amd64 231 moreutils amd64
230 librhash0 amd64 230 librhash0 amd64
228 dmidecode amd64
226 libcrypt1 amd64 226 libcrypt1 amd64
224 libidn2-0 amd64 224 libidn2-0 amd64
224 debianutils amd64 224 debianutils amd64
@@ -606,10 +614,10 @@ Packages sorted by Installed-Size:
209 libpam0g amd64 209 libpam0g amd64
207 libuchardet0 amd64 207 libuchardet0 amd64
206 proot amd64 206 proot amd64
204 libelf1t64 amd64
202 python3-pycurl amd64 202 python3-pycurl amd64
200 libselinux1 amd64 200 libselinux1 amd64
200 libnghttp2-14 amd64 200 libnghttp2-14 amd64
200 libelf1t64 amd64
199 execstack amd64 199 execstack amd64
198 libtree-sitter0 amd64 198 libtree-sitter0 amd64
197 libgcc-s1 amd64 197 libgcc-s1 amd64
@@ -648,6 +656,7 @@ Packages sorted by Installed-Size:
122 libtasn1-6 amd64 122 libtasn1-6 amd64
120 libpopt0 amd64 120 libpopt0 amd64
115 libitm1 amd64 115 libitm1 amd64
115 libapparmor1 amd64
113 gcc-13-base amd64 113 gcc-13-base amd64
112 jq amd64 112 jq amd64
112 gcc-14-base i386 112 gcc-14-base i386
@@ -682,14 +691,14 @@ Packages sorted by Installed-Size:
77 readline-common all 77 readline-common all
77 python3-toml all 77 python3-toml all
75 libsasl2-modules-db amd64 75 libsasl2-modules-db amd64
74 libasm1t64 amd64 75 libasm1t64 amd64
74 libacl1 amd64 74 libacl1 amd64
72 libffi8 amd64 72 libffi8 amd64
72 diffstat amd64 72 diffstat amd64
70 libdebuginfod1t64 amd64
69 yq all 69 yq all
69 libss2 amd64 69 libss2 amd64
69 liberror-perl all 69 liberror-perl all
69 libdebuginfod1t64 amd64
67 libpipeline1 amd64 67 libpipeline1 amd64
66 libhttp-parser2.9 amd64 66 libhttp-parser2.9 amd64
66 bzip3 amd64 66 bzip3 amd64
@@ -704,7 +713,7 @@ Packages sorted by Installed-Size:
53 libnl-genl-3-200 amd64 53 libnl-genl-3-200 amd64
51 logsave amd64 51 logsave amd64
51 libutempter0 amd64 51 libutempter0 amd64
50 libdebuginfod-common all 51 libdebuginfod-common all
49 libatomic1 amd64 49 libatomic1 amd64
48 libmsgpackc2 amd64 48 libmsgpackc2 amd64
47 python3-xmltodict all 47 python3-xmltodict all
@@ -734,7 +743,6 @@ Packages sorted by Installed-Size:
20 cpp-x86-64-linux-gnu amd64 20 cpp-x86-64-linux-gnu amd64
17 lsb-release all 17 lsb-release all
17 libaudit-common all 17 libaudit-common all
16 unminimize amd64
13 g++ amd64 13 g++ amd64
11 g++-x86-64-linux-gnu amd64 11 g++-x86-64-linux-gnu amd64
11 cpp-13 amd64 11 cpp-13 amd64
+1 -1
View File
@@ -14,7 +14,7 @@ __add_cmake_config() {
} }
# pass common CMake settings # pass common CMake settings
for v in CMAKE_VERBOSE_MAKEFILE; do for v in CMAKE_INSTALL_PREFIX CMAKE_VERBOSE_MAKEFILE; do
__add_cmake_config $v __add_cmake_config $v
done done
# pass common CMake toolchain settings # pass common CMake toolchain settings
+1 -1
View File
@@ -29,6 +29,6 @@ fi
# limit memory usage to 1 GiB (in case of clang-format problems with invalid files) # limit memory usage to 1 GiB (in case of clang-format problems with invalid files)
ulimit -v 1048576 || true ulimit -v 1048576 || true
#echo $UPX_CLANG_FORMAT #echo "$UPX_CLANG_FORMAT"
exec "$UPX_CLANG_FORMAT" -style=file "$@" exec "$UPX_CLANG_FORMAT" -style=file "$@"
exit 99 exit 99
+27 -11
View File
@@ -16,6 +16,12 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind") # $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
# #
# Debugging aid for locating failing commands. Depends on 'bash' shell.
# (BASH_LINENO is relative to current FUNCTION only; non-function ==> 0)
# Notice single-quoting of entire first argument.
trap 'echo ERROR: pwd=\"$PWD\" file=\"$BASH_SOURCE\" line=${BASH_LINENO[0]} cmd=\"$BASH_COMMAND\"' ERR
# Example: "false a b c" ==> ERROR: pwd="path/misc/testsuite" file="./mimic_ctest.sh" line=0 cmd="false a b c"
#*********************************************************************** #***********************************************************************
# init & checks # init & checks
#*********************************************************************** #***********************************************************************
@@ -148,17 +154,27 @@ if [[ $UPX_CONFIG_DISABLE_EXHAUSTIVE_TESTS != ON ]]; then
set +x set +x
for method in nrv2b nrv2d nrv2e lzma; do for method in nrv2b nrv2d nrv2e lzma; do
for level in 1 2 3 4 5 6 7; do for level in 1 2 3 4 5 6 7; do
s="${method}-${level}" for small in normal small; do
echo "========== $s ==========" s="${method}-${level}"
"${run_upx[@]}" -qq --${method} -${level} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe} ss=
"${run_upx[@]}" -qq -l upx-packed-${s}${exe} if [[ $small == "small" ]]; then
"${run_upx[@]}" -qq --fileinfo upx-packed-${s}${exe} s="${method}-${level}-${small}"
"${run_upx[@]}" -qq -t upx-packed-${s}${exe} ss="--small"
"${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe} fi
cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe} echo "========== $s =========="
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then "${run_upx[@]}" -qq --${method} -${level} ${ss} --all-filters --debug-use-random-filter "${upx_self_exe}" ${fo} -o upx-packed-${s}${exe}
"${emu[@]}" ./upx-packed-${s}${exe} --version-short "${run_upx[@]}" -qq -l upx-packed-${s}${exe}
fi "${run_upx[@]}" -qq --fileinfo upx-packed-${s}${exe}
"${run_upx[@]}" -qq -t upx-packed-${s}${exe}
"${run_upx[@]}" -qq -d upx-packed-${s}${exe} ${fo} -o upx-unpacked-${s}${exe}
cmp -s upx-unpacked${exe} upx-unpacked-${s}${exe}
if [[ $UPX_CONFIG_DISABLE_RUN_PACKED_TEST != ON ]]; then
: ${upx_run_packed_test_count:=20}
for ((i = 0; i < $upx_run_packed_test_count; i++)); do
"${emu[@]}" ./upx-packed-${s}${exe} --version-short
done
fi
done
done done
done done
fi fi
+46
View File
@@ -0,0 +1,46 @@
#! /usr/bin/env bash
## vim:set ts=4 sw=4 et:
set -e; set -o pipefail
argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs")
#
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
#
# mimic running "ctest", i.e. the "test" section of CMakeLists.txt
# - does not redirect stdout
# - allows freely setting $upx_exe_runner, while CMake is restricted to configure-time settings
#
# requires:
# $upx_exe (required, but with convenience fallback "./upx")
# optional settings:
# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Nehalem" or "valgrind")
#
cat >catch-sigsegv.gdb <<'EOF'
catch signal SIGSEGV
commands
x/i $pc
info reg
x/32i $pc-0x20
quit 77
end
EOF
catcher=$(readlink -fn catch-sigsegv.gdb)
function emu_gdb() {
gdb -q -x "$catcher" <<EOF --args "$@"
run
EOF
}
if [[ -n $upx_exe_runner ]]; then
true
elif [[ -n $CMAKE_CROSSCOMPILING_EMULATOR ]]; then
true
else
upx_exe_runner=emu_gdb
: ${upx_run_packed_test_count:=20}
fi
source "$argv0dir/mimic_ctest.sh"
+49 -49
View File
@@ -46,14 +46,14 @@ b8c35fa2956da17ca505956e9f5017bb5f3a746322647e24ccb8ff28059cafa4 *powerpc-linux.
a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95 a0950546dc17fca9437219431d8ddb0249ce5b08e899e0c799a87ac982adee70 *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\ expected_sha256sums__t110_compress_ucl_nrv2b_3_no_filter="\
919f31ec6a70a81159f4fc1d3cd4e9d66800a242df2fac9e339a36e1bf648091 *amd64-linux.elf/upx-3.91 836d9c5d9092421e49aeb573cde449ef740afbfea54d131ccbd88d8c7d87860d *amd64-linux.elf/upx-3.91
548e950c9f082eb0eb42b18411bbc257365cfc9c937ab20f501ebf0db5850d25 *amd64-linux.elf/upx-3.95 9776a2d030719f9d74413d17c1bb732aaabb610b341031facd2c1a75348fc661 *amd64-linux.elf/upx-3.95
822718cc0f6ac5e57bb23eeb65be6f3f7e73df8b062853abddcc924ec8207596 *amd64-win64.pe/upx-3.95.exe 822718cc0f6ac5e57bb23eeb65be6f3f7e73df8b062853abddcc924ec8207596 *amd64-win64.pe/upx-3.95.exe
4d8b2a8f29b38e097287e550d11810d7ecd4c5f07744545b3a315de908987bf6 *arm-linux.elf/upx-3.95 40353c37020fd4bb713c5d54273b8dc07666e262b83a4f0652ccb8a236465f9c *arm-linux.elf/upx-3.95
1440d6b44968954baf56fbc2a0739a51873455876114d4445ae4b67cb5e7893b *arm-wince.pe/upx-3.91.exe 1440d6b44968954baf56fbc2a0739a51873455876114d4445ae4b67cb5e7893b *arm-wince.pe/upx-3.91.exe
04c08626d4b03a4e969018eed7093c24de191b5d27db2a25221b134827806929 *arm64-linux.elf/upx-3.95 35c08bf5086fe21ff19e3512359e54ac97c6d4513e6bb9ef4a59294bebf18f6a *arm64-linux.elf/upx-3.95
6c8b276a0b611402d336b43cf8514b9a8d98be4f55a8301e784b7b88031b2b85 *armeb-linux.elf/upx-3.91 0ca2dcd9e8b5c3f16dcb31e30b42ec57a70b8fe90281d412081095a3d7812f01 *armeb-linux.elf/upx-3.91
dcd0c0060d44886966ae4e97b79a2c172f02d56228ea76dbc5c880ad59ef4ee5 *armeb-linux.elf/upx-3.95 462a72efbb580a2e90564412737bb3c1db1d930cde5b4f2c94782df91c8e4f4b *armeb-linux.elf/upx-3.95
a7ee051c5f9dcf233e2ee248274121b99fb8f098eff95469bc0638a7423723f0 *i386-dos32.djgpp2.coff/upx-3.91.exe a7ee051c5f9dcf233e2ee248274121b99fb8f098eff95469bc0638a7423723f0 *i386-dos32.djgpp2.coff/upx-3.91.exe
85cf31be166cb59587a99419cdd0fc5a79825d7508ab2c9a4bc0d700d603354d *i386-dos32.djgpp2.coff/upx-3.95.exe 85cf31be166cb59587a99419cdd0fc5a79825d7508ab2c9a4bc0d700d603354d *i386-dos32.djgpp2.coff/upx-3.95.exe
fc7656d9a877967be7e339bfc98a0c63ea7b5abc30b96fa9e5931c75ecbe9827 *i386-linux.elf/upx-3.91 fc7656d9a877967be7e339bfc98a0c63ea7b5abc30b96fa9e5931c75ecbe9827 *i386-linux.elf/upx-3.91
@@ -66,17 +66,17 @@ f60bab42fe3914109ab1b9f5d00a5be753cd0a2c1a79a3998d58800efedbfff7 *mipsel-linux.e
b6d8cc9e2023a3fc415166afc378ccf2eb505487df84c8d959ec74b3fb4f8256 *mipsel-linux.elf/upx-3.95 b6d8cc9e2023a3fc415166afc378ccf2eb505487df84c8d959ec74b3fb4f8256 *mipsel-linux.elf/upx-3.95
acd3dc5ed3e4c4eeaa42e7cca71a79d687dd844ce5f384666ed6e78327b5a8e3 *powerpc-linux.elf/upx-3.91 acd3dc5ed3e4c4eeaa42e7cca71a79d687dd844ce5f384666ed6e78327b5a8e3 *powerpc-linux.elf/upx-3.91
03600584c97fa466ef58239452baf9ec6ff2f06b79d97d45c8490953080de6e3 *powerpc-linux.elf/upx-3.95 03600584c97fa466ef58239452baf9ec6ff2f06b79d97d45c8490953080de6e3 *powerpc-linux.elf/upx-3.95
2aa45e314e83a7ecc548a5116048a981755d00c3e102bd9a9fc6e9a2356047be *powerpc64le-linux.elf/upx-3.95 3f02885d1e94e59062eb78c4c910cde042475a6cadb77a85a603de747a50f45c *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\ expected_sha256sums__t120_compress_ucl_nrv2d_3_no_filter="\
c5bafac11df5a38c1b72fd070373a0e1d5a066527129937c5bc9a280e21ad656 *amd64-linux.elf/upx-3.91 8431343adec632690cec669038c246438c799e7dc1b8bc85586e0d2bcd2eebad *amd64-linux.elf/upx-3.91
6cc1e01ac0b6140464a06f5aefb51c0388fdfe28f264a38061b50b3508203c07 *amd64-linux.elf/upx-3.95 1852bded40be6eb5ddb07a491476dcfcca69cadda45a5f128aa8f967d567fa0b *amd64-linux.elf/upx-3.95
5ab022e2c3ecb09931e2181fb5f7699f35e2b453b54c823e42653c84b0df5f2c *amd64-win64.pe/upx-3.95.exe 5ab022e2c3ecb09931e2181fb5f7699f35e2b453b54c823e42653c84b0df5f2c *amd64-win64.pe/upx-3.95.exe
e21b2305df2c1896eeae61010c3b65d8a50d476ea4a9bab6ec2fa4f9a0bed5a6 *arm-linux.elf/upx-3.95 6de0cf1903760710a95cb5330d0ffb406a93f081dbe6806935f51b0c75e23f03 *arm-linux.elf/upx-3.95
53121baf42c85991900aa3947f3d817fe6e894bc6f325ab1d576de6fba5fbcbf *arm-wince.pe/upx-3.91.exe 53121baf42c85991900aa3947f3d817fe6e894bc6f325ab1d576de6fba5fbcbf *arm-wince.pe/upx-3.91.exe
7431abc46f0960311364ecd690965dd1fc74b2de4baca8e0af8f966735b6372e *arm64-linux.elf/upx-3.95 3c9e49445280de6a771e77f6a88b3c3957815baa193e92a893d5defe6699f50a *arm64-linux.elf/upx-3.95
8b67fc95dc555c2de4e3d0c85e4ab977f4c3fba24d68a2f9c402c51e08ad5f3b *armeb-linux.elf/upx-3.91 627a3c77adfcd4ef8c32f1638a6b99e20e79bb914cbcebed6fb9ad5f96936530 *armeb-linux.elf/upx-3.91
c3b3e5b0a379022b26bae96432c3f5f946990f45b0b26afe056afe1170bf33c7 *armeb-linux.elf/upx-3.95 7faf9f0adf508cf29bf0ac2a62234df06d6c9153d6d59cf61019361db906daf8 *armeb-linux.elf/upx-3.95
51e4faea51e12c7442b27bb50150f532ac51d8102f77a669cbce82f2675a2ef2 *i386-dos32.djgpp2.coff/upx-3.91.exe 51e4faea51e12c7442b27bb50150f532ac51d8102f77a669cbce82f2675a2ef2 *i386-dos32.djgpp2.coff/upx-3.91.exe
1196f578ab0b862bae8ac6b5166b770f072cf0ac521a2a23a6347c19ea82a0da *i386-dos32.djgpp2.coff/upx-3.95.exe 1196f578ab0b862bae8ac6b5166b770f072cf0ac521a2a23a6347c19ea82a0da *i386-dos32.djgpp2.coff/upx-3.95.exe
3015651261f28fb43ed43a8c1fa257bcfcdc788e6fd3f436f3de23733736c724 *i386-linux.elf/upx-3.91 3015651261f28fb43ed43a8c1fa257bcfcdc788e6fd3f436f3de23733736c724 *i386-linux.elf/upx-3.91
@@ -89,17 +89,17 @@ c3b3e5b0a379022b26bae96432c3f5f946990f45b0b26afe056afe1170bf33c7 *armeb-linux.el
b78d8cd3a3402fed266c737cc34a32cc21b2b67b573e9e9071d4faf9fca89b89 *mipsel-linux.elf/upx-3.95 b78d8cd3a3402fed266c737cc34a32cc21b2b67b573e9e9071d4faf9fca89b89 *mipsel-linux.elf/upx-3.95
ea9cae1d1701db3a0c53e9a651766db5bdc30032f48913a4a9e99f193a800acc *powerpc-linux.elf/upx-3.91 ea9cae1d1701db3a0c53e9a651766db5bdc30032f48913a4a9e99f193a800acc *powerpc-linux.elf/upx-3.91
aea86bf87870a1e48a454ac1ea9a80d90d8abe5113d418a71d8a9c4a74bb2d0a *powerpc-linux.elf/upx-3.95 aea86bf87870a1e48a454ac1ea9a80d90d8abe5113d418a71d8a9c4a74bb2d0a *powerpc-linux.elf/upx-3.95
4b0c280570213f2cd94dad68aa8251baf05f817b4a569dda9444ff0d3adbb33d *powerpc64le-linux.elf/upx-3.95 62038c87489dc5cd3772e8e4051cf1d416edecf267d37f390a649f4ae657e0f9 *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\ expected_sha256sums__t130_compress_ucl_nrv2e_3_no_filter="\
509bc9676a0f5f5ce6df118da8e792151db816fcce5490eadc87fc525aad5a35 *amd64-linux.elf/upx-3.91 f817034e8b7765d8b422dac9cb6f24f78ce5bfd7169cd3b33e8224e00b131eca *amd64-linux.elf/upx-3.91
e8d6bf8204c6bf5d170ca8d4c9cb48b3b7a48b04d665dd6e111980081fcba3b3 *amd64-linux.elf/upx-3.95 d21441a05514c085c10e99b00d8cc4d45484297a8e4e8a246364ca4347d0ed56 *amd64-linux.elf/upx-3.95
7bd7cd37093200fa94d21dd7fdfef4d7fb9c3049fbf5f408f1f242cb8d9c6a55 *amd64-win64.pe/upx-3.95.exe 7bd7cd37093200fa94d21dd7fdfef4d7fb9c3049fbf5f408f1f242cb8d9c6a55 *amd64-win64.pe/upx-3.95.exe
4424d813ae55bec589779461c4d4b25361a58ea91659f4a12a7a2d08158cea64 *arm-linux.elf/upx-3.95 d328a89b333d0b36e96d0c61375bf686e8f3b73a188dd4d0df4d78e30af08632 *arm-linux.elf/upx-3.95
ad0a7a18e87657d28260b7c527d284863becd3c5f92259c570125465f88d4042 *arm-wince.pe/upx-3.91.exe ad0a7a18e87657d28260b7c527d284863becd3c5f92259c570125465f88d4042 *arm-wince.pe/upx-3.91.exe
0bbeb73af475bc852313074a14360ae863364175d7fbd4c2f3450790bc3a58ee *arm64-linux.elf/upx-3.95 0b700f0f7dde3118694155e876e6c2003ef701fe94856d6562936ec081278747 *arm64-linux.elf/upx-3.95
7da4a04118f50824821c00f4f9abf6056128ac33de6ac45a145fb5d4810850d9 *armeb-linux.elf/upx-3.91 53a1d04fa62e25e64e6f792b079e21b4c42676a73503ae6d9e67ae16c98e6d04 *armeb-linux.elf/upx-3.91
b4191959889ecb2b9bd2dd046318b414ab5a8268517572017466fbc9c986925e *armeb-linux.elf/upx-3.95 33ed1e3b84836d2af52295ba0b90343ac0b8d524539ce3b8d0aa9f19a51d70dd *armeb-linux.elf/upx-3.95
6fcdc8e34ce8b3501db2260c8a921c6e963954fdeffedfefca353a27bcc02d56 *i386-dos32.djgpp2.coff/upx-3.91.exe 6fcdc8e34ce8b3501db2260c8a921c6e963954fdeffedfefca353a27bcc02d56 *i386-dos32.djgpp2.coff/upx-3.91.exe
6f4f901c1838252f9b3104060475a6f13a2ebec830096ff28d870148580e4287 *i386-dos32.djgpp2.coff/upx-3.95.exe 6f4f901c1838252f9b3104060475a6f13a2ebec830096ff28d870148580e4287 *i386-dos32.djgpp2.coff/upx-3.95.exe
8127f8380300508e8062e9391e321abd0429a6a31fec41e769cc7fe80af27e27 *i386-linux.elf/upx-3.91 8127f8380300508e8062e9391e321abd0429a6a31fec41e769cc7fe80af27e27 *i386-linux.elf/upx-3.91
@@ -112,17 +112,17 @@ cd9b3d3780a79cb416b261d622e8e86f2369fa8bb9bc49b529c50cac2980d528 *mipsel-linux.e
5baf7db9e4335c0227106262efc9d18ad23b88c6d6bb636656aea67bb063b6ec *mipsel-linux.elf/upx-3.95 5baf7db9e4335c0227106262efc9d18ad23b88c6d6bb636656aea67bb063b6ec *mipsel-linux.elf/upx-3.95
aba8bd826ee52d533f9e1c4270d4f4194fe8d8747ea10a1d3ce59b6443f1a9f2 *powerpc-linux.elf/upx-3.91 aba8bd826ee52d533f9e1c4270d4f4194fe8d8747ea10a1d3ce59b6443f1a9f2 *powerpc-linux.elf/upx-3.91
6f737ccbf8c830476bed9c4dd33dd7757ea25bf2f8fb03b44d03e9b77ada0f1b *powerpc-linux.elf/upx-3.95 6f737ccbf8c830476bed9c4dd33dd7757ea25bf2f8fb03b44d03e9b77ada0f1b *powerpc-linux.elf/upx-3.95
91ee0982626eec07e524523d54873790b183aca5bdb27255771fcbfbc081cbc3 *powerpc64le-linux.elf/upx-3.95 d313dd128a54189b9551a529b1ed21b222aa0394a30f9ba552cde96edcd4011e *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t140_compress_lzma_2_no_filter="\ expected_sha256sums__t140_compress_lzma_2_no_filter="\
ed2849169a873bb4070e9d878126f7bc19fb326d1dc6e169901ff3a3026661c3 *amd64-linux.elf/upx-3.91 fefac6fbd1e95479eb4066519f9bd801a30c29966685840b6a011e2911b984ca *amd64-linux.elf/upx-3.91
2b7f9baf27490274fe9301e8a962ac2bae03da0afec67c17df8f8f0e27157891 *amd64-linux.elf/upx-3.95 64487a0e0aade092a8ff7e6d8d9528ca550540cac8d432005ba610179782d042 *amd64-linux.elf/upx-3.95
a55ec5a7f2911f6da8b9336daf4f1051e753cfb7a4458c7f7baa6b63340c6daf *amd64-win64.pe/upx-3.95.exe a55ec5a7f2911f6da8b9336daf4f1051e753cfb7a4458c7f7baa6b63340c6daf *amd64-win64.pe/upx-3.95.exe
8765db7ae04a03af743ad8afc586b943b84b65aca9f1ec240232daa2161ba703 *arm-linux.elf/upx-3.95 9f405739b904bb85053b75187c9175e4ac7f66a07ac5e320eaa4e9771e1ec79e *arm-linux.elf/upx-3.95
7a6c603eecf214e5d6742f1fce922223c97c8bd2527678a968640dd6c1bc0d71 *arm-wince.pe/upx-3.91.exe 7a6c603eecf214e5d6742f1fce922223c97c8bd2527678a968640dd6c1bc0d71 *arm-wince.pe/upx-3.91.exe
810aa1e8f15d9617a0fac4bc4e5c5c5219fc44125d41ced661c744d6c5bb9857 *arm64-linux.elf/upx-3.95 c8435e2f82ba72a0b6abad4146539d40d495461c5e480af705b2bbd21d192128 *arm64-linux.elf/upx-3.95
1dbb05c09fb972c3a5f87ace0c802af48f8b20f7f977f5a14b91dad59800d6a6 *armeb-linux.elf/upx-3.91 21fc48eaaedc73fe9239159fb864c6149f729ef1661a8407b88ad9c9a19f9a54 *armeb-linux.elf/upx-3.91
a1fba814639540616175e0c058267e96f839d85a187b01af764af14ae1b6019c *armeb-linux.elf/upx-3.95 742db587dc53f616c7b276a930c3f586da2b7c3ce6ccd523c041e88a9671b99b *armeb-linux.elf/upx-3.95
7a8eaa5139b95cc56591200fce62d3c9af163671467952cab6fcf487318107bb *i386-dos32.djgpp2.coff/upx-3.91.exe 7a8eaa5139b95cc56591200fce62d3c9af163671467952cab6fcf487318107bb *i386-dos32.djgpp2.coff/upx-3.91.exe
9b5fc0f54a5f811bda190c36fb2fa5c5b03c6c3de0c62693e4191230b5a419b8 *i386-dos32.djgpp2.coff/upx-3.95.exe 9b5fc0f54a5f811bda190c36fb2fa5c5b03c6c3de0c62693e4191230b5a419b8 *i386-dos32.djgpp2.coff/upx-3.95.exe
68b4ce63cb0bd7dd5b287e1f9fa5d9bc234ac36359ce3ebff863984c503a698e *i386-linux.elf/upx-3.91 68b4ce63cb0bd7dd5b287e1f9fa5d9bc234ac36359ce3ebff863984c503a698e *i386-linux.elf/upx-3.91
@@ -135,17 +135,17 @@ e268c98fdacfd04268d76644f2bb4746ae04b57801407aaa1867798840eeeea0 *m68k-atari.tos
339d38602413d97d9bba113f39884815af10ebcdccf37e3f5e8d0879f262a048 *mipsel-linux.elf/upx-3.95 339d38602413d97d9bba113f39884815af10ebcdccf37e3f5e8d0879f262a048 *mipsel-linux.elf/upx-3.95
6d4f9d4383ebc9d8411d06a7c219dcf3e8513ea8c989f2d31ab382602f873ba5 *powerpc-linux.elf/upx-3.91 6d4f9d4383ebc9d8411d06a7c219dcf3e8513ea8c989f2d31ab382602f873ba5 *powerpc-linux.elf/upx-3.91
5dd727d8d5a35cc0ab86d629285d8ff450f52b538118679edaa886ce9c1fed7d *powerpc-linux.elf/upx-3.95 5dd727d8d5a35cc0ab86d629285d8ff450f52b538118679edaa886ce9c1fed7d *powerpc-linux.elf/upx-3.95
d915a3326dda439c0e30df2bd7abf9856a5b5e039142c4ea74e72cb43c854160 *powerpc64le-linux.elf/upx-3.95 efec1e5bbb9bcf11dbc7081adfc2020de18fae326ad86194551c44fba0d2148d *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t150_compress_ucl_2_all_filters="\ expected_sha256sums__t150_compress_ucl_2_all_filters="\
fc30606d37c697f5c79742bf6e7d2afa8503e69fc87e52274d00b5210d03157a *amd64-linux.elf/upx-3.91 05b29bde32af1e63e837e2be499567c4b10d7e692c88082f24e3417e0c7b9f40 *amd64-linux.elf/upx-3.91
c6d66f6d4f92812801c021a854fbd94745a7b63e0477678b8eb1dc26c5b0a9a4 *amd64-linux.elf/upx-3.95 65c142ee01af09fa8741932c1f21d466be971aad059cc5afddbb7ecdf142c1bb *amd64-linux.elf/upx-3.95
cbb5c90bd9195bd9e3acd931312a70deeccfab5540f398ceda8826f8d6b332bf *amd64-win64.pe/upx-3.95.exe cbb5c90bd9195bd9e3acd931312a70deeccfab5540f398ceda8826f8d6b332bf *amd64-win64.pe/upx-3.95.exe
bb88759de778b1099b51a012f915e646ebfddcbd2fb26b3a1e760fc81a41d2b9 *arm-linux.elf/upx-3.95 1ea1bb18c0ac85c07450f0a6704b84e58a1322556757e2943340ef381b2ce675 *arm-linux.elf/upx-3.95
76a5f0518fc797bd3f132ce6eb61ca187b5d463f191417883a73d4584716c23a *arm-wince.pe/upx-3.91.exe 76a5f0518fc797bd3f132ce6eb61ca187b5d463f191417883a73d4584716c23a *arm-wince.pe/upx-3.91.exe
7b9290c2ab01632d8baa28b24498fbcd734caf8e3846864bb62a8282de3ffd9a *arm64-linux.elf/upx-3.95 4df30002376a4f18029ea9dd8260d395bec3a3fa11fbc5aa19859c2f0efdc2e6 *arm64-linux.elf/upx-3.95
0bafd7837327b590b3be06676ee73c52405e5e4a36a6d06f8b6773e93c499420 *armeb-linux.elf/upx-3.91 ba03fd4889210435c9673f2dcbd2269162037090eccc79cf7d2b896e64a57e2e *armeb-linux.elf/upx-3.91
aea39071ff8ce0b2a59f30e50603ef2ec39789693a3dd9baa4e6be1e49b4e068 *armeb-linux.elf/upx-3.95 681f32d01c76ff31776b8d6f1556daa38eee297f675aa40ff1bb2e47e12adf15 *armeb-linux.elf/upx-3.95
aa05c3a2953f0f2d70842cba45786b707a79ffef22fd084f51e304762cc67765 *i386-dos32.djgpp2.coff/upx-3.91.exe aa05c3a2953f0f2d70842cba45786b707a79ffef22fd084f51e304762cc67765 *i386-dos32.djgpp2.coff/upx-3.91.exe
c677241e9a8753ba1332ac3875ab6398fb2d792d2627edd9e58f2535b3131abe *i386-dos32.djgpp2.coff/upx-3.95.exe c677241e9a8753ba1332ac3875ab6398fb2d792d2627edd9e58f2535b3131abe *i386-dos32.djgpp2.coff/upx-3.95.exe
7bcd42f58dcc8ddb6cb1a4e33d56b584fe6d49b002b01a0859571d1324dd593a *i386-linux.elf/upx-3.91 7bcd42f58dcc8ddb6cb1a4e33d56b584fe6d49b002b01a0859571d1324dd593a *i386-linux.elf/upx-3.91
@@ -158,17 +158,17 @@ c5107a84d32de820c81401259a7dd23435ea625588d56c6c75ad6fa14b0dbf8b *mips-linux.elf
fd9ea397a29b41a2143f9e02217e181d0075d7ad7d87bdbadc7fc94bfb1b0d76 *mipsel-linux.elf/upx-3.95 fd9ea397a29b41a2143f9e02217e181d0075d7ad7d87bdbadc7fc94bfb1b0d76 *mipsel-linux.elf/upx-3.95
c47d1299f6ecf86e62528fc54979117b2b2ddbb6c80f553689402399fc7eab28 *powerpc-linux.elf/upx-3.91 c47d1299f6ecf86e62528fc54979117b2b2ddbb6c80f553689402399fc7eab28 *powerpc-linux.elf/upx-3.91
77c3b4ba6909a4e20180bc13775e280086d67240519c323c2005f3fcee6e0b78 *powerpc-linux.elf/upx-3.95 77c3b4ba6909a4e20180bc13775e280086d67240519c323c2005f3fcee6e0b78 *powerpc-linux.elf/upx-3.95
9741ba142aa8f9fb554dbab3a0295b1aa58e5f246274e2831583d8f99af59764 *powerpc64le-linux.elf/upx-3.95 e3ce51b863905a4831958c72541b04e9f893f0d9827f32e615822db7aebd56bc *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t160_compress_all_methods_1_no_filter="\ expected_sha256sums__t160_compress_all_methods_1_no_filter="\
115046275f6bccbaa34b7aefbedeba8741aba4e4876340a3d7363bae86ee4209 *amd64-linux.elf/upx-3.91 94c91b97fcce7402a4494b22699b2450e8e4e2a9f4ddd66e1133c76ce198c167 *amd64-linux.elf/upx-3.91
a8394890b5d731258316b520da2a5e4b43902742d237536fb7fbc578c6197fbb *amd64-linux.elf/upx-3.95 5b3e85adb37919d051c6eaff205b8e1d77a2dfde0d8e7dcdee7c22f8fd5dc8c7 *amd64-linux.elf/upx-3.95
5a0ecb45658904bcd0b823b77dba039c9814e2eff4ed429784c36b7074b9858c *amd64-win64.pe/upx-3.95.exe 5a0ecb45658904bcd0b823b77dba039c9814e2eff4ed429784c36b7074b9858c *amd64-win64.pe/upx-3.95.exe
0976be6c56de1ac2314d8a4962ae3d9d7be962847600db5e2bab529ab32cebd6 *arm-linux.elf/upx-3.95 de93a219ca3c4ea84bd9c1b5fb37ff4aaa0a08ea6eac18da6d7a5865e4dad19c *arm-linux.elf/upx-3.95
fdbe0395ac401285edb9c2f9bfbb0fbd3c0eaad5052a88d8369b1a66b35a8a3e *arm-wince.pe/upx-3.91.exe fdbe0395ac401285edb9c2f9bfbb0fbd3c0eaad5052a88d8369b1a66b35a8a3e *arm-wince.pe/upx-3.91.exe
1c8d536870d0244bb12cb8fdd6cd35ad7e9a53bbc4aa8e2e12af72447caaf467 *arm64-linux.elf/upx-3.95 acdb7ff90d7c6f403872ec333e2987ee74e99d6e1390863b321b528d312c1084 *arm64-linux.elf/upx-3.95
912b6ca141a028974bc46aeb571314db371647201974283992752933f39200b1 *armeb-linux.elf/upx-3.91 54860e61da36414dc105aafcdbb86c79b745913a7d0da911fa58a6941f111e2d *armeb-linux.elf/upx-3.91
0b5757e474bcf3136edf10e403f95e706b214a5cf7d8577fbf7778175b1bef61 *armeb-linux.elf/upx-3.95 7c36b75cc8a0712515e12a9e565df4ca43bff6cc0077afb282d367fcc2ee2acd *armeb-linux.elf/upx-3.95
0a0099246096d20ff6035a4df6566954b9d8aff9ed8fdbd35aa5ee4995b02bfe *i386-dos32.djgpp2.coff/upx-3.91.exe 0a0099246096d20ff6035a4df6566954b9d8aff9ed8fdbd35aa5ee4995b02bfe *i386-dos32.djgpp2.coff/upx-3.91.exe
5df7aa9f0896df87eb8798119ad16a9b89c87a7568a67339e33b5baa99ec361f *i386-dos32.djgpp2.coff/upx-3.95.exe 5df7aa9f0896df87eb8798119ad16a9b89c87a7568a67339e33b5baa99ec361f *i386-dos32.djgpp2.coff/upx-3.95.exe
53e5aae9bc70f58e3dc2aef5a94f66df2517d547670e72ee2b3189b7da809f41 *i386-linux.elf/upx-3.91 53e5aae9bc70f58e3dc2aef5a94f66df2517d547670e72ee2b3189b7da809f41 *i386-linux.elf/upx-3.91
@@ -181,17 +181,17 @@ f3d33c5c9809943a902133490bcf0cfbe39a5ef1635a0c29b3bdc4f35dfffa50 *i386-win32.pe/
68f674d081d87e86e54f0051eee9e2bc85b566051992774ab28ff3173cbcb75a *mipsel-linux.elf/upx-3.95 68f674d081d87e86e54f0051eee9e2bc85b566051992774ab28ff3173cbcb75a *mipsel-linux.elf/upx-3.95
f569d8f49d7110bb8b262a48055b39d889e9977c40c5f1b21e74f8cbf93b27ae *powerpc-linux.elf/upx-3.91 f569d8f49d7110bb8b262a48055b39d889e9977c40c5f1b21e74f8cbf93b27ae *powerpc-linux.elf/upx-3.91
d8227a8a88c083760889acaf259e7da59eab75a23e341289bc8e3c60563ae344 *powerpc-linux.elf/upx-3.95 d8227a8a88c083760889acaf259e7da59eab75a23e341289bc8e3c60563ae344 *powerpc-linux.elf/upx-3.95
1675cd12ecdccdcc8bb73d75e8841f5bfde6dfd424dc73cb0065ebf271ace1f8 *powerpc64le-linux.elf/upx-3.95 e4b58ed65025b765953af02e80be9a171c49b6c707c835949b1c888fdbe8bba0 *powerpc64le-linux.elf/upx-3.95
" "
expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\ expected_sha256sums__t170_compress_all_methods_no_lzma_5_no_filter="\
09cee61e2a4e94455d75a76711078719c3ca7fab77f047c4c85c9424e651956d *amd64-linux.elf/upx-3.91 52a39c30b60abb82c1ec2826297eb46abdc29b5dd55d7a7a41dd2fc1c573f60a *amd64-linux.elf/upx-3.91
0196cbaa36e5224b26729f1bb13990327878ffb0d2cd5784f8fbe715f12dcc1c *amd64-linux.elf/upx-3.95 f0c728c42e8775767e0d963e1eef7ca78711f3f6dd180df980a1faef926d7cac *amd64-linux.elf/upx-3.95
e07e9babdeb12fddeebbfa1b0293163cc5e63017d6f0933d02587c8da1e90a82 *amd64-win64.pe/upx-3.95.exe e07e9babdeb12fddeebbfa1b0293163cc5e63017d6f0933d02587c8da1e90a82 *amd64-win64.pe/upx-3.95.exe
4b93e4dd9baea301479fa989d935b7b6b43b2b54464c5def0db1a00b6a15d719 *arm-linux.elf/upx-3.95 f0359efa2247e9ea756f54c85e7518d61f3b293e08f566c3812c64c7d5f0db0f *arm-linux.elf/upx-3.95
8d1706ab02013b536c3a4cec20d40a96591ffa45fdcb464ccd3f038567006d79 *arm-wince.pe/upx-3.91.exe 8d1706ab02013b536c3a4cec20d40a96591ffa45fdcb464ccd3f038567006d79 *arm-wince.pe/upx-3.91.exe
be753ff9bc789d80f32cec35cc0f9c67b102d297f607b328779ba8d80da13593 *arm64-linux.elf/upx-3.95 14932490ff17e27bb5bedde576b8683892c4720f4a0058f373aab9f8894fda09 *arm64-linux.elf/upx-3.95
4c6d40107b5bce15a40aef514b57ac6dd644162998915aee412feca21582118a *armeb-linux.elf/upx-3.91 64a73512e40c2fb49d8ae3a1d496b379c97b8724cf8ca4461a85825ff04366a0 *armeb-linux.elf/upx-3.91
9d70d663c00378aa1c1c43d55327a895be33ea081bac13ce8a7ea6895b539679 *armeb-linux.elf/upx-3.95 078e7cd073ba071f17ad4292e2211b7d635f57e974546e7f156cc87f9aa716e2 *armeb-linux.elf/upx-3.95
dda2c348c43741a1bd65049a8e7b51be1ebf873d215370ec002185c85390c168 *i386-dos32.djgpp2.coff/upx-3.91.exe dda2c348c43741a1bd65049a8e7b51be1ebf873d215370ec002185c85390c168 *i386-dos32.djgpp2.coff/upx-3.91.exe
560392427ded22f2f3fea59ef10e55d65cf841001e67b1e4558ef13514baa602 *i386-dos32.djgpp2.coff/upx-3.95.exe 560392427ded22f2f3fea59ef10e55d65cf841001e67b1e4558ef13514baa602 *i386-dos32.djgpp2.coff/upx-3.95.exe
f3f8feceebe8536633554b204df68c2e94e1d1a313fe7a576b7f5d404c916083 *i386-linux.elf/upx-3.91 f3f8feceebe8536633554b204df68c2e94e1d1a313fe7a576b7f5d404c916083 *i386-linux.elf/upx-3.91
@@ -204,6 +204,6 @@ ad47c7522167f6f7e47d495e1fa119431386ca5ea9bc16b6a4b9cb38cf9cd29f *i386-win32.pe/
1dcd626fc4566c608e987fd6999b695793c5cae7f78872e3d1a9a23942fea188 *mipsel-linux.elf/upx-3.95 1dcd626fc4566c608e987fd6999b695793c5cae7f78872e3d1a9a23942fea188 *mipsel-linux.elf/upx-3.95
2047a4a880322bf41e8afbb4787f6103364de4a299b543808251a4144c4d990b *powerpc-linux.elf/upx-3.91 2047a4a880322bf41e8afbb4787f6103364de4a299b543808251a4144c4d990b *powerpc-linux.elf/upx-3.91
63679bd238f30bfb14853246eb257536471fea10f942b2adfdd43cbef21dea30 *powerpc-linux.elf/upx-3.95 63679bd238f30bfb14853246eb257536471fea10f942b2adfdd43cbef21dea30 *powerpc-linux.elf/upx-3.95
f075e10b0f7c9ab703d0f923387e7ae425fa22c04349cb8085916c32afe4eef2 *powerpc64le-linux.elf/upx-3.95 c75d1548db879ed589b55bc1319869b49d37595f4560a64b34016951dc02f997 *powerpc64le-linux.elf/upx-3.95
" "
########## end .sha256sums.recreate ########## end .sha256sums.recreate
+9 -9
View File
@@ -25,11 +25,11 @@ endif
.SECONDEXPANSION: .SECONDEXPANSION:
.SUFFIXES: .SUFFIXES:
build/debug build/release build/all: PHONY; $(MAKE) -C $(top_srcdir) $@ build/debug build/release build/all: PHONY; $(MAKE) -C "$(top_srcdir)" $@
build/debug+test build/release+test build/all+test: PHONY; $(MAKE) -C $(top_srcdir) $@ build/debug+test build/release+test build/all+test: PHONY; $(MAKE) -C "$(top_srcdir)" $@
# shortcuts # shortcuts
debug release all: PHONY; $(MAKE) -C $(top_srcdir) $@ debug release all: PHONY; $(MAKE) -C "$(top_srcdir)" $@
debug+test release+test all+test: PHONY; $(MAKE) -C $(top_srcdir) $@ debug+test release+test all+test: PHONY; $(MAKE) -C "$(top_srcdir)" $@
test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY test: $$(patsubst %+test,%,$$(.DEFAULT_GOAL))+test PHONY
@@ -61,11 +61,11 @@ run-testsuite-%: export upx_testsuite_SRCDIR := $(upx_testsuite_SRCDIR)
run-testsuite-debug: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-debug run-testsuite-debug: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-debug
run-testsuite-debug: export upx_exe := $(top_srcdir)/build/debug/upx run-testsuite-debug: export upx_exe := $(top_srcdir)/build/debug/upx
run-testsuite-debug: build/debug PHONY run-testsuite-debug: build/debug PHONY
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh time -p bash "$(top_srcdir)/misc/testsuite/upx_testsuite_1.sh"
run-testsuite-release: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-release run-testsuite-release: export upx_testsuite_BUILDDIR := ./tmp-upx-testsuite-release
run-testsuite-release: export upx_exe := $(top_srcdir)/build/release/upx run-testsuite-release: export upx_exe := $(top_srcdir)/build/release/upx
run-testsuite-release: build/release PHONY run-testsuite-release: build/release PHONY
time -p bash $(top_srcdir)/misc/testsuite/upx_testsuite_1.sh time -p bash "$(top_srcdir)/misc/testsuite/upx_testsuite_1.sh"
endif endif
endif endif
@@ -75,9 +75,9 @@ endif
ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc. ifneq ($(wildcard /usr/bin/env),) # need Unix utils like bash, perl, sed, xargs, etc.
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace.sh $(top_srcdir) CHECK_WHITESPACE = bash "$(top_srcdir)/misc/scripts/check_whitespace.sh" "$(top_srcdir)"
ifneq ($(wildcard $(top_srcdir)/.git/.),) ifneq ($(wildcard $(top_srcdir)/.git/.),)
CHECK_WHITESPACE = bash $(top_srcdir)/misc/scripts/check_whitespace_git.sh $(top_srcdir) CHECK_WHITESPACE = bash "$(top_srcdir)/misc/scripts/check_whitespace_git.sh" "$(top_srcdir)"
endif endif
check-whitespace: PHONY; $(CHECK_WHITESPACE) check-whitespace: PHONY; $(CHECK_WHITESPACE)
@@ -100,7 +100,7 @@ CLANG_FORMAT_FILES += $(sort $(wildcard ../misc/cmake/try_compile/*.[ch]*))
CLANG_FORMAT_FILES := $(sort $(filter-out $(CLANG_FORMAT_EXCLUDE_FILES),$(CLANG_FORMAT_FILES))) CLANG_FORMAT_FILES := $(sort $(filter-out $(CLANG_FORMAT_EXCLUDE_FILES),$(CLANG_FORMAT_FILES)))
clang-format: $(CLANG_FORMAT_FILES) PHONY clang-format: $(CLANG_FORMAT_FILES) PHONY
@echo "running upx-clang-format" @echo "running upx-clang-format"
@bash $(top_srcdir)/misc/scripts/upx-clang-format.sh -i $(CLANG_FORMAT_FILES) @bash "$(top_srcdir)/misc/scripts/upx-clang-format.sh" -i $(CLANG_FORMAT_FILES)
endif # Linux endif # Linux
endif # /usr/bin/env endif # /usr/bin/env
+12 -11
View File
@@ -32,8 +32,9 @@
// NE - Native Endianness (aka Host Endianness aka CPU Endianness) // NE - Native Endianness (aka Host Endianness aka CPU Endianness)
// TE - Target Endianness (not used here, see various packers) // TE - Target Endianness (not used here, see various packers)
static_assert(std::is_same_v<upx_uint32_t, unsigned>);
static_assert(std::is_same_v<byte, unsigned char>); static_assert(std::is_same_v<byte, unsigned char>);
static_assert(std::is_same_v<upx_int32_t, int>);
static_assert(std::is_same_v<upx_uint32_t, unsigned>);
#if defined(upx_is_constant_evaluated) #if defined(upx_is_constant_evaluated)
#define bele_constexpr constexpr #define bele_constexpr constexpr
@@ -411,7 +412,7 @@ inline bele_constexpr void set_le14_5(XE32 *p, unsigned v) noexcept {
// get signed values // get signed values
**************************************************************************/ **************************************************************************/
forceinline constexpr int sign_extend(unsigned v, unsigned bits) noexcept { forceinline constexpr int sign_extend32(unsigned v, unsigned bits) noexcept {
#if (ACC_ARCH_M68K) // no barrel shifter #if (ACC_ARCH_M68K) // no barrel shifter
const unsigned sign_bit = 1u << (bits - 1); const unsigned sign_bit = 1u << (bits - 1);
return ACC_ICAST(int, (v & (sign_bit - 1)) - (v & sign_bit)); return ACC_ICAST(int, (v & (sign_bit - 1)) - (v & sign_bit));
@@ -420,7 +421,7 @@ forceinline constexpr int sign_extend(unsigned v, unsigned bits) noexcept {
#endif #endif
} }
forceinline constexpr upx_int64_t sign_extend(upx_uint64_t v, unsigned bits) noexcept { forceinline constexpr upx_int64_t sign_extend64(upx_uint64_t v, unsigned bits) noexcept {
#if (ACC_ARCH_M68K) // no barrel shifter #if (ACC_ARCH_M68K) // no barrel shifter
const upx_uint64_t sign_bit = upx_uint64_t(1) << (bits - 1); const upx_uint64_t sign_bit = upx_uint64_t(1) << (bits - 1);
return ACC_ICAST(upx_int64_t, (v & (sign_bit - 1)) - (v & sign_bit)); return ACC_ICAST(upx_int64_t, (v & (sign_bit - 1)) - (v & sign_bit));
@@ -432,49 +433,49 @@ forceinline constexpr upx_int64_t sign_extend(upx_uint64_t v, unsigned bits) noe
REQUIRE_XE16 REQUIRE_XE16
inline bele_constexpr int get_be16_signed(const XE16 *p) noexcept { inline bele_constexpr int get_be16_signed(const XE16 *p) noexcept {
unsigned v = get_be16(p); unsigned v = get_be16(p);
return sign_extend(v, 16); return sign_extend32(v, 16);
} }
REQUIRE_XE24 REQUIRE_XE24
inline bele_constexpr int get_be24_signed(const XE24 *p) noexcept { inline bele_constexpr int get_be24_signed(const XE24 *p) noexcept {
unsigned v = get_be24(p); unsigned v = get_be24(p);
return sign_extend(v, 24); return sign_extend32(v, 24);
} }
REQUIRE_XE32 REQUIRE_XE32
inline bele_constexpr int get_be32_signed(const XE32 *p) noexcept { inline bele_constexpr int get_be32_signed(const XE32 *p) noexcept {
unsigned v = get_be32(p); unsigned v = get_be32(p);
return sign_extend(v, 32); return sign_extend32(v, 32);
} }
REQUIRE_XE64 REQUIRE_XE64
inline bele_constexpr upx_int64_t get_be64_signed(const XE64 *p) noexcept { inline bele_constexpr upx_int64_t get_be64_signed(const XE64 *p) noexcept {
upx_uint64_t v = get_be64(p); upx_uint64_t v = get_be64(p);
return sign_extend(v, 64); return sign_extend64(v, 64);
} }
REQUIRE_XE16 REQUIRE_XE16
inline bele_constexpr int get_le16_signed(const XE16 *p) noexcept { inline bele_constexpr int get_le16_signed(const XE16 *p) noexcept {
unsigned v = get_le16(p); unsigned v = get_le16(p);
return sign_extend(v, 16); return sign_extend32(v, 16);
} }
REQUIRE_XE24 REQUIRE_XE24
inline bele_constexpr int get_le24_signed(const XE24 *p) noexcept { inline bele_constexpr int get_le24_signed(const XE24 *p) noexcept {
unsigned v = get_le24(p); unsigned v = get_le24(p);
return sign_extend(v, 24); return sign_extend32(v, 24);
} }
REQUIRE_XE32 REQUIRE_XE32
inline bele_constexpr int get_le32_signed(const XE32 *p) noexcept { inline bele_constexpr int get_le32_signed(const XE32 *p) noexcept {
unsigned v = get_le32(p); unsigned v = get_le32(p);
return sign_extend(v, 32); return sign_extend32(v, 32);
} }
REQUIRE_XE64 REQUIRE_XE64
inline bele_constexpr upx_int64_t get_le64_signed(const XE64 *p) noexcept { inline bele_constexpr upx_int64_t get_le64_signed(const XE64 *p) noexcept {
upx_uint64_t v = get_le64(p); upx_uint64_t v = get_le64(p);
return sign_extend(v, 64); return sign_extend64(v, 64);
} }
/************************************************************************* /*************************************************************************
+1 -1
View File
@@ -210,7 +210,7 @@ private:
UPX_CXX_DISABLE_NEW_DELETE(LEPolicy) UPX_CXX_DISABLE_NEW_DELETE(LEPolicy)
}; };
// Native Endianness policy (aka host policy) // Native Endianness policy (aka Host Policy)
#if (ACC_ABI_BIG_ENDIAN) #if (ACC_ABI_BIG_ENDIAN)
typedef BEPolicy NEPolicy; typedef BEPolicy NEPolicy;
typedef BEPolicy HostPolicy; typedef BEPolicy HostPolicy;
+38 -34
View File
@@ -283,18 +283,18 @@ static_assert(bswap32(bswap32(0xf4f3f2f1)) == no_bswap32(0xf4f3f2f1));
static_assert(bswap64(bswap64(0xf8f7f6f5f4f3f2f1ull)) == no_bswap64(0xf8f7f6f5f4f3f2f1ull)); static_assert(bswap64(bswap64(0xf8f7f6f5f4f3f2f1ull)) == no_bswap64(0xf8f7f6f5f4f3f2f1ull));
#endif #endif
static_assert(sign_extend(0u + 0, 8) == 0); static_assert(sign_extend32(0u + 0, 8) == 0);
static_assert(sign_extend(0u + 1, 8) == 1); static_assert(sign_extend32(0u + 1, 8) == 1);
static_assert(sign_extend(0u + 127, 8) == 127); static_assert(sign_extend32(0u + 127, 8) == 127);
static_assert(sign_extend(0u + 128, 8) == -128); static_assert(sign_extend32(0u + 128, 8) == -128);
static_assert(sign_extend(0u - 1, 8) == -1); static_assert(sign_extend32(0u - 1, 8) == -1);
static_assert(sign_extend(0u + 256, 8) == 0); static_assert(sign_extend32(0u + 256, 8) == 0);
static_assert(sign_extend(0u + 257, 8) == 1); static_assert(sign_extend32(0u + 257, 8) == 1);
static_assert(sign_extend(0u + 383, 8) == 127); static_assert(sign_extend32(0u + 383, 8) == 127);
static_assert(sign_extend(0u + 384, 8) == -128); static_assert(sign_extend32(0u + 384, 8) == -128);
static_assert(sign_extend(0u + 511, 8) == -1); static_assert(sign_extend32(0u + 511, 8) == -1);
static_assert(sign_extend(upx_uint64_t(0) + 0, 1) == 0); static_assert(sign_extend64(upx_uint64_t(0) + 0, 1) == 0);
static_assert(sign_extend(upx_uint64_t(0) + 1, 1) == -1); static_assert(sign_extend64(upx_uint64_t(0) + 1, 1) == -1);
static_assert(CHAR_BIT == 8); static_assert(CHAR_BIT == 8);
#if 0 // does not work with MSVC #if 0 // does not work with MSVC
@@ -1101,7 +1101,7 @@ void upx_compiler_sanity_check(void) noexcept {
assert_noexcept(TestBELE<BE32>::test()); assert_noexcept(TestBELE<BE32>::test());
assert_noexcept(TestBELE<BE64>::test()); assert_noexcept(TestBELE<BE64>::test());
{ {
alignas(16) static constexpr byte dd[32] = { alignas(16) static constexpr const byte dd[32] = {
0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xfe, 0xfd, 0xfc, 0xfb, 0xfa, 0xf9, 0xf8, 0,
0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0}; 0, 0, 0, 0x7f, 0x7e, 0x7d, 0x7c, 0x7b, 0x7a, 0x79, 0x78, 0, 0, 0, 0, 0};
constexpr const byte *d = dd + 7; constexpr const byte *d = dd + 7;
@@ -1117,10 +1117,10 @@ void upx_compiler_sanity_check(void) noexcept {
static_assert(upx::compile_time::get_le24(d) == 0xfdfeff); static_assert(upx::compile_time::get_le24(d) == 0xfdfeff);
static_assert(upx::compile_time::get_le32(d) == 0xfcfdfeff); static_assert(upx::compile_time::get_le32(d) == 0xfcfdfeff);
static_assert(upx::compile_time::get_le64(d) == 0xf8f9fafbfcfdfeffULL); static_assert(upx::compile_time::get_le64(d) == 0xf8f9fafbfcfdfeffULL);
const N_BELE_RTP::AbstractPolicy *bele;
assert_noexcept(upx_adler32(d, 4) == 0x09f003f7); assert_noexcept(upx_adler32(d, 4) == 0x09f003f7);
assert_noexcept(upx_adler32(d, 4, 0) == 0x09ec03f6); assert_noexcept(upx_adler32(d, 4, 0) == 0x09ec03f6);
assert_noexcept(upx_adler32(d, 4, 1) == 0x09f003f7); assert_noexcept(upx_adler32(d, 4, 1) == 0x09f003f7);
const N_BELE_RTP::AbstractPolicy *bele;
bele = &N_BELE_RTP::be_policy; bele = &N_BELE_RTP::be_policy;
assert_noexcept(get_be16(d) == 0xfffe); assert_noexcept(get_be16(d) == 0xfffe);
assert_noexcept(bele->get16(d) == 0xfffe); assert_noexcept(bele->get16(d) == 0xfffe);
@@ -1212,29 +1212,33 @@ void upx_compiler_sanity_check(void) noexcept {
for (int i = 0; i < 256; i++) { for (int i = 0; i < 256; i++) {
{ {
const unsigned u = i; const unsigned u = i;
assert_noexcept(sign_extend(u, 1) == ((i & 1) ? -1 : 0)); assert_noexcept(sign_extend32(u, 1) == ((i & 1) ? -1 : 0));
assert_noexcept(sign_extend(u, 2) == ((i & 2) ? -2 + (i & 1) : (i & 1))); assert_noexcept(sign_extend32(u, 2) == ((i & 2) ? -2 + (i & 1) : (i & 1)));
assert_noexcept(sign_extend(u, 3) == ((i & 4) ? -4 + (i & 3) : (i & 3))); assert_noexcept(sign_extend32(u, 3) == ((i & 4) ? -4 + (i & 3) : (i & 3)));
assert_noexcept(sign_extend(u, 4) == ((i & 8) ? -8 + (i & 7) : (i & 7))); assert_noexcept(sign_extend32(u, 4) == ((i & 8) ? -8 + (i & 7) : (i & 7)));
assert_noexcept(sign_extend(u, 5) == ((i & 16) ? -16 + (i & 15) : (i & 15))); assert_noexcept(sign_extend32(u, 5) == ((i & 16) ? -16 + (i & 15) : (i & 15)));
assert_noexcept(sign_extend(u, 6) == ((i & 32) ? -32 + (i & 31) : (i & 31))); assert_noexcept(sign_extend32(u, 6) == ((i & 32) ? -32 + (i & 31) : (i & 31)));
assert_noexcept(sign_extend(u, 7) == ((i & 64) ? -64 + (i & 63) : (i & 63))); assert_noexcept(sign_extend32(u, 7) == ((i & 64) ? -64 + (i & 63) : (i & 63)));
assert_noexcept(sign_extend(u, 8) == ((i & 128) ? -128 + (i & 127) : (i & 127))); assert_noexcept(sign_extend32(u, 8) == ((i & 128) ? -128 + (i & 127) : (i & 127)));
assert_noexcept(sign_extend(u, 32) == i); assert_noexcept(sign_extend32(u, 9) == i);
assert_noexcept(sign_extend(0u - u, 32) == -i); assert_noexcept(sign_extend32(u, 32) == i);
assert_noexcept(sign_extend32(0u - u, 32) == -i);
} }
{ {
const upx_uint64_t u = i; const upx_uint64_t u = i;
assert_noexcept(sign_extend(u, 1) == ((i & 1) ? -1 : 0)); assert_noexcept(sign_extend64(u, 1) == ((i & 1) ? -1 : 0));
assert_noexcept(sign_extend(u, 2) == ((i & 2) ? -2 + (i & 1) : (i & 1))); assert_noexcept(sign_extend64(u, 2) == ((i & 2) ? -2 + (i & 1) : (i & 1)));
assert_noexcept(sign_extend(u, 3) == ((i & 4) ? -4 + (i & 3) : (i & 3))); assert_noexcept(sign_extend64(u, 3) == ((i & 4) ? -4 + (i & 3) : (i & 3)));
assert_noexcept(sign_extend(u, 4) == ((i & 8) ? -8 + (i & 7) : (i & 7))); assert_noexcept(sign_extend64(u, 4) == ((i & 8) ? -8 + (i & 7) : (i & 7)));
assert_noexcept(sign_extend(u, 5) == ((i & 16) ? -16 + (i & 15) : (i & 15))); assert_noexcept(sign_extend64(u, 5) == ((i & 16) ? -16 + (i & 15) : (i & 15)));
assert_noexcept(sign_extend(u, 6) == ((i & 32) ? -32 + (i & 31) : (i & 31))); assert_noexcept(sign_extend64(u, 6) == ((i & 32) ? -32 + (i & 31) : (i & 31)));
assert_noexcept(sign_extend(u, 7) == ((i & 64) ? -64 + (i & 63) : (i & 63))); assert_noexcept(sign_extend64(u, 7) == ((i & 64) ? -64 + (i & 63) : (i & 63)));
assert_noexcept(sign_extend(u, 8) == ((i & 128) ? -128 + (i & 127) : (i & 127))); assert_noexcept(sign_extend64(u, 8) == ((i & 128) ? -128 + (i & 127) : (i & 127)));
assert_noexcept(sign_extend(u, 64) == i); assert_noexcept(sign_extend64(u, 9) == i);
assert_noexcept(sign_extend(upx_uint64_t(0) - u, 64) == -i); assert_noexcept(sign_extend64(u, 32) == i);
assert_noexcept(sign_extend64(upx_uint64_t(0) - u, 32) == -i);
assert_noexcept(sign_extend64(u, 64) == i);
assert_noexcept(sign_extend64(upx_uint64_t(0) - u, 64) == -i);
} }
} }
} }
+7 -5
View File
@@ -558,7 +558,8 @@ TEST_CASE("upx::ObjectDeleter 1") {
LE32 *a = nullptr; // array LE32 *a = nullptr; // array
LE64 *m = nullptr; // malloc LE64 *m = nullptr; // malloc
{ {
auto o_deleter = upx::ObjectDeleter(&o, 1); // auto o_deleter = upx::ObjectDeleter(&o, 1);
upx::ObjectDeleter<LE16> o_deleter = upx::ObjectDeleter(&o, 1);
o = new LE16; o = new LE16;
assert(o != nullptr); assert(o != nullptr);
auto a_deleter = upx::ArrayDeleter(&a, 1); auto a_deleter = upx::ArrayDeleter(&a, 1);
@@ -594,7 +595,8 @@ TEST_CASE("upx::ObjectDeleter 2") {
BE32 *a[N]; // multiple arrays BE32 *a[N]; // multiple arrays
BE64 *m[N]; // multiple mallocs BE64 *m[N]; // multiple mallocs
{ {
auto o_deleter = upx::ObjectDeleter(o, 0); // auto o_deleter = upx::ObjectDeleter(o, 0);
upx::ObjectDeleter<BE16> o_deleter = upx::ObjectDeleter(o, 0);
auto a_deleter = upx::ArrayDeleter(a, 0); auto a_deleter = upx::ArrayDeleter(a, 0);
auto m_deleter = upx::MallocDeleter(m, 0); auto m_deleter = upx::MallocDeleter(m, 0);
for (size_t i = 0; i < N; i++) { for (size_t i = 0; i < N; i++) {
@@ -768,7 +770,7 @@ static_assert(sizeof(TestCT) == 8);
static_assert(alignof(TestCT) == 1); static_assert(alignof(TestCT) == 1);
} // namespace } // namespace
TEST_CASE("upx::compile_time") { TEST_CASE("upx::compile_time 1") {
constexpr upx_uint16_t v16 = 0x0201; constexpr upx_uint16_t v16 = 0x0201;
constexpr upx_uint32_t v24 = 0x030201; constexpr upx_uint32_t v24 = 0x030201;
constexpr upx_uint32_t v32 = 0x04030201; constexpr upx_uint32_t v32 = 0x04030201;
@@ -865,7 +867,7 @@ TEST_CASE("upx::compile_time") {
constexpr auto le64 = TestCT::makeLE64(v64); constexpr auto le64 = TestCT::makeLE64(v64);
static_assert(upx::compile_time::get_le64(le64.d) == v64); static_assert(upx::compile_time::get_le64(le64.d) == v64);
static_assert(mem_eq(le64.d, "\x01\x02\x03\x04\x05\x06\x07\x08", 8)); static_assert(mem_eq(le64.d, "\x01\x02\x03\x04\x05\x06\x07\x08", 8));
memset(buf, 0, 8); upx::compile_time::mem_clear(buf, 8);
TestCT::noinline_set_le64(buf, v64); TestCT::noinline_set_le64(buf, v64);
assert_noexcept(TestCT::noinline_get_le64(buf) == v64); assert_noexcept(TestCT::noinline_get_le64(buf) == v64);
assert_noexcept(upx::compile_time::get_le64(buf) == v64); assert_noexcept(upx::compile_time::get_le64(buf) == v64);
@@ -886,7 +888,7 @@ TEST_CASE("upx::compile_time") {
} }
} }
TEST_CASE("upx::compile_time") { TEST_CASE("upx::compile_time 2") {
constexpr upx_uint16_t v16 = 0xf2f1; constexpr upx_uint16_t v16 = 0xf2f1;
constexpr upx_uint32_t v24 = 0xf3f2f1; constexpr upx_uint32_t v24 = 0xf3f2f1;
constexpr upx_uint32_t v32 = 0xf4f3f2f1; constexpr upx_uint32_t v32 = 0xf4f3f2f1;
+6 -6
View File
@@ -71,6 +71,10 @@ static_assert((-1) >> 31 == -1); // arithmetic right shift
static_assert(CHAR_MAX == 255); // -funsigned-char static_assert(CHAR_MAX == 255); // -funsigned-char
static_assert((char) (-1) == 255); // -funsigned-char static_assert((char) (-1) == 255); // -funsigned-char
// disable some more strict warnings
#if defined(__clang__) && __has_warning("-Wunnecessary-virtual-specifier")
#pragma clang diagnostic ignored "-Wunnecessary-virtual-specifier"
#endif
// enable some more strict warnings for Git developer builds // enable some more strict warnings for Git developer builds
#if defined(UPX_CONFIG_DISABLE_WSTRICT) && (UPX_CONFIG_DISABLE_WSTRICT + 0 == 0) #if defined(UPX_CONFIG_DISABLE_WSTRICT) && (UPX_CONFIG_DISABLE_WSTRICT + 0 == 0)
#if defined(UPX_CONFIG_DISABLE_WERROR) && (UPX_CONFIG_DISABLE_WERROR + 0 == 0) #if defined(UPX_CONFIG_DISABLE_WERROR) && (UPX_CONFIG_DISABLE_WERROR + 0 == 0)
@@ -137,7 +141,7 @@ inline constexpr bool upx_is_integral_v = upx_is_integral<T>::value;
#define upx_fake_alignas_16 __attribute__((__aligned__(2))) // object file maximum 2 ??? #define upx_fake_alignas_16 __attribute__((__aligned__(2))) // object file maximum 2 ???
#define upx_fake_alignas__(x) upx_fake_alignas_##x #define upx_fake_alignas__(x) upx_fake_alignas_##x
#define alignas(x) upx_fake_alignas__(x) #define alignas(x) upx_fake_alignas__(x)
#define upx_alignas_max upx_fake_alignas_4 #define upx_alignas_max upx_fake_alignas_2
#endif #endif
#ifndef upx_alignas_max #ifndef upx_alignas_max
#define upx_alignas_max alignas(std::max_align_t) #define upx_alignas_max alignas(std::max_align_t)
@@ -193,11 +197,7 @@ struct alignas(1) upx_charptr_unit_type final { char hidden__; };
static_assert(sizeof(upx_charptr_unit_type) == 1); static_assert(sizeof(upx_charptr_unit_type) == 1);
// using the system off_t was a bad idea even back in 199x... // using the system off_t was a bad idea even back in 199x...
#if (__SIZEOF_INT128__ == 16) && 0
typedef upx_int128_t upx_off_t;
#else
typedef long long upx_off_t; typedef long long upx_off_t;
#endif
#undef off_t #undef off_t
#if 0 #if 0
// TODO later cleanup: at some future point we can do this: // TODO later cleanup: at some future point we can do this:
@@ -230,7 +230,7 @@ typedef long long upx_off_t;
#define very_likely __acc_very_likely #define very_likely __acc_very_likely
#define very_unlikely __acc_very_unlikely #define very_unlikely __acc_very_unlikely
// cosmetic: explicitly annotate some functions which may throw exceptions // cosmetic: explicitly annotate some functions which may throw exceptions;
// note that noexcept(false) is the default for all C++ functions anyway // note that noexcept(false) is the default for all C++ functions anyway
#define may_throw noexcept(false) #define may_throw noexcept(false)
+4 -4
View File
@@ -200,15 +200,15 @@ noreturn void throwEOFException(const char *msg = nullptr, int e = 0) may_throw;
// some C++ template wizardry is needed to overload throwCantPack() for varargs // some C++ template wizardry is needed to overload throwCantPack() for varargs
template <class T> template <class T>
void throwCantPack(const T *, ...) DELETED_FUNCTION; void throwCantPack(const T *, ...) DELETED_FUNCTION;
template <>
noreturn void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
template <class T> template <class T>
void throwCantUnpack(const T *, ...) DELETED_FUNCTION; void throwCantUnpack(const T *, ...) DELETED_FUNCTION;
template <>
noreturn void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
template <class T> template <class T>
void throwInternalError(const T *, ...) DELETED_FUNCTION; void throwInternalError(const T *, ...) DELETED_FUNCTION;
template <> template <>
noreturn void throwCantPack(const char *format, ...) may_throw attribute_format(1, 2);
template <>
noreturn void throwCantUnpack(const char *format, ...) may_throw attribute_format(1, 2);
template <>
noreturn void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2); noreturn void throwInternalError(const char *format, ...) may_throw attribute_format(1, 2);
/* vim:set ts=4 sw=4 et: */ /* vim:set ts=4 sw=4 et: */
+1
View File
@@ -342,6 +342,7 @@ void show_help(int verbose) {
fg = con_fg(f, fg); fg = con_fg(f, fg);
con_fprintf(f, con_fprintf(f,
" --preserve-build-id copy .gnu.note.build-id to compressed output\n" " --preserve-build-id copy .gnu.note.build-id to compressed output\n"
" --catch-sigsegv debug errors in hardware or de-compressor\n"
"\n"); "\n");
} }
// clang-format on // clang-format on
+4
View File
@@ -742,6 +742,9 @@ static int do_option(int optc, const char *arg) {
case 678: case 678:
opt->o_unix.android_old = true; opt->o_unix.android_old = true;
break; break;
case 679:
opt->o_unix.catch_sigsegv = true;
break;
// ps1/exe // ps1/exe
case 670: case 670:
opt->ps1_exe.boot_only = true; opt->ps1_exe.boot_only = true;
@@ -957,6 +960,7 @@ int main_get_options(int argc, char **argv) {
{"android-shlib", 0, N, 676}, {"android-shlib", 0, N, 676},
{"force-pie", 0x90, N, 677}, {"force-pie", 0x90, N, 677},
{"android-old", 0, N, 678}, {"android-old", 0, N, 678},
{"catch-sigsegv", 0, N, 679},
// ps1/exe // ps1/exe
{"boot-only", 0x90, N, 670}, {"boot-only", 0x90, N, 670},
{"no-align", 0x90, N, 671}, {"no-align", 0x90, N, 671},
+1
View File
@@ -162,6 +162,7 @@ struct Options final {
bool android_shlib; // keep some ElfXX_Shdr for dlopen() bool android_shlib; // keep some ElfXX_Shdr for dlopen()
bool android_old; // < Android_10 ==> no memfd_create, inconsistent __NR_ftruncate bool android_old; // < Android_10 ==> no memfd_create, inconsistent __NR_ftruncate
bool force_pie; // choose DF_1_PIE instead of is_shlib bool force_pie; // choose DF_1_PIE instead of is_shlib
bool catch_sigsegv; // to debug hardware or de-compressor
} o_unix; } o_unix;
struct { struct {
bool boot_only; bool boot_only;
+42 -17
View File
@@ -1532,7 +1532,7 @@ PackLinuxElf32::buildLinuxLoader(
// EXP_TAIL FIXME: unfilter // EXP_TAIL FIXME: unfilter
// SO_TAIL // SO_TAIL
// SO_MAIN C-language supervision based on PT_LOADs // SO_MAIN C-language supervision based on PT_LOADs
char sec[120]; memset(sec, 0, sizeof(sec)); // debug convenience char sec[200]; memset(sec, 0, sizeof(sec)); // debug convenience
int len = 0; int len = 0;
unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method))); unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method)));
len += snprintf(sec, sizeof(sec), "%s", "SO_HEAD,ptr_NEXT,EXP_HEAD"); len += snprintf(sec, sizeof(sec), "%s", "SO_HEAD,ptr_NEXT,EXP_HEAD");
@@ -1584,7 +1584,7 @@ PackLinuxElf32::buildLinuxLoader(
|| this->e_machine==Elf32_Ehdr::EM_MIPS || this->e_machine==Elf32_Ehdr::EM_MIPS
) { // main program with ELF2 de-compressor (folded portion) ) { // main program with ELF2 de-compressor (folded portion)
initLoader(fold, szfold); initLoader(fold, szfold);
char sec[120]; memset(sec, 0, sizeof(sec)); // debug convenience char sec[200]; memset(sec, 0, sizeof(sec)); // debug convenience
int len = 0; int len = 0;
unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method))); unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method)));
len += snprintf(sec, sizeof(sec), "%s", ".text,EXP_HEAD"); len += snprintf(sec, sizeof(sec), "%s", ".text,EXP_HEAD");
@@ -1681,7 +1681,11 @@ PackLinuxElf32::buildLinuxLoader(
|| this->e_machine==Elf32_Ehdr::EM_MIPS || this->e_machine==Elf32_Ehdr::EM_MIPS
) { // main program with ELF2 de-compressor ) { // main program with ELF2 de-compressor
addLoader("ELFMAINX"); addLoader("ELFMAINX");
if (this->e_machine==Elf32_Ehdr::EM_ARM) { // hardware is more problematic
if (opt->o_unix.catch_sigsegv && hasLoaderSection("ELFSIGSEGV"))
addLoader("ELFSIGSEGV");
addLoader("ELFMAINX2");
}
// Only if $ARCH-linux.elf-entry.S calls upx_mmap_and_fd instead of memfd_create // Only if $ARCH-linux.elf-entry.S calls upx_mmap_and_fd instead of memfd_create
if (this->e_machine != Elf32_Ehdr::EM_PPC if (this->e_machine != Elf32_Ehdr::EM_PPC
&& this->e_machine != Elf32_Ehdr::EM_MIPS) && this->e_machine != Elf32_Ehdr::EM_MIPS)
@@ -1729,7 +1733,7 @@ PackLinuxElf64::buildLinuxLoader(
// EXP_TAIL FIXME: unfilter // EXP_TAIL FIXME: unfilter
// SO_TAIL // SO_TAIL
// SO_MAIN C-language supervision based on PT_LOADs // SO_MAIN C-language supervision based on PT_LOADs
char sec[120]; memset(sec, 0, sizeof(sec)); // debug convenience char sec[200]; memset(sec, 0, sizeof(sec)); // debug convenience
int len = 0; int len = 0;
unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method))); unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method)));
len += snprintf(sec, sizeof(sec), "%s", "SO_HEAD,ptr_NEXT,EXP_HEAD"); len += snprintf(sec, sizeof(sec), "%s", "SO_HEAD,ptr_NEXT,EXP_HEAD");
@@ -1774,7 +1778,7 @@ PackLinuxElf64::buildLinuxLoader(
|| this->e_machine==Elf64_Ehdr::EM_PPC64 || this->e_machine==Elf64_Ehdr::EM_PPC64
) { // main program with ELF2 de-compressor (folded portion) ) { // main program with ELF2 de-compressor (folded portion)
initLoader(fold, szfold); initLoader(fold, szfold);
char sec[120]; memset(sec, 0, sizeof(sec)); // debug convenience char sec[200]; memset(sec, 0, sizeof(sec)); // debug convenience
int len = 0; int len = 0;
unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method))); unsigned m_decompr = methods_used | (1u << (0xFF & ph_forced_method(ph.method)));
len += snprintf(sec, sizeof(sec), "%s", ".text,EXP_HEAD"); len += snprintf(sec, sizeof(sec), "%s", ".text,EXP_HEAD");
@@ -1871,7 +1875,14 @@ PackLinuxElf64::buildLinuxLoader(
|| this->e_machine==Elf64_Ehdr::EM_AARCH64 || this->e_machine==Elf64_Ehdr::EM_AARCH64
|| this->e_machine==Elf64_Ehdr::EM_PPC64 || this->e_machine==Elf64_Ehdr::EM_PPC64
) { // main program with ELF2 de-compressor ) { // main program with ELF2 de-compressor
addLoader("ELFMAINX,ELFMAINZ,FOLDEXEC,IDENTSTR"); addLoader("ELFMAINX");
// NYI for PPC64 {
if (opt->o_unix.catch_sigsegv && hasLoaderSection("ELFSIGSEGV"))
addLoader("ELFSIGSEGV");
if (this->e_machine!=Elf64_Ehdr::EM_PPC64)
addLoader("ELFMAINX2");
// } end NYI for PPC64
addLoader("ELFMAINZ,FOLDEXEC,IDENTSTR");
if (this->e_machine==Elf64_Ehdr::EM_PPC64 if (this->e_machine==Elf64_Ehdr::EM_PPC64
&& ehdri.e_ident[Elf64_Ehdr::EI_DATA]==Elf64_Ehdr::ELFDATA2MSB) { && ehdri.e_ident[Elf64_Ehdr::EI_DATA]==Elf64_Ehdr::ELFDATA2MSB) {
addLoader("ELFMAINZe"); addLoader("ELFMAINZe");
@@ -2378,10 +2389,11 @@ PackLinuxElf32::invert_pt_dynamic(Elf32_Dyn const *dynp, u32_t headway)
throwCantPack("bad DT_STRSZ %#x", strtab_max); throwCantPack("bad DT_STRSZ %#x", strtab_max);
} }
// Find end of DT_SYMTAB { // Find end of DT_SYMTAB
unsigned const tmp2 = elf_find_table_size(Elf32_Dyn::DT_SYMTAB, unsigned const tmp2 = elf_find_table_size(Elf32_Dyn::DT_SYMTAB,
Elf32_Shdr::SHT_DYNSYM); Elf32_Shdr::SHT_DYNSYM);
symnum_max = (~0u == tmp2) ? 0 : tmp1 / sizeof(Elf32_Sym); symnum_max = (~0u == tmp2) ? 0 : tmp2 / sizeof(Elf32_Sym);
}
unsigned v_sym = dt_table[Elf32_Dyn::DT_SYMTAB]; unsigned v_sym = dt_table[Elf32_Dyn::DT_SYMTAB];
if (v_sym) { if (v_sym) {
@@ -8470,10 +8482,11 @@ PackLinuxElf64::invert_pt_dynamic(Elf64_Dyn const *dynp, upx_uint64_t headway)
throwCantPack("bad DT_STRSZ %#x", strtab_max); throwCantPack("bad DT_STRSZ %#x", strtab_max);
} }
// Find end of DT_SYMTAB { // Find end of DT_SYMTAB
unsigned const tmp2 = elf_find_table_size(Elf64_Dyn::DT_SYMTAB, unsigned const tmp2 = elf_find_table_size(Elf64_Dyn::DT_SYMTAB,
Elf64_Shdr::SHT_DYNSYM); Elf64_Shdr::SHT_DYNSYM);
symnum_max = (~0u == tmp2) ? 0 : tmp1 / sizeof(Elf64_Sym); symnum_max = (~0u == tmp2) ? 0 : tmp2 / sizeof(Elf64_Sym);
}
unsigned v_sym = dt_table[Elf64_Dyn::DT_SYMTAB]; unsigned v_sym = dt_table[Elf64_Dyn::DT_SYMTAB];
if (v_sym) { if (v_sym) {
@@ -8661,6 +8674,7 @@ Elf32_Sym const *PackLinuxElf32::elf_lookup(char const *name) const
break; // end sentinel break; // end sentinel
} }
if (n_bucket) { if (n_bucket) {
void const *EOM = file_size + (char const *)file_image.getVoidPtr();
unsigned const m = elf_hash(name) % n_bucket; unsigned const m = elf_hash(name) % n_bucket;
unsigned n_visit = 0; unsigned n_visit = 0;
unsigned si; unsigned si;
@@ -8674,6 +8688,9 @@ Elf32_Sym const *PackLinuxElf32::elf_lookup(char const *name) const
return &dynsym[si]; return &dynsym[si];
if (l_sym <= &dynsym[n_visit++]) if (l_sym <= &dynsym[n_visit++])
throwCantPack("circular DT_HASH chain %d\n", si); throwCantPack("circular DT_HASH chain %d\n", si);
// Detect next si out-of-bounds
if ((unsigned)((unsigned int const *)EOM - chains) <= si)
throwCantPack("bad DT_HASH chain %d\n", si);
} }
} }
} }
@@ -8704,9 +8721,9 @@ Elf32_Sym const *PackLinuxElf32::elf_lookup(char const *name) const
if (1& (w>>hbit1) & (w>>hbit2)) { if (1& (w>>hbit1) & (w>>hbit2)) {
unsigned const hhead = get_te32(&buckets[h % n_bucket]); unsigned const hhead = get_te32(&buckets[h % n_bucket]);
if (n_bucket <= (hhead - symbias)) { if (symnum_max <= hhead || (hhead && hhead < symbias)) {
throwCantPack("bad DT_GNU_HASH n_bucket{%#x} <= buckets[%d]{%#x} - symbias{%#x}\n", throwCantPack("bad DT_GNU_HASH symnum_max{%#x} <= buckets[%d]{%#x} < symbias{%#x}\n",
n_bucket, h % n_bucket, hhead, symbias); symnum_max, h % n_bucket, hhead, symbias);
} }
if (hhead) { if (hhead) {
Elf32_Sym const *dsp = &dynsym[hhead]; Elf32_Sym const *dsp = &dynsym[hhead];
@@ -8762,6 +8779,7 @@ Elf64_Sym const *PackLinuxElf64::elf_lookup(char const *name) const
break; //end break; //end
} }
if (n_bucket) { // -rust-musl can have "empty" hashtab if (n_bucket) { // -rust-musl can have "empty" hashtab
void const *const EOM = file_size + (char const *)file_image.getVoidPtr();
unsigned const m = elf_hash(name) % n_bucket; unsigned const m = elf_hash(name) % n_bucket;
unsigned n_visit = 0; unsigned n_visit = 0;
unsigned si; unsigned si;
@@ -8775,6 +8793,9 @@ Elf64_Sym const *PackLinuxElf64::elf_lookup(char const *name) const
return &dynsym[si]; return &dynsym[si];
if (l_sym <= &dynsym[n_visit++]) if (l_sym <= &dynsym[n_visit++])
throwCantPack("circular DT_HASH chain %d\n", si); throwCantPack("circular DT_HASH chain %d\n", si);
// Detect next si out-of-bounds
if ((unsigned)((unsigned int const *)EOM - chains) <= si)
throwCantPack("bad DT_HASH chain %d\n", si);
} }
} }
} }
@@ -8805,6 +8826,10 @@ Elf64_Sym const *PackLinuxElf64::elf_lookup(char const *name) const
upx_uint64_t const w = get_te64(&bitmask[(n_bitmask -1) & (h>>6)]); upx_uint64_t const w = get_te64(&bitmask[(n_bitmask -1) & (h>>6)]);
if (1& (w>>hbit1) & (w>>hbit2)) { if (1& (w>>hbit1) & (w>>hbit2)) {
unsigned hhead = get_te32(&buckets[h % n_bucket]); unsigned hhead = get_te32(&buckets[h % n_bucket]);
if (symnum_max <= hhead || (hhead && hhead < symbias)) {
throwCantPack("bad DT_GNU_HASH symnum_max{%#x} <= buckets[%d]{%#x} < symbias{%#x}\n",
symnum_max, h % n_bucket, hhead, symbias);
}
if (hhead) { if (hhead) {
Elf64_Sym const *dsp = &dynsym[hhead]; Elf64_Sym const *dsp = &dynsym[hhead];
unsigned const *hp = &hasharr[hhead - symbias]; unsigned const *hp = &hasharr[hhead - symbias];
+2
View File
@@ -1418,6 +1418,7 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
unsigned const sz_threado = threado_size(); unsigned const sz_threado = threado_size();
MemBuffer space(sz_threado); memset(space, 0, sz_threado); MemBuffer space(sz_threado); memset(space, 0, sz_threado);
fo->write(space, sz_threado); fo->write(space, sz_threado);
UNUSED(cmdsize);
} }
else if (my_filetype == Mach_header::MH_DYLIB) { else if (my_filetype == Mach_header::MH_DYLIB) {
Mach_command const *ptr = (Mach_command const *)rawmseg; Mach_command const *ptr = (Mach_command const *)rawmseg;
@@ -1449,6 +1450,7 @@ void PackMachBase<T>::pack1(OutputFile *const fo, Filter &/*ft*/) // generate e
} }
memset(&linkitem, 0, sizeof(linkitem)); memset(&linkitem, 0, sizeof(linkitem));
fo->write(&linkitem, sizeof(linkitem)); fo->write(&linkitem, sizeof(linkitem));
UNUSED(cmdsize);
} }
sz_mach_headers = fo->getBytesWritten(); sz_mach_headers = fo->getBytesWritten();
gap = secTEXT.offset - sz_mach_headers; gap = secTEXT.offset - sz_mach_headers;
+3 -3
View File
@@ -48,7 +48,7 @@ protected:
public: public:
virtual ~PackerBase() noexcept {} virtual ~PackerBase() noexcept {}
// getVersion() enables detecting forward incompatibility of unpack() // getVersion() enables detecting forward incompatibility of unpack()
// by old upx when newer upx changes the format of compressed output. // by old UPX when newer UPX changes the format of compressed output.
virtual int getVersion() const = 0; virtual int getVersion() const = 0;
// A unique integer ID for this executable format; see UPX_F_xxx in conf.h. // A unique integer ID for this executable format; see UPX_F_xxx in conf.h.
virtual int getFormat() const = 0; virtual int getFormat() const = 0;
@@ -58,11 +58,11 @@ public:
virtual const int *getFilters() const = 0; virtual const int *getFilters() const = 0;
// canPack() should throw a cantPackException explaining why it cannot pack // canPack() should throw a cantPackException explaining why it cannot pack
// a recognized format. // a recognized format.
// canPack() can also return -1 to fail early; see class PackMaster // canPack() can also return -1 to fail early; see class PackMaster
virtual tribool canPack() = 0; virtual tribool canPack() = 0;
// canUnpack() should throw a cantUnpackException explaining why it cannot unpack // canUnpack() should throw a cantUnpackException explaining why it cannot unpack
// a recognized format. // a recognized format.
// canUnpack() can also return -1 to fail early; see class PackMaster // canUnpack() can also return -1 to fail early; see class PackMaster
virtual tribool canUnpack() = 0; virtual tribool canUnpack() = 0;
+2
View File
@@ -25,6 +25,8 @@
<markus@oberhumer.com> <ezerotven+github@gmail.com> <markus@oberhumer.com> <ezerotven+github@gmail.com>
*/ */
// dispatch to a concrete subclass of class PackerBase; see work.cpp
#include "conf.h" #include "conf.h"
#include "file.h" #include "file.h"
#include "packmast.h" #include "packmast.h"
+28 -18
View File
@@ -580,14 +580,15 @@ void PeFile32::processRelocs() // pass1
// deliberately corrupt. Sometimes it is even tuned to cause us trouble! // deliberately corrupt. Sometimes it is even tuned to cause us trouble!
// Use an extra check to avoid AccessViolation (SIGSEGV) when appending // Use an extra check to avoid AccessViolation (SIGSEGV) when appending
// the relocs into one array. // the relocs into one array.
if ((4 * relocnum + 8192) < if ((sizeof(LE32) * relocnum + 8192) <
(sorelocs + 4 * (2 + xcounts[IMAGE_REL_BASED_LOW] + xcounts[IMAGE_REL_BASED_HIGH]))) (sorelocs +
sizeof(LE32) * (2 + xcounts[IMAGE_REL_BASED_LOW] + xcounts[IMAGE_REL_BASED_HIGH])))
throwCantUnpack("Invalid relocs"); throwCantUnpack("Invalid relocs");
// append relocs type "LOW" then "HIGH" // append relocs type "LOW" then "HIGH"
for (unsigned ic = IMAGE_REL_BASED_LOW; ic >= IMAGE_REL_BASED_HIGH; ic--) { for (unsigned ic = IMAGE_REL_BASED_LOW; ic >= IMAGE_REL_BASED_HIGH; ic--) {
memcpy(orelocs + sorelocs, fix[ic], 4 * xcounts[ic]); memcpy(orelocs + sorelocs, fix[ic], sizeof(LE32) * xcounts[ic]);
sorelocs += 4 * xcounts[ic]; sorelocs += sizeof(LE32) * xcounts[ic];
set_le32(orelocs + sorelocs, 0); set_le32(orelocs + sorelocs, 0);
if (xcounts[ic]) { if (xcounts[ic]) {
sorelocs += 4; sorelocs += 4;
@@ -1224,7 +1225,15 @@ void PeFile::Export::convert(unsigned eoffs, unsigned esize) {
size += len; size += len;
iv.add_interval(edir.name, len); iv.add_interval(edir.name, len);
len = 4 * edir.functions; // This test is weak because it does not consider other necessary storage.
// But it does detect outrageous individual members.
// Note: sizeof(LE32) <= sizeof(char *)
if (UPX_RSIZE_MAX_MEM / sizeof(char *) <= edir.functions ||
UPX_RSIZE_MAX_MEM / sizeof(char *) <= edir.names) {
throwCantPack("export directory too big: functions=%#x names=%#x",
(unsigned) edir.functions, (unsigned) edir.names);
}
len = sizeof(LE32) * edir.functions;
functionptrs = New(char, len + 1); functionptrs = New(char, len + 1);
memcpy(functionptrs, base + edir.addrtable, len); memcpy(functionptrs, base + edir.addrtable, len);
size += len; size += len;
@@ -1233,14 +1242,14 @@ void PeFile::Export::convert(unsigned eoffs, unsigned esize) {
unsigned ic; unsigned ic;
names = New(char *, edir.names + edir.functions + 1); names = New(char *, edir.names + edir.functions + 1);
for (ic = 0; ic < edir.names; ic++) { for (ic = 0; ic < edir.names; ic++) {
char *n = base + get_le32(base + edir.nameptrtable + ic * 4); char *n = base + get_le32(base + edir.nameptrtable + ic * sizeof(LE32));
len = strlen(n) + 1; len = strlen(n) + 1;
names[ic] = strdup(n); names[ic] = strdup(n);
size += len; size += len;
iv.add_interval(get_le32(base + edir.nameptrtable + ic * 4), len); iv.add_interval(get_le32(base + edir.nameptrtable + ic * sizeof(LE32)), len);
} }
iv.add_interval(edir.nameptrtable, 4 * edir.names); iv.add_interval(edir.nameptrtable, sizeof(LE32) * edir.names);
size += 4 * edir.names; size += sizeof(LE32) * edir.names;
LE32 *fp = (LE32 *) functionptrs; LE32 *fp = (LE32 *) functionptrs;
// export forwarders // export forwarders
@@ -1270,8 +1279,8 @@ void PeFile::Export::convert(unsigned eoffs, unsigned esize) {
void PeFile::Export::build(char *newbase, unsigned newoffs) { void PeFile::Export::build(char *newbase, unsigned newoffs) {
char *const functionp = newbase + sizeof(edir); char *const functionp = newbase + sizeof(edir);
char *const namep = functionp + 4 * edir.functions; char *const namep = functionp + sizeof(LE32) * edir.functions;
char *const ordinalp = namep + 4 * edir.names; char *const ordinalp = namep + sizeof(LE32) * edir.names;
char *const enamep = ordinalp + 2 * edir.names; char *const enamep = ordinalp + 2 * edir.names;
char *exports = enamep + strlen(ename) + 1; char *exports = enamep + strlen(ename) + 1;
@@ -1286,15 +1295,15 @@ void PeFile::Export::build(char *newbase, unsigned newoffs) {
unsigned ic; unsigned ic;
for (ic = 0; ic < edir.names; ic++) { for (ic = 0; ic < edir.names; ic++) {
strcpy(exports, names[ic]); strcpy(exports, names[ic]);
set_le32(namep + 4 * ic, newoffs + ptr_diff_bytes(exports, newbase)); set_le32(namep + sizeof(LE32) * ic, newoffs + ptr_diff_bytes(exports, newbase));
exports += strlen(exports) + 1; exports += strlen(exports) + 1;
} }
memcpy(functionp, functionptrs, 4 * edir.functions); memcpy(functionp, functionptrs, sizeof(LE32) * edir.functions);
for (ic = 0; ic < edir.functions; ic++) for (ic = 0; ic < edir.functions; ic++)
if (names[edir.names + ic]) { if (names[edir.names + ic]) {
strcpy(exports, names[edir.names + ic]); strcpy(exports, names[edir.names + ic]);
set_le32(functionp + 4 * ic, newoffs + ptr_diff_bytes(exports, newbase)); set_le32(functionp + sizeof(LE32) * ic, newoffs + ptr_diff_bytes(exports, newbase));
exports += strlen(exports) + 1; exports += strlen(exports) + 1;
} }
@@ -1477,12 +1486,13 @@ void PeFile::processTls2(Reloc *const rel, const Interval *const iv, unsigned ne
unsigned ic; unsigned ic;
// NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann // NEW: if TLS callbacks are used, relocate the VA of the callback chain, too - Stefan Widmann
for (ic = 0; ic < (use_tls_callbacks ? 4 * cb_size : 3 * cb_size); ic += cb_size) for (ic = 0; ic < (use_tls_callbacks ? sizeof(LE32) * cb_size : (sizeof(LE32) - 1) * cb_size);
ic += cb_size)
rel->add_reloc(newaddr + ic, reloc_type); rel->add_reloc(newaddr + ic, reloc_type);
SPAN_S_VAR(tls, const tlsp, mb_otls); SPAN_S_VAR(tls, const tlsp, mb_otls);
// now the relocation entries in the tls data area // now the relocation entries in the tls data area
for (ic = 0; ic < iv->ivnum; ic += 4) { for (ic = 0; ic < iv->ivnum; ic += sizeof(LE32)) {
SPAN_S_VAR(byte, const pp, SPAN_S_VAR(byte, const pp,
otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls))); otls + (iv->ivarr[ic].start - (tlsp->datastart - imagebase) + sizeof(tls)));
LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX)); LEXX *const p = (LEXX *) raw_bytes(pp, sizeof(LEXX));
@@ -2760,12 +2770,12 @@ void PeFile::rebuildRelocs(SPAN_S(byte) & extra_info, unsigned bits, unsigned fl
SPAN_S_VAR(byte, const wrkmem, mb_wrkmem); SPAN_S_VAR(byte, const wrkmem, mb_wrkmem);
for (unsigned ic = 0; ic < relocnum; ic++) { for (unsigned ic = 0; ic < relocnum; ic++) {
OPTR_VAR(byte, const p, obuf + get_le32(wrkmem + 4 * ic)); OPTR_VAR(byte, const p, obuf + get_le32(wrkmem + sizeof(LE32) * ic));
if (bits == 32) if (bits == 32)
set_le32(p, get_le32(p) + imagebase + rvamin); set_le32(p, get_le32(p) + imagebase + rvamin);
else else
set_le64(p, get_le64(p) + imagebase + rvamin); set_le64(p, get_le64(p) + imagebase + rvamin);
rel.add_reloc(rvamin + get_le32(wrkmem + 4 * ic), rel.add_reloc(rvamin + get_le32(wrkmem + sizeof(LE32) * ic),
bits == 32 ? IMAGE_REL_BASED_HIGHLOW : IMAGE_REL_BASED_DIR64); bits == 32 ? IMAGE_REL_BASED_HIGHLOW : IMAGE_REL_BASED_DIR64);
} }
rel.finish(oxrelocs, soxrelocs); rel.finish(oxrelocs, soxrelocs);
+70 -1
View File
@@ -42,6 +42,8 @@ endif
# ************************************************************************/ # ************************************************************************/
ifndef STUBS ifndef STUBS
STUBS += riscv64-linux.elf-entry.h
STUBS += riscv64-linux.elf-fold.h
STUBS += amd64-darwin.dylib-entry.h STUBS += amd64-darwin.dylib-entry.h
STUBS += amd64-darwin.macho-entry.h STUBS += amd64-darwin.macho-entry.h
STUBS += amd64-darwin.macho-fold.h STUBS += amd64-darwin.macho-fold.h
@@ -320,7 +322,7 @@ define tc.default.f-embed_objinfo_without_xstrip_keep_dot_text
chmod a-x $1 chmod a-x $1
$(call tc,objcopy) -R .data -R .bss $1 $(call tc,objcopy) -R .data -R .bss $1
$(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1 $(call tc,objcopy) -R .comment -R .note -R .note.GNU-stack -R .reginfo $1
$(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main $1 $(call tc,objcopy) --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main --keep-symbol=str_upx $1
# #
# Disassemble for human readability # Disassemble for human readability
# objdump # objdump
@@ -550,6 +552,7 @@ amd64-win64.pe.h : tc_objdump_disasm_options = -M intel-mnemonic
tc.amd64-win64.pe.gcc = amd64-linux-gcc-4.1.1 -m64 -nostdinc -DWINDOWS_BACK=1 -MMD -MT $@ tc.amd64-win64.pe.gcc = amd64-linux-gcc-4.1.1 -m64 -nostdinc -DWINDOWS_BACK=1 -MMD -MT $@
tc.amd64-win64.pe.gcc += -fno-exceptions -fno-asynchronous-unwind-tables tc.amd64-win64.pe.gcc += -fno-exceptions -fno-asynchronous-unwind-tables
tc.amd64-win64.pe.gcc += -mno-red-zone
tc.amd64-win64.pe.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror tc.amd64-win64.pe.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
tc.amd64-win64.pe.objdump = multiarch-objdump-2.23.90 tc.amd64-win64.pe.objdump = multiarch-objdump-2.23.90
@@ -2181,6 +2184,72 @@ powerpc64-linux.kernel.vmlinux-head.h : $(srcdir)/src/$$T.S
$(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin $(call tc,objcopy) --output-target binary --only-section .text tmp/$T.o tmp/$T.bin
$(call tc,bin2h) tmp/$T.bin $@ $(call tc,bin2h) tmp/$T.bin $@
# =====
# /***********************************************************************
# // riscv64-linux.elf
# ************************************************************************/
riscv64-linux.elf%.h : tc_list = riscv64-linux.elf default
riscv64-linux.elf%.h : tc_bfdname = elf64-littleriscv64
tc.riscv64-linux.elf.gcc = /usr/bin/riscv64-linux-gnu-gcc -nostdinc -MMD -MT $@
tc.riscv64-linux.elf.gcc += -fno-exceptions -fno-asynchronous-unwind-tables # -fno-stack-protector
tc.riscv64-linux.elf.gcc += -Wall -W -Wcast-align -Wcast-qual -Wstrict-prototypes -Wwrite-strings -Werror
tc.riscv64-linux.elf.objcopy = /usr/bin/riscv64-linux-gnu-objcopy
# Override of objcopy is needed because:
# multiarch-objcopy-2.17 -F elf64-littleriscv64 --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main tmp/riscv64-linux.elf-entry.bin
# multiarch-objcopy-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
tc.riscv64-linux.elf.objdump = /usr/bin/riscv64-linux-gnu-objdump
# Override of objdump is needed because:
# multiarch-objdump-2.17 -b elf64-littleriscv64 -Dr tmp/riscv64-linux.elf-entry.bin | sed -e 's/[ ]*$//' > tmp/riscv64-linux.elf-entry.bin.disasm
# multiarch-objdump-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
# multiarch-objdump-2.17 -b elf64-littleriscv64 -htr -w tmp/riscv64-linux.elf-entry.bin | sed -e 's/[ ]*$//' | cat --squeeze-blank | sed -e '1{/^$/d}' -e '${/^$/d}' | sed -e '1s/^.*: *file format/file format/' -e 's/ / /g' -e 's/ 00*/ 0/g' -e 's/CONTENTS.*/CONTENTS/' > tmp/riscv64-linux.elf-entry.bin.dump
# multiarch-objdump-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
tc.riscv64-linux.elf.ld = /usr/bin/riscv64-linux-gnu-ld
# Override of ld is needed because:
# multiarch-objcopy-2.17 -F elf64-littleriscv64 --strip-unneeded --keep-symbol=_start --keep-symbol=upx_so_main tmp/riscv64-linux.elf-entry.bin
# multiarch-objcopy-2.17: tmp/riscv64-linux.elf-entry.bin: Invalid bfd target
riscv64-linux.elf-entry.h : $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o tmp/$T.bin
$(call tc,f-embed_objinfo,tmp/$T.bin)
$(call tc,bin2h) tmp/$T.bin $@
riscv64-linux.elf-fold.h : $(srcdir)/src/$$T.lds \
tmp/$$T.o \
tmp/riscv64-linux.elf-help_umf.o \
tmp/riscv64-linux.elf-upxfd_linux.o \
tmp/riscv64-expand.o \
tmp/riscv64-linux.elf-main2.o
$(call tc,ld) -r -Map tmp/$T.map $(filter %.o,$^) -o tmp/$T.bin
$(call tc,f-embed_objinfo_without_xstrip_keep_dot_text,tmp/$T.bin)
$(call tc,bin2h) tmp/$T.bin $@
tmp/riscv64-linux.elf-fold.o : $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
$(call tc,f-objstrip,$@)
tmp/riscv64-linux.elf-main2.o : $(srcdir)/src/$$T.c $(srcdir)/src/i386-linux.elf-main2.c
$(call tc,gcc) -c $< -o $@
$(call tc,f-objstrip,$@)
tmp/riscv64-linux.elf-help_umf.o: $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
tmp/riscv64-linux.elf-upxfd_linux.o : $(srcdir)/src/upxfd_linux.c
$(call tc,gcc) -c -O $< -o $@
$(call tc,objcopy) --strip-unneeded --rename-section .text=UMF_LINUX \
-R .riscv.attributes -R .data -R .bss -R .note.GNU-stack $@
$(call tc,objdump) -Dr $(tc_objdump_disasm_options) $@ | $(RTRIM) > $@.disasm
tmp/riscv64-expand.o: $(srcdir)/src/$$T.S
$(call tc,gcc) -c $< -o $@
# =====
# /*********************************************************************** # /***********************************************************************
# // dependencies # // dependencies
+182 -74
View File
@@ -1,5 +1,5 @@
/* amd64-linux.elf-entry.h /* amd64-linux.elf-entry.h
created from amd64-linux.elf-entry.bin, 1141 (0x475) bytes created from amd64-linux.elf-entry.bin, 2869 (0xb35) bytes
This file is part of the UPX executable compressor. This file is part of the UPX executable compressor.
@@ -32,81 +32,189 @@
/* clang-format off */ /* clang-format off */
#define STUB_AMD64_LINUX_ELF_ENTRY_SIZE 1141 #define STUB_AMD64_LINUX_ELF_ENTRY_SIZE 2869
#define STUB_AMD64_LINUX_ELF_ENTRY_ADLER32 0xd3b74a90 #define STUB_AMD64_LINUX_ELF_ENTRY_ADLER32 0xf865154a
#define STUB_AMD64_LINUX_ELF_ENTRY_CRC32 0x52b418e2 #define STUB_AMD64_LINUX_ELF_ENTRY_CRC32 0xe81955ed
unsigned char stub_amd64_linux_elf_entry[1141] = { unsigned char stub_amd64_linux_elf_entry[2869] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0, 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 */ 1, 0, 62, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 16, 2, 0, 0, 0, 0, 0, 0, /* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 80, 5, 0, 0, 0, 0, 0, 0,
/* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, /* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0,
/* 0x0040 */ 243, 15, 30,250, 89, 84, 95, 81, 82, 49,192, 72,175,117,252, 72, /* 0x0040 */ 243, 15, 30,250, 89, 84, 95, 81, 82, 76,141, 61, 0, 0, 0, 0,
/* 0x0050 */ 175,117,252, 87,186, 0, 16, 0, 0, 94, 72,173,133,192,116, 8, /* 0x0050 */ 87, 41,210, 82, 72,141, 5, 45, 0, 0, 0, 80,104, 4, 0, 0,
/* 0x0060 */ 131,248, 6, 72,173,117,243,146, 88, 72,247,218, 82, 80,104,117, /* 0x0060 */ 4, 72,141, 5, 43, 0, 0, 0, 80, 76,141, 61,219, 2, 0, 0,
/* 0x0070 */ 112, 88, 0, 84, 95,106, 16, 94,184, 63, 1, 0, 0, 15, 5,133, /* 0x0070 */ 84, 94,106, 11, 95,106, 8, 65, 90,106, 13, 88, 15, 5, 72,131,
/* 0x0080 */ 192,121, 29,133,246,116, 4, 49,246,235,237, 72,141, 53, 28, 1, /* 0x0080 */ 196, 32, 95,233,216, 2, 0, 0,243, 15, 30,250,184, 15, 0, 0,
/* 0x0090 */ 0, 0,173,146,173, 86,150, 95,106, 2, 88,232, 0, 1, 0, 0, /* 0x0090 */ 0, 15, 5,243, 15, 30,250, 82,186, 26, 0, 0, 0, 72,141, 53,
/* 0x00a0 */ 73,137,196, 89, 72,141, 61,145,255,255,255,139, 15, 72, 41,207, /* 0x00a0 */ 111, 0, 0, 0,106, 2, 95,106, 1, 88, 15, 5, 49,246, 72,141,
/* 0x00b0 */ 72,141, 53, 0, 0, 0, 0,173,147, 65,137,221,173,146,131,194, /* 0x00b0 */ 61,120, 0, 0, 0,106, 2, 88, 15, 5, 73,137,196,187, 0, 16,
/* 0x00c0 */ 16, 82,106,255, 87, 72, 41,217, 81, 72, 1,251, 83, 84, 93, 72, /* 0x00c0 */ 0, 0, 72, 41,220,137,218, 84, 94, 76,137,231, 49,192, 15, 5,
/* 0x00d0 */ 41,212, 72,131,228,192, 84, 95,173, 80,173,102,131,248, 2,116, /* 0x00d0 */ 133,192,126, 14,137,194, 84, 94,106, 2, 95,106, 1, 88, 15, 5,
/* 0x00e0 */ 1,244, 88, 72, 1,240, 80, 85, 49,219, 49,201, 72,141, 21,204, /* 0x00e0 */ 235,227, 76,137,231, 72, 1,220,106, 3, 88, 15, 5, 90,106, 57,
/* 0x00f0 */ 0, 0, 0,106,255, 93,252,168,164,255,210,114,251,141, 65, 1, /* 0x00f0 */ 88,232, 0, 0, 0, 0,133,192, 15,132,141, 1, 0, 0,235,254,
/* 0x0100 */ 255,210, 17,192,255,210,115,248,131,232, 3,114, 12,193,224, 8, /* 0x0100 */ 47,112,114,111, 99, 47,115,101,108,102, 47, 99,109,100,108,105,
/* 0x0110 */ 172,131,240,255,116, 47, 72, 99,232,141, 65, 1,255,210, 17,201, /* 0x0110 */ 110,101, 0, 10, 10, 83, 73, 71, 83, 69, 71, 86, 32, 97,100,100,
/* 0x0120 */ 255,210, 17,201,117, 13,137,193,131,192, 2,255,210, 17,201,255, /* 0x0120 */ 114,101,115,115, 32,115,112, 97, 99,101, 58, 10, 0, 47,112,114,
/* 0x0130 */ 210,115,248,129,253, 0,243,255,255, 17,193, 86, 72,141, 52, 47, /* 0x0130 */ 111, 99, 47,115,101,108,102, 47,109, 97,112,115, 0, 45,113, 0,
/* 0x0140 */ 243,164, 94,235,180, 93, 89, 72, 57,206,116, 1,244, 72,139, 69, /* 0x0140 */ 47,117,115,114, 47, 98,105,110, 47,103,100, 98, 0,115,101,116,
/* 0x0150 */ 48, 72,137, 4, 36, 72,139, 85, 32, 72,131,234, 16, 84, 94, 76, /* 0x0150 */ 32,112,114,111,109,112,116, 10,105,110,102,111, 32,105,110,102,
/* 0x0160 */ 137,231, 82,106, 1, 88,232, 53, 0, 0, 0, 72, 1,198, 41,194, /* 0x0160 */ 101,114,105,111,114,115, 10,112,114,105,110,116, 32, 34,114, 56,
/* 0x0170 */ 117,241, 94, 85, 92, 77, 49,201, 77,137,224,106, 1, 65, 90,106, /* 0x0170 */ 32, 45, 32,114, 49, 53, 34, 10,120, 47, 56,120,103, 32, 36,114,
/* 0x0180 */ 5, 90, 41,255,106, 9, 88,232, 20, 0, 0, 0, 80, 72,137, 69, /* 0x0180 */ 100,120, 32, 43, 32, 53, 42, 56, 10,112,114,105,110,116, 32, 34,
/* 0x0190 */ 24, 65, 80, 95,106, 3, 88, 15, 5, 88, 72,131,192, 8,255,224, /* 0x0190 */ 114,100,105, 44, 32,114,115,105, 44, 32,114, 98,112, 44, 32,114,
/* 0x01a0 */ 80, 15, 5, 89, 72, 61, 0,240,255,255,114, 1,244,195,192, 1, /* 0x01a0 */ 98,120, 34, 10,120, 47, 52,120,103, 10,112,114,105,110,116, 32,
/* 0x01b0 */ 0, 0, 2, 0, 65, 0, 47,100,101,118, 47,115,104,109, 0,243, /* 0x01b0 */ 34,114,100,120, 44, 32,114, 97,120, 44, 32,114, 99,120, 44, 32,
/* 0x01c0 */ 15, 30,250, 1,219,116, 2,243,195,139, 30, 72,131,238,252, 17, /* 0x01c0 */ 114,115,112, 34, 10,120, 47, 52,120,103, 10,112,114,105,110,116,
/* 0x01d0 */ 219,243,195, 0, 0, 0, 0, 0,102,105,108,101, 32,102,111,114, /* 0x01d0 */ 32, 34,114,105,112, 44, 32,101,102,108, 34, 10,120, 47, 50,120,
/* 0x01e0 */ 109, 97,116, 32,101,108,102, 54, 52, 45,120, 56, 54, 45, 54, 52, /* 0x01e0 */ 103, 10,115,101,116, 32, 36,112, 99, 32, 61, 32, 42, 40,108,111,
/* 0x01f0 */ 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120, 32, /* 0x01f0 */ 110,103, 32, 42, 41, 40, 36,114,100,120, 32, 43, 32, 49, 54, 56,
/* 0x0200 */ 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105, /* 0x0200 */ 41, 10,112,114,105,110,116, 32, 34,102, 97,117,108,116,105,110,
/* 0x0210 */ 122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32, /* 0x0210 */ 103, 32,105,110,115,116,114, 34, 10,120, 47,105, 32, 36,112, 99,
/* 0x0220 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, 32, /* 0x0220 */ 10,112,114,105,110,116, 32, 34,102, 97,117,108,116, 32, 99,111,
/* 0x0230 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70,105,108,101, /* 0x0230 */ 110,116,101,120,116, 34, 10,120, 47, 49, 54,105, 32, 36,112, 99,
/* 0x0240 */ 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97,103, /* 0x0240 */ 32, 45, 32, 48,120, 50, 48, 10,112,114,105,110,116, 32, 34,117,
/* 0x0250 */ 115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32, /* 0x0250 */ 115,101,114, 32,115,116, 97, 99,107, 34, 10,120, 47, 54, 52,120,
/* 0x0260 */ 32, 32, 32, 32, 48, 49, 57, 51, 32, 32, 48, 32, 32, 48, 32, 32, /* 0x0260 */ 103, 32, 42, 40,108,111,110,103, 32, 42, 41, 40, 36,114,100,120,
/* 0x0270 */ 48, 52, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, /* 0x0270 */ 32, 43, 32, 53, 42, 56, 32, 43, 32, 49, 53, 42, 56, 41, 10,107,
/* 0x0280 */ 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77, 65, 73, 78, 90, /* 0x0280 */ 105,108,108, 10,113,117,105,116, 32, 49, 0, 72,129,236, 0, 16,
/* 0x0290 */ 32, 32, 32, 32, 32, 32, 48, 52, 32, 32, 48, 32, 32, 48, 32, 32, /* 0x0290 */ 0, 0, 72,141, 61,103,254,255,255,106, 0, 94,106, 2, 88,232,
/* 0x02a0 */ 48, 49,100, 52, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, /* 0x02a0 */ 0, 0, 0, 0, 80, 95, 84, 94,104, 0, 16, 0, 0, 90,106, 0,
/* 0x02b0 */ 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, /* 0x02b0 */ 88,232, 0, 0, 0, 0,106, 3, 88,232, 0, 0, 0, 0,106,110,
/* 0x02c0 */ 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x02c0 */ 88, 15, 5, 80, 94, 49,192, 80, 80, 84, 95,232, 89, 0, 0, 0,
/* 0x02d0 */ 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, /* 0x02d0 */ 84, 94,106, 0, 86, 72,131,198, 16, 86, 72,141, 5, 92,254,255,
/* 0x02e0 */ 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, /* 0x02e0 */ 255, 80, 72,131,192, 3, 80, 49,255,106, 3, 88, 15, 5, 80, 84,
/* 0x02f0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x02f0 */ 95,106, 22, 88,232, 0, 0, 0, 0, 95, 72,193,239, 32,104, 62,
/* 0x0300 */ 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, /* 0x0300 */ 1, 0, 0, 90, 72,141, 53, 66,254,255,255,106, 1, 88,232, 0,
/* 0x0310 */ 88, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, /* 0x0310 */ 0, 0, 0,106, 3, 88, 15, 5,106, 0, 90, 84, 94, 72,139, 62,
/* 0x0320 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, /* 0x0320 */ 106, 59, 88,232, 0, 0, 0, 0,244,106, 10, 89,137,240,232, 4,
/* 0x0330 */ 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, /* 0x0330 */ 0, 0, 0,198, 7, 0,195, 49,210,247,241, 82,133,192,116, 5,
/* 0x0340 */ 32, 95,115,116, 97,114,116, 10, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x0340 */ 232,242,255,255,255, 88,131,192, 48,170,195,243, 15, 30,250,106,
/* 0x0350 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x0350 */ 8, 65, 90, 49,210, 49,246,106, 11, 95,106, 13, 88, 15, 5,195,
/* 0x0360 */ 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66, 73, 78, 70, 79, /* 0x0360 */ 49,192, 72,175,117,252, 72,175,117,252, 87,186, 0, 16, 0, 0,
/* 0x0370 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, /* 0x0370 */ 94, 72,173,133,192,116, 8,131,248, 6, 72,173,117,243,146, 88,
/* 0x0380 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, /* 0x0380 */ 72,247,218, 82, 80,104,117,112, 88, 0, 84, 95,106, 16, 94,184,
/* 0x0390 */ 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, /* 0x0390 */ 63, 1, 0, 0, 15, 5,133,192,121, 29,133,246,116, 4, 49,246,
/* 0x03a0 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, /* 0x03a0 */ 235,237, 72,141, 53, 38, 1, 0, 0,173,146,173, 86,150, 95,106,
/* 0x03b0 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, /* 0x03b0 */ 2, 88,232, 10, 1, 0, 0, 73,137,196, 89, 72,141, 61, 0, 0,
/* 0x03c0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 55, 51, 32, 82, /* 0x03c0 */ 0, 0,139, 15, 72, 41,207, 72,141, 53, 0, 0, 0, 0,173,147,
/* 0x03d0 */ 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32, /* 0x03d0 */ 65,137,221,173,146,131,194, 16, 82,106,255, 87, 72, 41,217, 81,
/* 0x03e0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120,102,102,102,102, /* 0x03e0 */ 72, 1,251, 83, 84, 93, 72, 41,212, 72,131,228,192, 84, 95,173,
/* 0x03f0 */ 102,102,102,102,102,102,102,102,102,102,102, 99, 10, 10, 82, 69, /* 0x03f0 */ 80,173,102,131,248, 2,116, 1,244, 88, 72, 1,240, 80, 85, 49,
/* 0x0400 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, /* 0x0400 */ 219, 49,201, 72,141, 21,214, 0, 0, 0,106,255, 93,252,168,164,
/* 0x0410 */ 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58, /* 0x0410 */ 255,210,114,251,141, 65, 1,255,210, 17,192,255,210,115,248,131,
/* 0x0420 */ 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x0420 */ 232, 3,114, 12,193,224, 8,172,131,240,255,116, 47, 72, 99,232,
/* 0x0430 */ 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x0430 */ 141, 65, 1,255,210, 17,201,255,210, 17,201,117, 13,137,193,131,
/* 0x0440 */ 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, /* 0x0440 */ 192, 2,255,210, 17,201,255,210,115,248,129,253, 0,243,255,255,
/* 0x0450 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 88, 56, 54, /* 0x0450 */ 17,193, 86, 72,141, 52, 47,243,164, 94,235,180, 93, 89, 72, 57,
/* 0x0460 */ 95, 54, 52, 95, 51, 50, 32, 32, 32, 32, 32, 32, 32, 79, 95, 66, /* 0x0460 */ 206,116, 1,244, 72,139, 69, 48, 72,137, 4, 36, 76,137,124, 36,
/* 0x0470 */ 73, 78, 70, 79, 10 /* 0x0470 */ 8, 72,139, 85, 32, 72,131,234, 16, 84, 94, 76,137,231, 82,106,
/* 0x0480 */ 1, 88,232, 58, 0, 0, 0, 72, 1,198, 41,194,117,241, 94, 85,
/* 0x0490 */ 92, 77, 49,201, 77,137,224,106, 1, 65, 90,106, 5, 90, 41,255,
/* 0x04a0 */ 106, 9, 88,232, 25, 0, 0, 0, 80, 72,137, 69, 24, 65, 80, 95,
/* 0x04b0 */ 106, 3, 88, 15, 5, 88, 72,131,192, 16,255,224,243, 15, 30,250,
/* 0x04c0 */ 195, 80, 15, 5, 89, 72, 61, 0,240,255,255,114, 1,244,195,192,
/* 0x04d0 */ 1, 0, 0, 2, 0, 65, 0, 47,100,101,118, 47,115,104,109, 0,
/* 0x04e0 */ 243, 15, 30,250, 1,219,116, 2,243,195,139, 30, 72,131,238,252,
/* 0x04f0 */ 17,219,243,195, 0, 0, 0, 0,102,105,108,101, 32,102,111,114,
/* 0x0500 */ 109, 97,116, 32,101,108,102, 54, 52, 45,120, 56, 54, 45, 54, 52,
/* 0x0510 */ 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73,100,120, 32,
/* 0x0520 */ 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 83,105,
/* 0x0530 */ 122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, 32, 32, 32,
/* 0x0540 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, 32, 32, 32,
/* 0x0550 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70,105,108,101,
/* 0x0560 */ 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70,108, 97,103,
/* 0x0570 */ 115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 32,
/* 0x0580 */ 32, 32, 32, 32, 48, 49, 48, 32, 32, 48, 32, 32, 48, 32, 32, 48,
/* 0x0590 */ 52, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78,
/* 0x05a0 */ 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 83, 73, 71, 83, 69, 71,
/* 0x05b0 */ 86, 32, 32, 32, 32, 48, 51, 49, 48, 32, 32, 48, 32, 32, 48, 32,
/* 0x05c0 */ 32, 48, 53, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, 78, 84,
/* 0x05d0 */ 69, 78, 84, 83, 10, 32, 32, 50, 32, 69, 76, 70, 77, 65, 73, 78,
/* 0x05e0 */ 88, 50, 32, 32, 32, 32, 32, 48, 49, 57, 52, 32, 32, 48, 32, 32,
/* 0x05f0 */ 48, 32, 32, 48, 51, 54, 48, 32, 32, 50, 42, 42, 48, 32, 32, 67,
/* 0x0600 */ 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 51, 32, 69, 76, 70, 77,
/* 0x0610 */ 65, 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 52, 32, 32, 48, 32,
/* 0x0620 */ 32, 48, 32, 32, 48, 52,102, 52, 32, 32, 50, 42, 42, 50, 32, 32,
/* 0x0630 */ 67, 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32,
/* 0x0640 */ 84, 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0650 */ 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32,
/* 0x0660 */ 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70, 77, 65,
/* 0x0670 */ 73, 78, 88, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0680 */ 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70,
/* 0x0690 */ 77, 65, 73, 78, 88, 50, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78,
/* 0x06a0 */ 88, 50, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x06b0 */ 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77,
/* 0x06c0 */ 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10,
/* 0x06d0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x06e0 */ 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 83, 73, 71, 83,
/* 0x06f0 */ 69, 71, 86, 32, 48, 32, 69, 76, 70, 83, 73, 71, 83, 69, 71, 86,
/* 0x0700 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0710 */ 48, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73,
/* 0x0720 */ 78, 88, 32, 48, 32, 95,115,116, 97,114,116, 10, 48, 48, 48, 48,
/* 0x0730 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32,
/* 0x0740 */ 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66,
/* 0x0750 */ 73, 78, 70, 79, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78,
/* 0x0760 */ 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76,
/* 0x0770 */ 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32,
/* 0x0780 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32,
/* 0x0790 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85,
/* 0x07a0 */ 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x07b0 */ 48, 99, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50,
/* 0x07c0 */ 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,
/* 0x07d0 */ 120, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,
/* 0x07e0 */ 56, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69,
/* 0x07f0 */ 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 83, 73,
/* 0x0800 */ 71, 83, 69, 71, 86, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32,
/* 0x0810 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32,
/* 0x0820 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69,
/* 0x0830 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 97,
/* 0x0840 */ 50, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x0850 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x0860 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x0870 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 53,
/* 0x0880 */ 48, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x0890 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x08a0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x08b0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 54,
/* 0x08c0 */ 50, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x08d0 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x08e0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x08f0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 54,
/* 0x0900 */ 97, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x0910 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x0920 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x0930 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 97,
/* 0x0940 */ 53, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x0950 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x0960 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x0970 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, 98,
/* 0x0980 */ 102, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x0990 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x09a0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x09b0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 50,100,
/* 0x09c0 */ 52, 32, 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32,
/* 0x09d0 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120,
/* 0x09e0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 53,100,
/* 0x09f0 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
/* 0x0a00 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73,
/* 0x0a10 */ 78, 88, 50, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32,
/* 0x0a20 */ 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32,
/* 0x0a30 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48,
/* 0x0a40 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 53,101, 32,
/* 0x0a50 */ 82, 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32,
/* 0x0a60 */ 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 43, 48,120,102,102,102,
/* 0x0a70 */ 102,102,102,102,102,102,102,102,102,102,102,102, 56, 10, 48, 48,
/* 0x0a80 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 54, 97, 32, 82,
/* 0x0a90 */ 95, 88, 56, 54, 95, 54, 52, 95, 80, 67, 51, 50, 32, 32, 32, 32,
/* 0x0aa0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120,102,102,102,102,
/* 0x0ab0 */ 102,102,102,102,102,102,102,102,102,102,102, 99, 10, 10, 82, 69,
/* 0x0ac0 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83,
/* 0x0ad0 */ 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 90, 93, 58,
/* 0x0ae0 */ 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0af0 */ 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0b00 */ 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48,
/* 0x0b10 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82, 95, 88, 56, 54,
/* 0x0b20 */ 95, 54, 52, 95, 51, 50, 32, 32, 32, 32, 32, 32, 32, 79, 95, 66,
/* 0x0b30 */ 73, 78, 70, 79, 10
}; };
+1314 -1313
View File
File diff suppressed because it is too large Load Diff
+1184 -1181
View File
File diff suppressed because it is too large Load Diff
+962 -834
View File
File diff suppressed because it is too large Load Diff
+2267 -2270
View File
File diff suppressed because it is too large Load Diff
+969 -840
View File
File diff suppressed because it is too large Load Diff
+2275 -2278
View File
File diff suppressed because it is too large Load Diff
+188 -106
View File
@@ -1,5 +1,5 @@
/* arm64-linux.elf-entry.h /* arm64-linux.elf-entry.h
created from arm64-linux.elf-entry.bin, 1656 (0x678) bytes created from arm64-linux.elf-entry.bin, 2971 (0xb9b) bytes
This file is part of the UPX executable compressor. This file is part of the UPX executable compressor.
@@ -32,113 +32,195 @@
/* clang-format off */ /* clang-format off */
#define STUB_ARM64_LINUX_ELF_ENTRY_SIZE 1656 #define STUB_ARM64_LINUX_ELF_ENTRY_SIZE 2971
#define STUB_ARM64_LINUX_ELF_ENTRY_ADLER32 0xebefbc2c #define STUB_ARM64_LINUX_ELF_ENTRY_ADLER32 0x0d9b4202
#define STUB_ARM64_LINUX_ELF_ENTRY_CRC32 0x6e19662b #define STUB_ARM64_LINUX_ELF_ENTRY_CRC32 0x7209b84d
unsigned char stub_arm64_linux_elf_entry[1656] = { unsigned char stub_arm64_linux_elf_entry[2971] = {
/* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0000 */ 127, 69, 76, 70, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0010 */ 1, 0,183, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x0010 */ 1, 0,183, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 64, 4, 0, 0, 0, 0, 0, 0, /* 0x0020 */ 0, 0, 0, 0, 0, 0, 0, 0, 64, 8, 0, 0, 0, 0, 0, 0,
/* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, /* 0x0030 */ 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0,
/* 0x0040 */ 0, 0, 0, 0,224, 7,191,169,211,255,255, 24,224, 99, 0,145, /* 0x0040 */ 0, 0, 0, 0,224, 7,191,169,211,255,255, 24, 18, 0, 0, 16,
/* 0x0050 */ 76, 0, 0,148, 75, 0, 0,148,246, 3, 0,170,255,131, 0,209, /* 0x0050 */ 32, 20, 0, 16,129, 0,128,210,224, 7,188,169,255, 15, 0,249,
/* 0x0060 */ 1, 8,193,168, 63, 24, 0,113, 96, 0, 0, 84,161,255,255, 53, /* 0x0060 */ 255, 19, 0,249, 3, 1,128,210,226, 3, 31,170,225, 3, 0,145,
/* 0x0070 */ 34, 0,160,210,250, 3, 2,203,250, 3, 0,249, 0, 0, 0,148, /* 0x0070 */ 96, 1,128, 82,200, 16,128, 82, 1, 0, 0,212,255, 3, 1,145,
/* 0x0080 */ 244, 3, 30,170, 1, 2,128, 82, 0, 0, 0, 16,232, 34,128, 82, /* 0x0080 */ 114, 25, 0, 16,209, 0, 0, 20, 47,112,114,111, 99, 47,115,101,
/* 0x0090 */ 1, 0, 0,212, 0, 2,248, 54, 97, 0, 0, 52,225, 3, 31, 42, /* 0x0090 */ 108,102, 47, 99,109,100,108,105,110,101, 0, 10, 10, 83, 73, 71,
/* 0x00a0 */ 250,255,255, 23, 6, 0, 0,148,192, 1, 0, 0, 2, 64, 64, 0, /* 0x00a0 */ 83, 69, 71, 86, 32, 97,100,100,114,101,115,115, 32,115,112, 97,
/* 0x00b0 */ 47,100,101,118, 47,115,104,109, 0, 0, 0, 0,195, 71, 64,184, /* 0x00b0 */ 99,101, 58, 10, 0, 47,112,114,111, 99, 47,115,101,108,102, 47,
/* 0x00c0 */ 194, 71, 64,184,225, 3, 30,170, 96, 12,128, 18, 8, 7,128, 82, /* 0x00c0 */ 109, 97,112,115, 0, 45,113, 0, 47,117,115,114, 47, 98,105,110,
/* 0x00d0 */ 1, 0, 0,212,251, 3, 0, 42,128, 6, 64,185,253, 3, 0,145, /* 0x00d0 */ 47,103,100, 98, 0,115,101,116, 32,112,114,111,109,112,116, 10,
/* 0x00e0 */ 160, 3, 0,203, 0,236,124,146, 31, 0, 0,145,226, 3, 0,170, /* 0x00e0 */ 105,110,102,111, 32,105,110,102,101,114,105,111,114,115, 10,112,
/* 0x00f0 */ 225, 15, 31,248,227, 3, 0,145,128, 66, 0,145,129, 10, 64,185, /* 0x00f0 */ 114,105,110,116, 32, 34,120, 48, 45,120, 55, 34, 10,120, 47, 56,
/* 0x0100 */ 132, 50, 64, 57, 34, 0, 0,148,232, 7, 65,248,250, 3, 0,249, /* 0x0100 */ 120,103, 32, 36,115,112, 32, 43, 32, 48,120, 49, 51, 56, 10,112,
/* 0x0110 */ 130, 6, 64,185,225, 3, 0,145,224, 3, 27, 42, 8, 8,128, 82, /* 0x0110 */ 114,105,110,116, 32, 34,120, 56, 45,120, 49, 53, 34, 10,120, 47,
/* 0x0120 */ 1, 0, 0,212,191, 3, 0,145, 5, 0,128,210,228, 3, 27, 42, /* 0x0120 */ 56,120,103, 10,112,114,105,110,116, 32, 34,120, 49, 54, 45,120,
/* 0x0130 */ 35, 0,128, 82,162, 0,128, 82,129, 6, 64,185,225, 15, 0,249, /* 0x0130 */ 50, 51, 34, 10,120, 47, 56,120,103, 10,112,114,105,110,116, 32,
/* 0x0140 */ 0, 0,128,210,200, 27,128, 82, 1, 0, 0,212,224, 11, 0,249, /* 0x0140 */ 34,120, 50, 52, 45,120, 51, 48, 34, 10,120, 47, 55,120,103, 10,
/* 0x0150 */ 252, 3, 0,170,224, 3, 27, 42, 40, 7,128, 82, 1, 0, 0,212, /* 0x0150 */ 115,101,116, 32, 36,112, 99, 32, 61, 32, 42, 40,108,111,110,103,
/* 0x0160 */ 253, 11, 64,185,129, 2, 64,185,158, 83, 0,145,189, 3, 1, 75, /* 0x0160 */ 32, 42, 41, 40, 36,115,112, 32, 43, 32, 48,120, 50, 51, 56, 41,
/* 0x0170 */ 253, 7, 0,249, 33,120, 30, 18, 60, 3, 1,139,192, 3, 31,214, /* 0x0170 */ 10,112,114,105,110,116, 32, 34,102, 97,117,108,116,105,110,103,
/* 0x0180 */ 1,132, 64,248,225,255,255,181,192, 3, 95,214, 1, 64, 33,139, /* 0x0180 */ 32,105,110,115,116,114, 34, 10,120, 47,105, 32, 36,112, 99, 10,
/* 0x0190 */ 225, 11,190,169,227,123, 1,169, 5, 0,128, 18, 4, 0,176, 82, /* 0x0190 */ 112,114,105,110,116, 32, 34,102, 97,117,108,116, 32, 99,111,110,
/* 0x01a0 */ 26, 0, 0, 20,228,123, 65,169,225, 15,194,168, 0, 0, 1,203, /* 0x01a0 */ 116,101,120,116, 34, 10,120, 47, 49, 53,105, 32, 36,112, 99, 32,
/* 0x01b0 */ 66, 0, 3,203,130, 0, 0,185,229, 3, 0,170,224, 3, 3,170, /* 0x01b0 */ 45, 32, 55, 42, 52, 10,115,101,116, 32, 36,115,112, 32, 61, 32,
/* 0x01c0 */ 97, 0, 2,139,224, 3, 5,170,192, 3, 95,214,132, 0, 4, 43, /* 0x01c0 */ 42, 40,108,111,110,103, 32, 42, 41, 40, 36,115,112, 32, 43, 32,
/* 0x01d0 */ 68, 0, 0, 52,192, 3, 95,214, 4, 68, 64,184,132, 0, 4, 58, /* 0x01d0 */ 48,120, 50, 51, 48, 41, 10,112,114,105,110,116, 32, 34,117,115,
/* 0x01e0 */ 192, 3, 95,214, 33, 0,128, 82,240, 3, 30,170,248,255,255,151, /* 0x01e0 */ 101,114, 32,115,116, 97, 99,107, 34, 10,120, 47, 54, 52,120,103,
/* 0x01f0 */ 33, 0, 1, 58,246,255,255,151,163,255,255, 84, 0, 2, 31,214, /* 0x01f0 */ 32, 36,115,112, 10,107,105,108,108, 10,113,117,105,116, 32, 49,
/* 0x0200 */ 3, 20, 64, 56, 67, 20, 0, 56,241,255,255,151,162,255,255, 84, /* 0x0200 */ 0, 0, 0, 0, 0, 0,128, 82, 40, 7,128, 82, 1, 0, 0,212,
/* 0x0210 */ 245,255,255,151, 35, 12, 0,113, 1, 0,128, 82,163, 0, 0, 84, /* 0x0210 */ 255,127,191,169, 1, 0,128, 82,224, 3, 0,145,104, 7,128, 82,
/* 0x0220 */ 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42,197,251,255, 52, /* 0x0220 */ 1, 0, 0,212,240, 19, 0,145, 19, 2, 64,185,255, 67, 0,145,
/* 0x0230 */ 231,255,255,151, 33, 0, 1, 58,229,255,255,151, 33, 0, 1, 58, /* 0x0230 */ 130, 37,128, 82, 1,245,255, 48,224, 3, 19, 42, 8, 8,128, 82,
/* 0x0240 */ 97, 0, 0, 84,232,255,255,151, 33, 8, 0, 17,191, 0, 52, 49, /* 0x0240 */ 1, 0, 0,212,224, 3, 19, 42, 40, 7,128, 82, 1, 0, 0,212,
/* 0x0250 */ 33, 36,129, 26, 67,200,101, 56, 33, 4, 0,113, 67, 20, 0, 56, /* 0x0250 */ 255, 7, 64,209, 2, 0,128, 82,129,241,255, 16, 0, 0,128,146,
/* 0x0260 */ 162,255,255, 84,233,255,255, 23,117,112,120, 0,217, 19, 1,209, /* 0x0260 */ 8, 7,128, 82, 1, 0, 0,212,243, 3, 0, 42,225, 3, 0,145,
/* 0x0270 */ 32, 3, 64,185, 57, 67, 32,203,224, 7, 0,249,192, 3, 63,214, /* 0x0270 */ 2, 0,130, 82,232, 7,128, 82, 1, 0, 0,212,224, 3, 19, 42,
/* 0x0280 */ 0, 0, 0, 0,102,105,108,101, 32,102,111,114,109, 97,116, 32, /* 0x0280 */ 40, 7,128, 82, 1, 0, 0,212,168, 21,128, 82, 1, 0, 0,212,
/* 0x0290 */ 101,108,102, 54, 52, 45,108,105,116,116,108,101, 97, 97,114, 99, /* 0x0290 */ 255,127,191,169,225, 3, 0, 42,224, 3, 0,145, 49, 0, 0,148,
/* 0x02a0 */ 104, 54, 52, 10, 10, 83,101, 99,116,105,111,110,115, 58, 10, 73, /* 0x02a0 */ 227, 3, 0,145,226, 67, 0,145,225,240,255, 48,224,240,255, 16,
/* 0x02b0 */ 100,120, 32, 78, 97,109,101, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x02b0 */ 224, 7,189,169,226, 15, 1,169,255, 19, 0,249, 2, 0,128,210,
/* 0x02c0 */ 32, 83,105,122,101, 32, 32, 32, 32, 32, 32, 86, 77, 65, 32, 32, /* 0x02c0 */ 225, 3, 0,145,168, 27,128, 82, 1, 0, 0,212, 0, 0, 0, 20,
/* 0x02d0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 76, 77, 65, /* 0x02d0 */ 31, 32, 3,213,225, 11, 63,169, 66, 3,128,210,225,237,255,112,
/* 0x02e0 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 70, /* 0x02e0 */ 64, 0,128, 82, 8, 8,128, 82, 1, 0, 0,212, 2, 0,128, 82,
/* 0x02f0 */ 105,108,101, 32,111,102,102, 32, 32, 65,108,103,110, 32, 32, 70, /* 0x02f0 */ 33,238,255, 48, 0, 0,128, 18, 8, 7,128, 82, 1, 0, 0,212,
/* 0x0300 */ 108, 97,103,115, 10, 32, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, /* 0x0300 */ 243, 3, 0, 42,255, 7, 64,209, 2, 0,130,210,225, 3, 0,145,
/* 0x0310 */ 88, 32, 32, 32, 32, 32, 32, 48, 50, 50, 56, 32, 32, 48, 32, 32, /* 0x0310 */ 224, 3, 19, 42,232, 7,128, 82, 1, 0, 0,212,224, 0, 0, 52,
/* 0x0320 */ 48, 32, 32, 48, 52, 48, 32, 32, 50, 42, 42, 50, 32, 32, 67, 79, /* 0x0320 */ 226, 3, 0,170,225, 3, 0,145, 64, 0,128, 82, 8, 8,128, 82,
/* 0x0330 */ 78, 84, 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76, 70, 77, 65, /* 0x0330 */ 1, 0, 0,212,245,255,255, 23,255, 7, 64,145,224, 3, 16,170,
/* 0x0340 */ 73, 78, 89, 32, 32, 32, 32, 32, 32, 48, 32, 32, 48, 32, 32, 48, /* 0x0340 */ 40, 7,128, 82, 1, 0, 0,212, 0, 0,128,210, 1, 0,128,210,
/* 0x0350 */ 32, 32, 48, 50, 54, 56, 32, 32, 50, 42, 42, 48, 32, 32, 67, 79, /* 0x0350 */ 136, 27,128, 82, 1, 0, 0,212, 96,245,255,180, 0, 0, 0, 20,
/* 0x0360 */ 78, 84, 69, 78, 84, 83, 10, 32, 32, 50, 32, 69, 76, 70, 77, 65, /* 0x0360 */ 254,127,191,169, 4, 0, 0,148,254, 7,193,168, 1, 0, 0, 57,
/* 0x0370 */ 73, 78, 90, 32, 32, 32, 32, 32, 32, 48, 49, 99, 32, 32, 48, 32, /* 0x0370 */ 192, 3, 95,214,162,153,153, 82,130,153,185,114, 34,124,162,155,
/* 0x0380 */ 32, 48, 32, 32, 48, 50, 54, 56, 32, 32, 50, 42, 42, 50, 32, 32, /* 0x0380 */ 67,252, 99,211, 98, 8, 3, 11, 33, 4, 2, 75,254, 7,191,169,
/* 0x0390 */ 67, 79, 78, 84, 69, 78, 84, 83, 10, 83, 89, 77, 66, 79, 76, 32, /* 0x0390 */ 99, 0, 0,180,225, 3, 3, 42,247,255,255,151,254, 7,193,168,
/* 0x03a0 */ 84, 65, 66, 76, 69, 58, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x03a0 */ 33,192, 0, 17, 1, 20, 0, 56,192, 3, 95,214, 3, 1,128,210,
/* 0x03b0 */ 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, /* 0x03b0 */ 226, 3, 31,170,225, 3, 31,170, 96, 1,128, 82,200, 16,128, 82,
/* 0x03c0 */ 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32, 69, 76, 70, 77, 65, /* 0x03c0 */ 1, 0, 0,212,192, 3, 95,214,224, 99, 0,145, 82, 0, 0,148,
/* 0x03d0 */ 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x03d0 */ 81, 0, 0,148,246, 3, 0,170,255,131, 0,209, 1, 8,193,168,
/* 0x03e0 */ 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, /* 0x03e0 */ 63, 24, 0,113, 96, 0, 0, 84,161,255,255, 53, 34, 0,160,210,
/* 0x03f0 */ 77, 65, 73, 78, 88, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, /* 0x03f0 */ 250, 3, 2,203,250, 3, 0,249, 25, 0, 0, 16, 32, 3, 64,185,
/* 0x0400 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x0400 */ 224, 7, 0,249, 57, 67, 32,203, 0, 0, 0,148,244, 3, 30,170,
/* 0x0410 */ 48, 32,108, 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, /* 0x0410 */ 1, 2,128, 82, 0, 0, 0, 16,232, 34,128, 82, 1, 0, 0,212,
/* 0x0420 */ 78, 89, 32, 48, 32, 69, 76, 70, 77, 65, 73, 78, 89, 10, 48, 48, /* 0x0420 */ 0, 2,248, 54, 97, 0, 0, 52,225, 3, 31, 42,250,255,255, 23,
/* 0x0430 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, /* 0x0430 */ 6, 0, 0,148,192, 1, 0, 0, 2, 64, 64, 0, 47,100,101,118,
/* 0x0440 */ 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, 32, 77, /* 0x0440 */ 47,115,104,109, 0, 0, 0, 0,195, 71, 64,184,194, 71, 64,184,
/* 0x0450 */ 70, 76, 71, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x0450 */ 225, 3, 30,170, 96, 12,128, 18, 8, 7,128, 82, 1, 0, 0,212,
/* 0x0460 */ 48, 48, 48, 52, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76, 70, /* 0x0460 */ 251, 3, 0, 42,128, 6, 64,185,253, 3, 0,145,160, 3, 0,203,
/* 0x0470 */ 77, 65, 73, 78, 88, 32, 48, 32, 95,115,116, 97,114,116, 10, 48, /* 0x0470 */ 0,236,124,146, 31, 0, 0,145,226, 3, 0,170,225, 15, 31,248,
/* 0x0480 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 52, 99, 32, /* 0x0480 */ 227, 3, 0,145,128, 66, 0,145,129, 10, 64,185,132, 50, 64, 57,
/* 0x0490 */ 103, 32, 32, 32, 32, 32, 70, 32, 69, 76, 70, 77, 65, 73, 78, 88, /* 0x0490 */ 36, 0, 0,148,232, 7, 65,248,250, 3, 0,249,242, 7, 0,249,
/* 0x04a0 */ 32, 48,100, 99, 32,117, 99,108, 95,110,114,118, 50, 98, 95,100, /* 0x04a0 */ 130, 6, 64,185,225, 3, 0,145,224, 3, 27, 42, 8, 8,128, 82,
/* 0x04b0 */ 101, 99,111,109,112,114,101,115,115, 95, 51, 50, 10, 48, 48, 48, /* 0x04b0 */ 1, 0, 0,212,191, 3, 0,145, 5, 0,128,210,228, 3, 27, 42,
/* 0x04c0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,103, 32, /* 0x04c0 */ 35, 0,128, 82,162, 0,128, 82,129, 6, 64,185,225, 15, 0,249,
/* 0x04d0 */ 32, 32, 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 89, 32, 48, /* 0x04d0 */ 0, 0,128,210,200, 27,128, 82, 1, 0, 0,212,224, 11, 0,249,
/* 0x04e0 */ 32,101,110,100, 95,100,101, 99,111,109,112,114,101,115,115, 10, /* 0x04e0 */ 252, 3, 0,170,224, 3, 27, 42, 40, 7,128, 82, 1, 0, 0,212,
/* 0x04f0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x04f0 */ 253, 11, 64,185,129, 2, 64,185,158,115, 0,145,189, 3, 1, 75,
/* 0x0500 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 42, 85, 78, 68, 42, 32, 48, /* 0x0500 */ 253, 7, 0,249, 33,120, 30, 18, 60, 3, 1,139,192, 3, 31,214,
/* 0x0510 */ 32, 79, 95, 66, 73, 78, 70, 79, 10, 10, 82, 69, 76, 79, 67, 65, /* 0x0510 */ 192, 3, 95,214, 1,132, 64,248,225,255,255,181,192, 3, 95,214,
/* 0x0520 */ 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, /* 0x0520 */ 1, 64, 33,139,225, 11,190,169,227,123, 1,169, 5, 0,128, 18,
/* 0x0530 */ 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 93, 58, 10, 79, 70, 70, /* 0x0530 */ 4, 0,176, 82, 26, 0, 0, 20,228,123, 65,169,225, 15,194,168,
/* 0x0540 */ 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, /* 0x0540 */ 0, 0, 1,203, 66, 0, 3,203,130, 0, 0,185,229, 3, 0,170,
/* 0x0550 */ 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, /* 0x0550 */ 224, 3, 3,170, 97, 0, 2,139,224, 3, 5,170,192, 3, 95,214,
/* 0x0560 */ 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, /* 0x0560 */ 132, 0, 4, 43, 68, 0, 0, 52,192, 3, 95,214, 4, 68, 64,184,
/* 0x0570 */ 48, 48, 48, 48, 48, 48, 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, /* 0x0570 */ 132, 0, 4, 58,192, 3, 95,214, 33, 0,128, 82,240, 3, 30,170,
/* 0x0580 */ 95, 65, 66, 83, 51, 50, 32, 32, 32, 77, 70, 76, 71, 10, 48, 48, /* 0x0580 */ 248,255,255,151, 33, 0, 1, 58,246,255,255,151,163,255,255, 84,
/* 0x0590 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, 99, 32, 82, /* 0x0590 */ 0, 2, 31,214, 3, 20, 64, 56, 67, 20, 0, 56,241,255,255,151,
/* 0x05a0 */ 95, 65, 65, 82, 67, 72, 54, 52, 95, 67, 65, 76, 76, 50, 54, 32, /* 0x05a0 */ 162,255,255, 84,245,255,255,151, 35, 12, 0,113, 1, 0,128, 82,
/* 0x05b0 */ 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120, 48, 48, 48, 48, /* 0x05b0 */ 163, 0, 0, 84, 5, 20, 64, 56,165, 32, 3, 42,229, 3, 37, 42,
/* 0x05c0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10, 48, 48, 48, /* 0x05c0 */ 197,251,255, 52,231,255,255,151, 33, 0, 1, 58,229,255,255,151,
/* 0x05d0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 56, 32, 82, 95, /* 0x05d0 */ 33, 0, 1, 58, 97, 0, 0, 84,232,255,255,151, 33, 8, 0, 17,
/* 0x05e0 */ 65, 65, 82, 67, 72, 54, 52, 95, 65, 68, 82, 95, 80, 82, 69, 76, /* 0x05e0 */ 191, 0, 52, 49, 33, 36,129, 26, 67,200,101, 56, 33, 4, 0,113,
/* 0x05f0 */ 95, 76, 79, 50, 49, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 10, /* 0x05f0 */ 67, 20, 0, 56,162,255,255, 84,233,255,255, 23,117,112,120, 0,
/* 0x0600 */ 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, /* 0x0600 */ 192, 3, 63,214, 0, 0, 0, 0,102,105,108,101, 32,102,111,114,
/* 0x0610 */ 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, /* 0x0610 */ 109, 97,116, 32,101,108,102, 54, 52, 45,108,105,116,116,108,101,
/* 0x0620 */ 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, /* 0x0620 */ 97, 97,114, 99,104, 54, 52, 10, 10, 83,101, 99,116,105,111,110,
/* 0x0630 */ 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, /* 0x0630 */ 115, 58, 10, 73,100,120, 32, 78, 97,109,101, 32, 32, 32, 32, 32,
/* 0x0640 */ 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, /* 0x0640 */ 32, 32, 32, 32, 32, 83,105,122,101, 32, 32, 32, 32, 32, 32, 86,
/* 0x0650 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 56, 32, 82, 95, /* 0x0650 */ 77, 65, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0660 */ 65, 65, 82, 67, 72, 54, 52, 95, 65, 66, 83, 51, 50, 32, 32, 32, /* 0x0660 */ 32, 76, 77, 65, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0670 */ 79, 95, 66, 73, 78, 70, 79, 10 /* 0x0670 */ 32, 32, 32, 70,105,108,101, 32,111,102,102, 32, 32, 65,108,103,
/* 0x0680 */ 110, 32, 32, 70,108, 97,103,115, 10, 32, 32, 48, 32, 69, 76, 70,
/* 0x0690 */ 77, 65, 73, 78, 88, 32, 32, 32, 32, 32, 32, 48, 49, 48, 32, 32,
/* 0x06a0 */ 48, 32, 32, 48, 32, 32, 48, 52, 48, 32, 32, 50, 42, 42, 48, 32,
/* 0x06b0 */ 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 49, 32, 69, 76,
/* 0x06c0 */ 70, 83, 73, 71, 83, 69, 71, 86, 32, 32, 32, 32, 48, 51, 55, 56,
/* 0x06d0 */ 32, 32, 48, 32, 32, 48, 32, 32, 48, 53, 48, 32, 32, 50, 42, 42,
/* 0x06e0 */ 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 32, 32, 50, 32,
/* 0x06f0 */ 69, 76, 70, 77, 65, 73, 78, 88, 50, 32, 32, 32, 32, 32, 48, 50,
/* 0x0700 */ 51, 52, 32, 32, 48, 32, 32, 48, 32, 32, 48, 51, 99, 56, 32, 32,
/* 0x0710 */ 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 32,
/* 0x0720 */ 32, 51, 32, 69, 76, 70, 77, 65, 73, 78, 89, 32, 32, 32, 32, 32,
/* 0x0730 */ 32, 48, 32, 32, 48, 32, 32, 48, 32, 32, 48, 53,102, 99, 32, 32,
/* 0x0740 */ 50, 42, 42, 48, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10, 32,
/* 0x0750 */ 32, 52, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 32, 32, 32, 32,
/* 0x0760 */ 32, 48, 99, 32, 32, 48, 32, 32, 48, 32, 32, 48, 53,102, 99, 32,
/* 0x0770 */ 32, 50, 42, 42, 50, 32, 32, 67, 79, 78, 84, 69, 78, 84, 83, 10,
/* 0x0780 */ 83, 89, 77, 66, 79, 76, 32, 84, 65, 66, 76, 69, 58, 10, 48, 48,
/* 0x0790 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108,
/* 0x07a0 */ 32, 32, 32, 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32,
/* 0x07b0 */ 48, 32, 69, 76, 70, 77, 65, 73, 78, 88, 10, 48, 48, 48, 48, 48,
/* 0x07c0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32,
/* 0x07d0 */ 32,100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 50, 32, 48, 32,
/* 0x07e0 */ 69, 76, 70, 77, 65, 73, 78, 88, 50, 10, 48, 48, 48, 48, 48, 48,
/* 0x07f0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,
/* 0x0800 */ 100, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 32, 48, 32, 69, 76,
/* 0x0810 */ 70, 77, 65, 73, 78, 90, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0820 */ 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32, 32,
/* 0x0830 */ 69, 76, 70, 83, 73, 71, 83, 69, 71, 86, 32, 48, 32, 69, 76, 70,
/* 0x0840 */ 83, 73, 71, 83, 69, 71, 86, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0850 */ 48, 48, 48, 48, 48, 48, 48, 48, 32,108, 32, 32, 32, 32,100, 32,
/* 0x0860 */ 32, 69, 76, 70, 77, 65, 73, 78, 89, 32, 48, 32, 69, 76, 70, 77,
/* 0x0870 */ 65, 73, 78, 89, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0880 */ 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32, 32, 42, 85,
/* 0x0890 */ 78, 68, 42, 32, 48, 32, 77, 70, 76, 71, 10, 48, 48, 48, 48, 48,
/* 0x08a0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 32,103, 32, 32, 32,
/* 0x08b0 */ 32, 32, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 32, 48, 32, 95,
/* 0x08c0 */ 115,116, 97,114,116, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x08d0 */ 48, 48, 48, 49, 53, 56, 32,103, 32, 32, 32, 32, 32, 70, 32, 69,
/* 0x08e0 */ 76, 70, 77, 65, 73, 78, 88, 50, 32, 48,100, 99, 32,117, 99,108,
/* 0x08f0 */ 95,110,114,118, 50, 98, 95,100,101, 99,111,109,112,114,101,115,
/* 0x0900 */ 115, 95, 51, 50, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0910 */ 48, 48, 48, 48, 48, 32,103, 32, 32, 32, 32, 32, 32, 32, 69, 76,
/* 0x0920 */ 70, 77, 65, 73, 78, 89, 32, 48, 32,101,110,100, 95,100,101, 99,
/* 0x0930 */ 111,109,112,114,101,115,115, 10, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x0940 */ 48, 48, 48, 48, 48, 48, 48, 48, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0950 */ 32, 42, 85, 78, 68, 42, 32, 48, 32, 79, 95, 66, 73, 78, 70, 79,
/* 0x0960 */ 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67,
/* 0x0970 */ 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73,
/* 0x0980 */ 78, 88, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32,
/* 0x0990 */ 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32,
/* 0x09a0 */ 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48,
/* 0x09b0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 32, 82,
/* 0x09c0 */ 95, 65, 65, 82, 67, 72, 54, 52, 95, 65, 66, 83, 51, 50, 32, 32,
/* 0x09d0 */ 32, 77, 70, 76, 71, 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
/* 0x09e0 */ 48, 48, 48, 48, 48, 99, 32, 82, 95, 65, 65, 82, 67, 72, 54, 52,
/* 0x09f0 */ 95, 65, 68, 82, 95, 80, 82, 69, 76, 95, 76, 79, 50, 49, 32, 32,
/* 0x0a00 */ 69, 76, 70, 77, 65, 73, 78, 88, 50, 43, 48,120, 48, 48, 48, 48,
/* 0x0a10 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 49, 52, 56, 10, 10, 82, 69,
/* 0x0a20 */ 76, 79, 67, 65, 84, 73, 79, 78, 32, 82, 69, 67, 79, 82, 68, 83,
/* 0x0a30 */ 32, 70, 79, 82, 32, 91, 69, 76, 70, 77, 65, 73, 78, 88, 50, 93,
/* 0x0a40 */ 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0a50 */ 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32, 32, 32, 32, 32, 32,
/* 0x0a60 */ 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10, 48, 48, 48, 48, 48,
/* 0x0a70 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 51, 48, 32, 82, 95, 65, 65,
/* 0x0a80 */ 82, 67, 72, 54, 52, 95, 65, 68, 82, 95, 80, 82, 69, 76, 95, 76,
/* 0x0a90 */ 79, 50, 49, 32, 32, 69, 76, 70, 77, 65, 73, 78, 88, 45, 48,120,
/* 0x0aa0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52,
/* 0x0ab0 */ 10, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52,
/* 0x0ac0 */ 48, 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, 95, 67, 65, 76, 76,
/* 0x0ad0 */ 50, 54, 32, 32, 69, 76, 70, 77, 65, 73, 78, 90, 43, 48,120, 48,
/* 0x0ae0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 10,
/* 0x0af0 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, 99,
/* 0x0b00 */ 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, 95, 65, 68, 82, 95, 80,
/* 0x0b10 */ 82, 69, 76, 95, 76, 79, 50, 49, 32, 32, 69, 76, 70, 77, 65, 73,
/* 0x0b20 */ 78, 90, 10, 10, 82, 69, 76, 79, 67, 65, 84, 73, 79, 78, 32, 82,
/* 0x0b30 */ 69, 67, 79, 82, 68, 83, 32, 70, 79, 82, 32, 91, 69, 76, 70, 77,
/* 0x0b40 */ 65, 73, 78, 90, 93, 58, 10, 79, 70, 70, 83, 69, 84, 32, 32, 32,
/* 0x0b50 */ 32, 32, 32, 32, 32, 32, 32, 32, 84, 89, 80, 69, 32, 32, 32, 32,
/* 0x0b60 */ 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 86, 65, 76, 85, 69, 10,
/* 0x0b70 */ 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 56,
/* 0x0b80 */ 32, 82, 95, 65, 65, 82, 67, 72, 54, 52, 95, 65, 66, 83, 51, 50,
/* 0x0b90 */ 32, 32, 32, 79, 95, 66, 73, 78, 70, 79, 10
}; };
+1106 -1105
View File
File diff suppressed because it is too large Load Diff
+963 -834
View File
File diff suppressed because it is too large Load Diff
+2267 -2271
View File
File diff suppressed because it is too large Load Diff
+1061 -1060
View File
File diff suppressed because it is too large Load Diff
+1054 -1053
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -157,7 +157,7 @@ def do_file(fn):
# ELF64 LE # ELF64 LE
eh, idata = idata[:64], idata[64:] eh, idata = idata[:64], idata[64:]
e_shnum, e_shstrndx = struct.unpack("<HH", eh[60:64]) e_shnum, e_shstrndx = struct.unpack("<HH", eh[60:64])
assert e_shstrndx + 3 == e_shnum assert e_shstrndx + 3 >= e_shnum
elif idata[4:7] == "\x02\x02\x01": elif idata[4:7] == "\x02\x02\x01":
# ELF64 BE # ELF64 BE
eh, idata = idata[:64], idata[64:] eh, idata = idata[:64], idata[64:]
@@ -178,6 +178,8 @@ def do_file(fn):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata)) assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
elif re.search(r"^arm64-", os.path.basename(fn)): elif re.search(r"^arm64-", os.path.basename(fn)):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata)) assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
elif re.search(r"^riscv", os.path.basename(fn)):
assert pos >= len(odata), ("unexpected strip_with_dump", pos, len(odata))
else: else:
assert pos == len(odata), ("unexpected strip_with_dump", pos, len(odata)) assert pos == len(odata), ("unexpected strip_with_dump", pos, len(odata))
else: else:
+212 -1
View File
@@ -94,7 +94,212 @@ _start: .globl _start
push %rsp; pop %rdi // argv push %rsp; pop %rdi // argv
push %rcx // argc push %rcx // argc
push %rdx // param for atexit() push %rdx // param for atexit()
lea cancel_dummy(%rip),%r15
section ELFSIGSEGV
// install SIGSEGV handler for debugging
SIGSEGV= 11
SA_SIGINFO= 4 // /usr/include/bits/sigaction.h
SA_RESTORER= 0x04000000
__NR_rt_sigaction= 13 // /usr/include/asm/unistd_64.h
push %rdi // save reg
sub %edx,%edx // arg3= 0 ==> do not save old sigaction
push %rdx // .sa_mask: 64 bits (8 bytes) of flags for signals
lea __restore_rt(%rip),%rax; push %rax // .sa_restorer
push $SA_RESTORER | SA_SIGINFO // .sa_flags
lea sigsegv_sigaction(%rip),%rax; push %rax // .sa_sigaction
lea cancel_sigsegv(%rip),%r15
push %rsp; pop %rsi // arg2= &new struct sigaction
push $SIGSEGV; pop %rdi // arg1= signum
push $8; pop %r10 // sys4= sizeof(__sigset_t) ==> 64 bits
push $__NR_rt_sigaction; pop %rax; syscall
add $(3 + 1) * NBPW,%rsp // toss struct sigaction
pop %rdi // restore reg
#if 0 //{ TEST ONLY
movl $0x18181818,%r8d
movl $0x19191919,%r9d
movl $0x1a1a1a1a,%r10d
movl $0x1b1b1b1b,%r11d
movl $0x1c1c1c1c,%r12d
movl $0x1d1d1d1d,%r13d
movl $0x1e1e1e1e,%r14d
movl $0x1f1f1f1f,%r15d
movl $0xaaaaaaaa,%eax
movl $0xbbbbbbbb,%ebx
movl $0xcccccccc,%ecx
movl $0xdddddddd,%edx
movl $0x55555555,%ebp
movl $0x66666666,%esi
movl $0x77777777,%edi
movl (%rdx),%edx // force SIGSEGV
#endif // TEST_ONLY}
jmp end_sigsegv
__NR_rt_sigreturn= 15
__restore_rt:
endbr64
mov $__NR_rt_sigreturn,%eax
syscall
sigsegv_sigaction:
endbr64
push %rdx // save &ucontext_t
// print /proc/self/maps of child (same as parent: the beauty of fork())
mov $end_announce_sigaction - announce_sigaction,%edx // arg3 len
lea announce_sigaction(%rip),%rsi // arg2 buf
push $2; pop %rdi // arg1 fd_stderr
push $__NR_write; pop %rax; syscall // ignore error on write()
xor %esi,%esi // arg2 O_RDONLY
lea proc_self_maps(%rip),%arg1
push $__NR_open; pop %rax; syscall
mov %rax,%r12 // fd_maps
BUFLEN= 4096
mov $BUFLEN,%ebx; sub %rbx,%rsp // allocate buffer
loop_maps:
mov %ebx,%edx // arg3 buflen
push %rsp; pop %rsi // arg2 buffer
mov %r12,%rdi // arg1 fd_maps
xor %eax,%eax; syscall // __NR_read
test %eax,%eax; jle done_maps // ignore error on read()
mov %eax,%edx // arg3 buflen
push %rsp; pop %rsi // arg2 buf
push $2; pop %rdi // arg1 fd_stderr
push $__NR_write; pop %rax; syscall // ignore error on write()
jmp loop_maps
done_maps:
mov %r12,%rdi //arg1 fd_maps
add %rbx,%rsp // discard buffer
push $__NR_close; pop %rax; syscall
// end printing of /proc/self/maps
pop %rdx // restore &ucontext_t
__NR_fork= 57
push $__NR_fork; pop %rax; call sys_check
test %eax,%eax; je child
parent:
jmp parent // spin; paused by gdb
proc_self_cmdline:
.asciz "/proc/self/cmdline"
announce_sigaction:
.asciz "\n\nSIGSEGV address space:\n"
end_announce_sigaction:
proc_self_maps:
.asciz "/proc/self/maps"
minus_q:
.asciz "-q"
path_gdb:
.asciz "/usr/bin/gdb"
commands_gdb:
.ascii "set prompt\n" // null string prompt
.ascii "info inferiors\n"
// ucontext_t, mcontext_t, gregset_t, gret_t, REG_xxx: <sys/ucontext.h>
// stack_t <bits/types/stack_t.h>
.ascii "print \"r8 - r15\"\n"
.ascii "x/8xg $rdx + 5*8\n"
.ascii "print \"rdi, rsi, rbp, rbx\"\n"
.ascii "x/4xg\n"
.ascii "print \"rdx, rax, rcx, rsp\"\n"
.ascii "x/4xg\n"
.ascii "print \"rip, efl\"\n"
.ascii "x/2xg\n"
.ascii "set $pc = *(long *)($rdx + 168)\n"
.ascii "print \"faulting instr\"\n"
.ascii "x/i $pc\n"
.ascii "print \"fault context\"\n"
.ascii "x/16i $pc - 0x20\n"
.ascii "print \"user stack\"\n"
.ascii "x/64xg *(long *)($rdx + 5*8 + 15*8)\n"
.ascii "kill\n"
.ascii "quit 1"
.byte 0
commands_gdb_end:
child:
PATH_MAX= 4096
sub $PATH_MAX,%rsp
lea proc_self_cmdline(%rip),%arg1
O_RDONLY= 0
push $O_RDONLY; pop %arg2
push $__NR_open; pop %rax; call sys_check
push %rax; pop %arg1 // fd
push %rsp; pop %arg2 // buffer
push $PATH_MAX; pop %arg3
__NR_read= 0
push $__NR_read; pop %rax; call sys_check
push $__NR_close; pop %rax; call sys_check
__NR_getppid= 110
push $__NR_getppid; pop %rax; syscall
push %rax; pop %rsi
xor %eax,%eax; push %rax; push %rax // decimal(pid) fits in 16 bytes
push %rsp; pop %rdi; call unsimal
// argv
push %rsp; pop %rsi // fence post: &pid.unsimal
push $0 // argv[4]
push %rsi // arg3 pid
add $16,%rsi; push %rsi // arg2 exename
lea minus_q(%rip),%rax; push %rax // arg1 "-q"
add $(path_gdb - minus_q),%rax; push %rax // arg[0] "/usr/bin/gdb"
#if 1 //{ pipe input to gdb
xor %edi,%edi; push $__NR_close; pop %rax; syscall
push %rax; push %rsp; pop %rdi // &fd_pipe[2]; 4 bytes each
__NR_pipe= 22
push $__NR_pipe; pop %rax; call sys_check
pop %rdi; shr $32,%rdi // arg1 write side of pipe
push $commands_gdb_end - commands_gdb; pop %arg3
lea commands_gdb(%rip),%arg2
__NR_write= 1
push $__NR_write; pop %rax; call sys_check
push $__NR_close; pop %rax; syscall
#endif //}
push $0; pop %arg3 // _environ BUG
push %rsp; pop %arg2 // argv
movq (%arg2),%arg1 // "/usr/bin/gdb"
__NR_execve= 59
push $__NR_execve; pop %rax; call sys_check
hlt
unsimal: // (dst, value)
push $10; pop %rcx // radix
mov %esi,%eax // value
call 0f
movb $0,(%rdi) // terminator
ret
0:
xor %edx,%edx; div %ecx; push %rdx // eax= quo(%edx:%eax / %ecx); edx= rem
// 'div' undefines all flags!
test %eax,%eax; je 1f; call 0b
1:
pop %rax; add $'0',%eax
stosb
ret
// Uninstall SIGSEGV handler
cancel_sigsegv:
endbr64
push $8; pop %sys4 // sys_arg4 minimal byte count
xor %edx,%edx // no old
xor %esi,%esi // no new
push $SIGSEGV; pop %rdi
push $__NR_rt_sigaction; pop %eax; syscall
ret
end_sigsegv:
section ELFMAINX2
#define old_sp %rbp #define old_sp %rbp
F_FRAME= 7*NBPW F_FRAME= 7*NBPW
F_ENTR= 6*NBPW; F_PMASK= F_ENTR F_ENTR= 6*NBPW; F_PMASK= F_ENTR
@@ -105,8 +310,9 @@ F_ELFA= 2*NBPW
F_LENX= 1*NBPW F_LENX= 1*NBPW
F_ADRX= 0*NBPW F_ADRX= 0*NBPW
D_FOLD= 1*NBPW // .data space at start of unfold D_FOLD= 2*NBPW // .data space at start of unfold
D_PMASK= 0*NBPW D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
// find auxv // find auxv
xor %eax,%eax // 0 xor %eax,%eax // 0
@@ -264,6 +470,7 @@ eof_n2b:
// Write de-compressed 'fold' to file // Write de-compressed 'fold' to file
mov F_PMASK(old_sp),%rax; mov %rax,/*D_PMASK*/(%rsp) // propagate PAGE_MASK mov F_PMASK(old_sp),%rax; mov %rax,/*D_PMASK*/(%rsp) // propagate PAGE_MASK
mov %r15,D_XSIGSEGV(%rsp) // propagate cancel_sigsegv
mov F_LENU(old_sp),%arg3 // LENU mov F_LENU(old_sp),%arg3 // LENU
sub $INSURANCE,%arg3 // memcheck limit sub $INSURANCE,%arg3 // memcheck limit
push %rsp; pop %arg2 // buffer push %rsp; pop %arg2 // buffer
@@ -295,6 +502,10 @@ eof_n2b:
add $D_FOLD,%rax // beyond .data add $D_FOLD,%rax // beyond .data
jmp *%rax // goto unfolded stub jmp *%rax // goto unfolded stub
cancel_dummy:
endbr64
ret
sys_check: sys_check:
push %rax // save __NR_ for debug push %rax // save __NR_ for debug
syscall syscall
+8 -4
View File
@@ -81,6 +81,7 @@ is_ptinterp= (1<<0)
.balign 8 .balign 8
PAGE_MASK: .quad -1<<12 // default PAGE_MASK: .quad -1<<12 // default
cancel_sigsegv: .quad 0 // subroutine that cancels sigaction(SIGSEGV,)
// IN: [ADRX,+LENX): compressed data; [ADRU,+LENU): expanded fold (w/ upx_main2) // IN: [ADRX,+LENX): compressed data; [ADRU,+LENU): expanded fold (w/ upx_main2)
// %rsp= %rbp= &F_ADRX; %r13= O_BINFO | is_ptinterp | unmap_all_pages // %rsp= %rbp= &F_ADRX; %r13= O_BINFO | is_ptinterp | unmap_all_pages
@@ -174,9 +175,12 @@ no_env_pse:
*/ */
// rsp/ {OVERHEAD},ADRU,LENU,rdx,%entry, argc,argv,0,envp,0,auxv,0,strings // rsp/ {OVERHEAD},ADRU,LENU,rdx,%entry, argc,argv,0,envp,0,auxv,0,strings
addq $OVERHEAD,%rsp # Elf64_Ehdr temporary space addq $OVERHEAD,%rsp # Elf64_Ehdr temporary space
mov %ebp,%ebx # fd #define r_fd ebx
mov %ebp,%r_fd
movq %rax,3*NBPW(%rsp) # entry movq %rax,3*NBPW(%rsp) # entry
call *cancel_sigsegv(%rip)
sz_Ehdr= 8*NBPW sz_Ehdr= 8*NBPW
e_type= 16 e_type= 16
ET_EXEC= 2 ET_EXEC= 2
@@ -190,16 +194,16 @@ p_memsz= 5*NBPW
movq %r13,%arg1; call munmap # discard C_TEXT compressed data movq %r13,%arg1; call munmap # discard C_TEXT compressed data
// Map 1 page of /proc/self/exe so that the symlink does not disappear. // Map 1 page of /proc/self/exe so that the symlink does not disappear.
test %ebx,%ebx; js no_pse_map test %r_fd,%r_fd; js no_pse_map
subq %arg6,%arg6 # 0 offset subq %arg6,%arg6 # 0 offset
mov %ebx,%arg5l # fd mov %r_fd,%arg5l # fd
push $MAP_PRIVATE; pop %arg4 push $MAP_PRIVATE; pop %arg4
push $PROT_READ; pop %arg3 push $PROT_READ; pop %arg3
mov $1<<12,%arg2l mov $1<<12,%arg2l
subl %arg1l,%arg1l # 0 subl %arg1l,%arg1l # 0
call mmap call mmap
mov %ebx,%edi # fd mov %r_fd,%edi # fd
call close call close
.macro NOTRACK .macro NOTRACK
+42 -2
View File
@@ -77,6 +77,16 @@ extern void my_bkpt(void *, ...);
/*und*/ : "x30"); \ /*und*/ : "x30"); \
str; \ str; \
}) })
#elif defined(__riscv) //}{
#define ANDROID_FRIEND 0
#define addr_string(string) ({ \
char const *str; \
asm("jal 0f; .string \"" string "\"; .balign 4; 0: mv %0,ra" \
/*out*/ : "=r"(str) \
/* in*/ : \
/*und*/ : "x30"); \
str; \
})
#else //}{ #else //}{
#error; #error;
#endif //} #endif //}
@@ -279,6 +289,36 @@ make_hatch(
DPRINTF("hatch=%%p\\n", hatch); DPRINTF("hatch=%%p\\n", hatch);
return hatch; return hatch;
} }
#elif defined(__riscv) //{
static void *
make_hatch(
ElfW(Phdr) const *const phdr,
char *next_unc,
unsigned const frag_mask
)
{
unsigned long a = (unsigned long)next_unc;
int *hatch = (int *)((3u & -a) + a);
int code[3] = {
0,0,0 //NYI illegal instruction
};
DPRINTF("make_hatch %%p %%p %%x\\n", phdr, next_unc, frag_mask);
if (phdr->p_type==PT_LOAD && phdr->p_flags & PF_X) {
if (sizeof(code) <= (unsigned)(frag_mask & -(long)hatch)) {
hatch[0] = code[0];
hatch[1] = code[1];
hatch[2] = code[2];
}
else { // Does not fit at hi end of .text, so must use a new page "permanently"
int mfd = upxfd_create(addr_string("upx"), MFD_EXEC); // the directory entry
write(mfd, &code, sizeof(code));
hatch = mmap(0, sizeof(code), PROT_READ|PROT_EXEC, MAP_SHARED, mfd, 0);
close(mfd);
}
}
DPRINTF("hatch=%%p\\n", hatch);
return hatch;
}
#elif defined(__powerpc64__) //}{ #elif defined(__powerpc64__) //}{
static void * static void *
make_hatch( make_hatch(
@@ -660,7 +700,7 @@ upx_main2( // returns entry address
/*arg4*/ ElfW(auxv_t) *const av /*arg4*/ ElfW(auxv_t) *const av
#if defined(__x86_64) //{ #if defined(__x86_64) //{
/*arg5*/ , ElfW(Addr) elfaddr // In: &ElfW(Ehdr) for stub /*arg5*/ , ElfW(Addr) elfaddr // In: &ElfW(Ehdr) for stub
#elif defined(__aarch64__) //}{ #elif defined(__aarch64__) || defined(__riscv) //}{
/*arg5*/ , ElfW(Addr) elfaddr /*arg5*/ , ElfW(Addr) elfaddr
#elif defined(__powerpc64__) //}{ #elif defined(__powerpc64__) //}{
/*arg5*/ , ElfW(Addr) *p_reloc // In: &ElfW(Ehdr) for stub; Out: 'slide' for PT_INTERP /*arg5*/ , ElfW(Addr) *p_reloc // In: &ElfW(Ehdr) for stub; Out: 'slide' for PT_INTERP
@@ -681,7 +721,7 @@ upx_main2( // returns entry address
// ehdr = Uncompress Ehdr and Phdrs // ehdr = Uncompress Ehdr and Phdrs
unpackExtent(&xi2, &xo); // never filtered? unpackExtent(&xi2, &xo); // never filtered?
#if defined(__x86_64) || defined(__aarch64__) //{ #if defined(__x86_64) || defined(__aarch64__) || defined(__riscv) //{
ElfW(Addr) *const p_reloc = &elfaddr; ElfW(Addr) *const p_reloc = &elfaddr;
#endif //} #endif //}
ElfW(Addr) page_mask = get_page_mask(); (void)page_mask; ElfW(Addr) page_mask = get_page_mask(); (void)page_mask;
+18 -3
View File
@@ -102,7 +102,7 @@ memcpy: .globl memcpy // void *memcpy(void *dst, void const *src, size_t n)
/* 64-bit mode only! */ /* 64-bit mode only! */
__NR_read= 0 __NR_read= 0
__NR_write= 1 __NR_write= 1
//__NR_open= 2 __NR_open= 2
__NR_openat= 257 __NR_openat= 257
FD_CWD= -100 FD_CWD= -100
__NR_close= 3 __NR_close= 3
@@ -190,8 +190,6 @@ exit: .globl exit
push $ __NR_exit; 5: jmp 5f push $ __NR_exit; 5: jmp 5f
ftruncate: .globl ftruncate ftruncate: .globl ftruncate
push $__NR_ftruncate; 5: jmp 5f push $__NR_ftruncate; 5: jmp 5f
memfd_create: .globl memfd_create
push $__NR_memfd_create; 5: jmp 5f
close: .globl close close: .globl close
push $ __NR_close; 5: jmp 5f push $ __NR_close; 5: jmp 5f
openat: .globl openat openat: .globl openat
@@ -202,4 +200,21 @@ write: .globl write
read: .globl read read: .globl read
push $ __NR_read; 5: jmp sysgo push $ __NR_read; 5: jmp sysgo
memfd_create: .globl memfd_create
0:
movl $__NR_memfd_create,%eax; syscall
test %eax,%eax; js 1f; ret // success
1:
test %arg2l,%arg2l; jz no_memfd // memfd_create failed twice
xor %arg2l,%arg2l; jmp 0b // try again without MFD_EXEC
no_memfd: // so try /dev/shm
O_RDWR= 2
O_DIRECTORY= 0200000 // 0x010000
O_TMPFILE= 020000000 // 0x400000
call 0f; .int 0700, O_RDWR|O_DIRECTORY|O_TMPFILE; .asciz "/dev/shm"; 0: pop %rsi
lodsl; xchg %eax,%arg3l
lodsl; push %rsi; xchg %eax,%arg2l
pop %arg1
push $__NR_open; jmp sysgo
// section SO_MAIN inserted here // section SO_MAIN inserted here
-1
View File
@@ -34,7 +34,6 @@
#undef x86_64 #undef x86_64
//.altmacro // not supported by x86_64-linux-as-2.15 //.altmacro // not supported by x86_64-linux-as-2.15
.code64
.macro section name .macro section name
.section \name .section \name
+3
View File
@@ -0,0 +1,3 @@
# convenience Makefile
default %:
$(MAKE) -C ../../.. $@
+55
View File
@@ -0,0 +1,55 @@
MAKEFLAGS += -rR
.SUFFIXES:
.SECONDEXPANSION:
ifndef top_srcdir
__dir_list = . .. ../.. ../../.. ../../../.. ../../../../..
__dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
endif
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
vpath %.c $(top_srcdir)/src/stub/src/c
STUBS =
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
ifneq ($(UPX_LZMA_VERSION),)
STUBS += lzma_d_cf.S lzma_d_cs.S lzma_d_cn.S
endif
default.targets = all
ifeq ($(strip $(STUBS)),)
STUBS = NO_STUBS
all.targets =
endif
include $(top_srcdir)/src/stub/Makefile
# /***********************************************************************
# // method-lzma
# ************************************************************************/
lzma_d_c%.S : tc_list = method-lzma riscv64-linux.elf default
lzma_d_c%.S : tc_bfdname = elf64-riscv64
c := tc.method-lzma.gcc
$c = $(tc.riscv64-linux.elf.gcc)
$c += -Os -fomit-frame-pointer
$c += -fno-unit-at-a-time
$c += -ffunction-sections
$c += -fwrapv
$c += -DWITH_LZMA=$(UPX_LZMA_VERSION)
$c += -I$(UPX_LZMADIR)
$c += -I$(top_srcdir)/src
lzma_d_c%.S : lzma_d_c.c
$(call tc,gcc) $(PP_FLAGS) -c $< -o tmp/$T.o
$(call tc,f-objstrip,tmp/$T.o)
$(call tc,objcopy) -O binary --only-section .text.LzmaDecode tmp/$T.o tmp/$T.bin
head -c-1 tmp/$T.bin > tmp/$T.out
$(call tc,objdump) -b binary -m i386:x86-64 -D tmp/$T.out | $(RTRIM) > tmp/$T.out.disasm
$(call tc,bin2h) --mode=gas tmp/$T.out $@
lzma_d_cf.% : PP_FLAGS = -DFAST
lzma_d_cs.% : PP_FLAGS = -DSMALL
lzma_d_cn.% : PP_FLAGS = -DFAST -mno-red-zone
+96
View File
@@ -0,0 +1,96 @@
/*
; macros.S --
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996-2025 Laszlo Molnar
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Markus F.X.J. Oberhumer Laszlo Molnar
; <markus@oberhumer.com> <ezerotven+github@gmail.com>
;
*/
.macro section name
.section \name
.endm
.macro syscall num
li a7,\num; ecall
.endm
NBPW= 8
.macro PUSH4 a,b,c,d
addi sp,sp,-4*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
sd \c,2*NBPW(sp)
sd \d,3*NBPW(sp)
.endm
.macro POP4 a,b,c,d
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
ld \c,2*NBPW(sp)
ld \d,3*NBPW(sp)
addi sp,sp,4*NBPW
.endm
.macro PUSH3 a,b,c
addi sp,sp,-4*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
sd \c,2*NBPW(sp)
.endm
.macro POP3 a,b,c
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
ld \c,2*NBPW(sp)
addi sp,sp,4*NBPW
.endm
.macro PUSH2 a,b
addi sp,sp,-2*NBPW
sd \a,0*NBPW(sp)
sd \b,1*NBPW(sp)
.endm
.macro POP2 a,b,c
ld \a,0*NBPW(sp)
ld \b,1*NBPW(sp)
addi sp,sp,2*NBPW
.endm
.macro PUSH1 a
addi sp,sp,-2*NBPW
sd \a,0*NBPW(sp)
.endm
.macro POP1 a
ld \a,0*NBPW(sp)
addi sp,sp,2*NBPW
.endm
.macro SUB2 dst,src
sub \dst,\dst,\src
.endm
// vi:ts=8:et:nowrap
+85
View File
@@ -0,0 +1,85 @@
/* riscv64 nrv2b_d.S -- RISCV64 decompressor for NRV2B
This file is part of the UPX executable compressor.
Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996-2025 Laszlo Molnar
Copyright (C) 2000-2025 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
.text
#ifndef NO_METHOD_CHECK
cmpb $ M_NRV2B_LE32,methb; jne not_n2b
#endif
li bits,1<<31 // empty; force refill
li len,0
li disp,-1 // initial displacement
j top_n2b
#undef EOF
#define EOF eof_n2b
lit_n2b:
addi src,src,1; sb bytpre,(dst)
addi dst,dst,1
top_n2b:
lbu bytpre,(src) # prefetch: literal, or bottom 8 bits of offset
jnextb1yp lit_n2b
li off,1
offmore_n2b:
getnextbp(off)
jnextb0np offmore_n2b
addi off,off,-3; blt off,zero,len_n2b # use previous offset
slli off,off,8
or off,off,bytpre; addi src,src,1
xori disp,off,~0; beq disp,zero,EOF
len_n2b:
li off,1
getnextb(len); getnextb(len) # two bits; cc set on result
bne len,zero,gotlen_n2b # raw 1,2,3 ==> 2,3,4
mv len,off # len= 1, the msb
addi off,off,3-1 # raw 2.. ==> 5..
lenmore_n2b:
getnextb(len)
jnextb0n lenmore_n2b
gotlen_n2b:
li t0,0x300; lui t0,0xfffff # -0xd00
sltu retbit,t0,disp
add len,len,off; add len,len,retbit # len += off + (disp < -0xd00)
//NYI call copy@plt; .extern copy
bot_n2b: # In: 0==len
j top_n2b
#ifndef NO_METHOD_CHECK //{
not_n2b:
push %rdi; pop %rsi # src = arg1
#endif //}
# fall into daisy chain
/*
vi:ts=8:et:nowrap
*/
+22
View File
@@ -0,0 +1,22 @@
#if 0 //{ pre-defined
#define ra x1 /* return address */
#define sp x2 /* stack ptr */
#define gp x3 /* global ptr */
#define tp x4 /* thread ptr */
#endif //}
#define t0 x5
#define t1 x6
#define t2 x7
#define s0 x8
#define s1 x9
#define rv a0 /* return value */
/* NOTE: THE FIRST ARGUMENT IS arg1, NOT arg0. */
#define arg1 x10 /* same as rv */
#define arg2 x11
#define arg3 x12
#define arg4 x13
#define arg5 x14
#define arg6 x15
+250 -28
View File
@@ -66,6 +66,8 @@ MAP_ANONYMOUS= 0x20
MAP_FIXED= 0x10 MAP_FIXED= 0x10
MAP_PRIVATE= 0x02 MAP_PRIVATE= 0x02
FD_CWD= -1 // AT_CWD= -100
FD_stdin= 0
FD_stderr= 2 FD_stderr= 2
O_RDONLY= 0 O_RDONLY= 0
@@ -81,13 +83,15 @@ PAGE_SIZE = ( 1<<PAGE_SHIFT)
__NR_SYSCALL_BASE = 0 __NR_SYSCALL_BASE = 0
__NR_exit= 1 + __NR_SYSCALL_BASE
__NR_open= 5 + __NR_SYSCALL_BASE
__NR_close= 6 + __NR_SYSCALL_BASE __NR_close= 6 + __NR_SYSCALL_BASE
__NR_execve= 11 + __NR_SYSCALL_BASE
__NR_exit= 1 + __NR_SYSCALL_BASE
__NR_fdatasync=148 + __NR_SYSCALL_BASE __NR_fdatasync=148 + __NR_SYSCALL_BASE
__NR_fork= 2 + __NR_SYSCALL_BASE
__NR_fsync= 118 + __NR_SYSCALL_BASE __NR_fsync= 118 + __NR_SYSCALL_BASE
__NR_ftruncate=93 + __NR_SYSCALL_BASE __NR_ftruncate=93 + __NR_SYSCALL_BASE
__NR_getpid= 20 + __NR_SYSCALL_BASE __NR_getpid= 20 + __NR_SYSCALL_BASE
__NR_getppid= 64 + __NR_SYSCALL_BASE
__NR_lseek= 19 + __NR_SYSCALL_BASE __NR_lseek= 19 + __NR_SYSCALL_BASE
__NR_memfd_create= 385 + __NR_SYSCALL_BASE __NR_memfd_create= 385 + __NR_SYSCALL_BASE
__NR_mkdir= 39 + __NR_SYSCALL_BASE __NR_mkdir= 39 + __NR_SYSCALL_BASE
@@ -95,12 +99,16 @@ __NR_mmap2= 192 + __NR_SYSCALL_BASE
__NR_mprotect=125 + __NR_SYSCALL_BASE __NR_mprotect=125 + __NR_SYSCALL_BASE
__NR_msync= 144 + __NR_SYSCALL_BASE // 0x90 __NR_msync= 144 + __NR_SYSCALL_BASE // 0x90
__NR_open= 5 + __NR_SYSCALL_BASE __NR_open= 5 + __NR_SYSCALL_BASE
__NR_openat= 322 + __NR_SYSCALL_BASE
__NR_pipe= 42 + __NR_SYSCALL_BASE
__NR_read= 3 + __NR_SYSCALL_BASE __NR_read= 3 + __NR_SYSCALL_BASE
__NR_sigaction=67 + __NR_SYSCALL_BASE
__NR_stat= 106 + __NR_SYSCALL_BASE __NR_stat= 106 + __NR_SYSCALL_BASE
__NR_uname= 122 + __NR_SYSCALL_BASE __NR_uname= 122 + __NR_SYSCALL_BASE
__NR_unlink= 10 + __NR_SYSCALL_BASE __NR_unlink= 10 + __NR_SYSCALL_BASE
__NR_write= 4 + __NR_SYSCALL_BASE __NR_write= 4 + __NR_SYSCALL_BASE
__ARM_NR_BASE= 0xf0000 + __NR_SYSCALL_BASE __ARM_NR_BASE= 0xf0000 + __NR_SYSCALL_BASE
__ARM_NR_cacheflush= 2 + __ARM_NR_BASE __ARM_NR_cacheflush= 2 + __ARM_NR_BASE
@@ -118,21 +126,24 @@ __ARM_NR_cacheflush= 2 + __ARM_NR_BASE
section ELFMAINX section ELFMAINX
F_ADRX= 0*NBPW F_ADRX= 0*NBPW
F_obinfo= F_ADRX // unmap_all_pages in lo bits
F_LENX= 1*NBPW F_LENX= 1*NBPW
F_ELFA= 2*NBPW F_ELFA= 2*NBPW
F_ADRU= 3*NBPW F_SEGV= 3*NBPW
F_LENU= 4*NBPW F_ADRU= 4*NBPW
F_R0= 5*NBPW F_LENU= 5*NBPW
F_R1= 6*NBPW F_R0= 6*NBPW
F_ENTR= 7*NBPW F_R1= 7*NBPW
F_QFLG= F_ENTR F_ENTR= 8*NBPW
F_SIZE= 8*NBPW F_qflg= F_ENTR // QNX mmap flags
F_SIZE= 9*NBPW
// (read-only) .data space at start of unfolded code // (read-only) .data space at start of unfolded code
D_PMASK= 0*NBPW D_PMASK= 0*NBPW
D_FNAME= 1*NBPW D_QFLG= 1*NBPW
D_QFLG= 2*NBPW D_FNAME= 2*NBPW
D_FOLD= 3*NBPW // start of code D_XSEGV= 3*NBPW
D_FOLD= 4*NBPW // start of code
r_pack2 .req r9 r_pack2 .req r9
r_pmask .req r8 r_pmask .req r8
@@ -142,9 +153,58 @@ sz_pack2= . - NBPW
mflg: mflg:
.word MFLG // MAP_{PRIVATE|ANONYMOUS} // QNX vs linux .word MFLG // MAP_{PRIVATE|ANONYMOUS} // QNX vs linux
_start: .globl _start _start: .globl _start
//// nop; bkpt // DEBUG //// nop; bkpt // DEBUG
stmdb sp!,{r0,r1,lr} // ABI crt0 -static may have data here ldr r_pack2,sz_pack2
sub sp,sp,#-3*NBPW + F_SIZE // F_R0,F_R1 separately ldr r2,mflg
adr r3,sz_pack2
sub r3,r3,r_pack2 @ elfaddr= &Elf_Ehdr of this program
call 0f; cancel_dummy: ret; 0:
stmdb sp!,{r0,r1,r2} // F_R0,F_R1,%F_ENTR(F_QFLG)
sub sp,sp,#2*NBPW // space for F_ADRU, F_LENU
stmdb sp!,{r0,r1,r3,lr} // %F_ADRX,%F_LENX,F_ELFA,F_SEGV
section ELFSIGSEGV
// install SIGSEGV handler for debugging
SIGSEGV= 11
SA_SIGINFO= 4 // /usr/include/bits/sigaction.h
SA_RESTORER= 0x04000000
sa_sigaction = 0 * NBPW
sa_flags = 1 * NBPW
sa_mask = 3 * NBPW // location of mask
sa_restorer = 4 * NBPW
sa_frame = 5 * NBPW
call adr_sigaction; mov r0,lr // .sa_sigaction
mov r1,#SA_SIGINFO // .sa_flags
mov r2,#0 // .sa_mask
mov r3,#0
mov r4,#0 // .sa_restorer
stmdb sp!,{r0,r1,r2,r3,r4}
mov arg4,#8 // 8 bytes ==> 64 bits
mov arg3,#0 // do not save old_sigaction
mov arg2,sp // &new_sigaction
mov arg1,#SIGSEGV
do_sys7t __NR_sigaction
add sp,sp,#sa_frame
call 0f
cancel_sigsegv:
mov r3,#8 // space for 8 bytes of signal flags
mov r2,#0 // no old
mov r1,#0 // no new
mov r0,#SIGSEGV
do_sys7t __NR_sigaction
ret
0:
str lr,[sp,#F_SEGV]
#if 0 //{ TEST ONLY
mov r0,#0xc0;mov r1,#0xc1;mov r2,#0xc2;mov r3,#0xc3;mov r4,#0xc4;mov r5,#0xc5;mov r6,#0xc6;mov r7,#0xc7
mov r8,#0xc8;mov r9,#0xc9;mov r10,#0xca;mov r11,#0xcb;mov r12,#0xcc
ldr r0,[r0] // cause SIGSEGV
#endif //}
section ELFMAINX2
add arg1,sp,#NBPW + F_SIZE // avoid feint of 0==argc add arg1,sp,#NBPW + F_SIZE // avoid feint of 0==argc
call zfind // out: r0= &envp call zfind // out: r0= &envp
call zfind call zfind
@@ -159,14 +219,6 @@ _start: .globl _start
mvn r2,r2; add r2,r2,#1 // neg mvn r2,r2; add r2,r2,#1 // neg
mov r_pmask,r2 mov r_pmask,r2
ldr r1,sz_pack2
adr r0,sz_pack2
sub r0,r0,r1 @ elfaddr= &Elf_Ehdr of this program
str r0,[sp,#F_ELFA]
mov r_pack2,r1 @ save sz_pack2
ldr r0,mflg
str r0,[sp,#F_QFLG]
call get_data // cpr0 can be too far away call get_data // cpr0 can be too far away
old_sp .req r11 old_sp .req r11
@@ -216,10 +268,11 @@ mfd .req old_sp
mov mfd,r0 mov mfd,r0
//}{ r0 free, r1 busy //}{ r0 free, r1 busy
add r4,r_unc,# 2*NBPW + D_FOLD add r4,r_unc,# 2*NBPW + D_FOLD
ldr r5,[sp,#F_SEGV]
and r4,r4, #-2*NBPW // align displacement and r4,r4, #-2*NBPW // align displacement
ldr r3,[sp,#F_QFLG] ldr r3,[sp,#F_qflg]
mov r2,r_pmask mov r2,r_pmask
stmia r1,{r2,r3,r4} // D_PMASK, D_QFLG, D_FNAME stmia r1,{r2,r3,r4,r5} // F_ADRU: D_PMASK, D_QFLG, D_FNAME, D_SEGV
.unreq r_pmask .unreq r_pmask
// De-compress folded stage of stub // De-compress folded stage of stub
@@ -242,7 +295,7 @@ mfd .req old_sp
ldr arg3,[sp,#F_LENU] ldr arg3,[sp,#F_LENU]
ldr arg2,[sp,#F_ADRU] ldr arg2,[sp,#F_ADRU]
mov arg1,mfd mov arg1,mfd
do_sys __NR_write do_sys7t __NR_write
mov r5,#0 mov r5,#0
mov r4,mfd mov r4,mfd
@@ -261,13 +314,182 @@ mfd .req old_sp
add r4,r0,r1 @ ADRX= &b_info | unmap_all_pages add r4,r0,r1 @ ADRX= &b_info | unmap_all_pages
bic r1,r1,#unmap_all_pages bic r1,r1,#unmap_all_pages
sub r5,r_pack2,r1 @ LENX= sz_pack2 - O_BINFO sub r5,r_pack2,r1 @ LENX= sz_pack2 - O_BINFO
stmia sp,{r4,r5} // F_ADRX, F_LENX stmia sp,{r4,r5} // sp: F_ADRX, F_LENX; (sp no change)
#if DEBUG /*{*/ #if DEBUG /*{*/
stmdb sp!,{TRACE_REGS}; mov r0,#3; bl trace stmdb sp!,{TRACE_REGS}; mov r0,#3; bl trace
#endif /*}*/ #endif /*}*/
ldr r12,[sp,#F_ADRU] ldr r12,[sp,#F_ADRU]
add pc,r12,#D_FOLD // goto unfolded code add pc,r12,#D_FOLD // goto unfolded code
proc_self_cmdline:
.asciz "/proc/self/cmdline"
.balign 4
#define r_fd r6
PATH_MAX= 4096
child:
#if 1 //{ pipe input to gdb
mov arg1,#FD_stdin; do_sys7t __NR_close
mov arg2,#0; mov arg1,#0; stmdb sp!,{arg1,arg2} // space for result of pipe()
mov arg1,sp
do_sys7t __NR_pipe // read side will be 0 (FD_stdin)
ldmia sp!,{r0,r_fd} // write side of pipe
mov arg3,#commands_gdb_end - commands_gdb // len
adr arg2,commands_gdb
mov arg1,r_fd
do_sys7t __NR_write
mov arg1,r_fd; do_sys7t __NR_close
#endif //}
sub sp,sp,#PATH_MAX
mov arg3,#O_RDONLY
adr arg2,proc_self_cmdline
mov arg1,#FD_CWD
do_sys7t2 __NR_openat; mov r_fd,r0 // fd
mov arg2,sp // buffer
mov arg3,#PATH_MAX
do_sys7t __NR_read
mov arg1,r_fd; do_sys7t __NR_close
do_sys7t __NR_getppid
sub sp,sp,#16 // decimal(pid) fits in 16 bytes
mov arg2,arg1; mov arg1,sp; call unsimal
mov arg5,#0 // terminator
mov arg4,sp // &"pid" (result of unsimal)
add arg3,sp,#16 // cmdline argv[0] [skip "pid"]
adr arg2,minus_q
adr arg1,path_gdb
stmdb sp!,{arg1,arg2,arg3,arg4,arg5} // argv
mov arg3,#0 // _envviron BUG
mov arg2,sp // &argv
do_sys7t __NR_execve
0:
b 0b
minus_q:
.asciz "-q"
path_gdb:
.asciz "/usr/bin/gdb"
commands_gdb:
.ascii "set prompt\n" // null string prompt
.ascii "info inferiors\n"
.ascii "print \"r0-r7\"\n"
.ascii "x/8xw $sp + 0x28\n"
.ascii "print \"r8-r15\"\n"
.ascii "x/8xw\n"
.ascii "set $pc = *(int *)($sp + 0x64)\n"
.ascii "print \"faulting instr\"\n"
.ascii "x/i $pc\n"
.ascii "print \"fault context\"\n"
.ascii "x/15i $pc - 7*4\n"
//.ascii "print \"intercept stack\"\n"
//.ascii "x/76xw $sp\n"
.ascii "set $sp = *(long *)($sp + 0x5c)\n"
.ascii "print \"user stack\"\n"
.ascii "x/64xw $sp\n"
.ascii "kill\n"
.ascii "quit 1"
.byte 0
commands_gdb_end:
.balign 4
// ucontext_t, mcontext_t, gregset_t, gret_t, REG_xxx: <sys/ucontext.h>
// stack_t <bits/types/stack_t.h>
__restore_rt:
nop
proc_self_maps:
.asciz "/proc/self/maps"
announce_sigaction:
.ascii "\n\nSIGSEGV address space:\n"
end_announce_sigaction:
.balign 4
adr_sigaction:
mov r12,lr; mov lr,pc; mov pc,r12 // blx lr
sigsegv_sigaction:
stmdb sp!,{arg2,arg3} // save siginfo *, ucontext *
// print /proc/self/maps of child (same as parent: the beauty of fork())
mov arg3,#end_announce_sigaction - announce_sigaction // arg3 len
adr arg2,announce_sigaction // buf
mov arg1,#FD_stderr
do_sys7t __NR_write
mov arg3,#O_RDONLY // flags
adr arg2,proc_self_maps // path
mov arg1,#FD_CWD
do_sys7t2 __NR_openat; mov r_fd,r0 // fd_maps
BUFLEN= 4096
sub sp,sp,#BUFLEN
loop_maps:
mov arg3,#BUFLEN // buflen
mov arg2,sp // buffer
mov arg1,r_fd // fd_maps
do_sys7t __NR_read
cmp r0,#0; beq done_maps
mov arg3,r0 // buflen
mov arg2,sp // buf
mov arg1,#FD_stderr
do_sys7t __NR_write
b loop_maps
done_maps:
add sp,sp,#BUFLEN // discard buffer
mov arg1,r_fd; do_sys7t __NR_close
// end printing of /proc/self/maps
mov arg1,#0; mov arg2,#0 // paranoia
do_sys7t __NR_fork
cmp r0,#0; beq child // fork()
parent:
NR_exit= 1
b parent // spin; paused by gdb
unsimal: // (dst, value)
mov r2,#0
stmdb sp!,{r2,lr}; call 0f
ldmia sp!,{r2,lr}
strb r2,[r0] // terminator
ret
0:
mov ip,r1 // extra copy used at end
mov r2,#0 // hi
mov r3,r1 // copy lo
adds r1,r1,r1,lsl #3 // 9*lo
adc r2,r2,r2,lsl #3 // 9*hi + C
add r2,r2,r3,lsr #(32 - 3) // bits shifted from lo to hi
mov r3,r1 // copy lo
adds r1,r1,r1,lsl #4
adc r2,r2,r2,lsl #4
add r2,r2,r3,lsr #(32 - 4) // * 0x99
mov r3,r1 // copy lo
adds r1,r1,r1,lsl #8
adc r2,r2,r2,lsl #8
add r2,r2,r3,lsr #(32 - 8) // * 0x9999
mov r3,r1 // copy lo
adds r1,r1,r1,lsl #16
adc r2,r2,r2,lsl #16
add r2,r2,r3,lsr #(32 - 16) // * 0x99999999
subs r1,r1,ip,lsl #(32 - 1) // - * 0x80000000
sbc r2,r2,ip,lsr #1 // * 0x19999999
adds r1,r1,ip
adcs r1,r2,#0 // * 0x0.1999999a; r1 = quo(ip, 10); set flags
add r2,r1,r1,lsl #2 // r2 = quo * 5
sub r2,ip,r2,lsl #1 // rem = ip - 10 * quo
stmdb sp!,{r2,lr} // save rem and retaddr
beq 1f; call 0b // stop if 0==quo; else recurse for next remainder
1:
ldmia sp!,{r1,lr}; add r1,r1,#'0'; strb r1,[r0],#1
ret
zfind: zfind:
ldr r1,[r0],#NBPW ldr r1,[r0],#NBPW
cmp r1,#0; bne zfind cmp r1,#0; bne zfind
@@ -322,7 +544,7 @@ L610: @ each word
mov r0,#'\n'; strb r0,[r2],#1 mov r0,#'\n'; strb r0,[r2],#1
sub r2,r2,sp @ count sub r2,r2,sp @ count
mov r1,sp @ buf mov r1,sp @ buf
mov r0,#2 @ FD_STDERR mov r0,#FD_stderr
#if defined(ARMEL_EABI4) /*{*/ #if defined(ARMEL_EABI4) /*{*/
mov r7,#__NR_write mov r7,#__NR_write
swi 0 swi 0
+29 -21
View File
@@ -66,11 +66,6 @@ PATH_MAX= 4096
#define call bl #define call bl
#include "MAX_ELF_HDR.S" #include "MAX_ELF_HDR.S"
ZERO= . - 3*NBPW
page_mask= . - 3*NBPW; .globl page_mask
qflg_data = . - 2*NBPW // QNX vs Linux: MAP_PRIVATE | MAP_ANONYMOUS
upxfn_path= . - 1*NBPW // displacement from "zero"
arg1 .req r0 arg1 .req r0
arg2 .req r1 arg2 .req r1
arg3 .req r2 arg3 .req r2
@@ -78,6 +73,12 @@ arg4 .req r3
arg5 .req r4 arg5 .req r4
arg6 .req r5 arg6 .req r5
ZERO= . - 4*NBPW // 4 words initialized prior to unfolded code
page_mask= . - 4*NBPW
qflg_data = . - 3*NBPW // QNX vs Linux: MAP_PRIVATE | MAP_ANONYMOUS
upxfn_path= . - 2*NBPW // displacement from ZERO
cancel_sigsegv= . - 1*NBPW
fold_begin: // enter here fold_begin: // enter here
b L05 // put page_mask and qflg_data within short-displacement of uses b L05 // put page_mask and qflg_data within short-displacement of uses
@@ -141,20 +142,21 @@ mmap_do: // sp: saved r4,r5,lr
proc_self_exe: .asciz "/proc/self/exe"; .balign 4 proc_self_exe: .asciz "/proc/self/exe"; .balign 4
// In: sp/ F_ADRX,F_LENX,F_ELFA,F_ADRU,F_LENU,F_R0,F_R1,%F_ENTR,F_argc // In: sp/ F_ADRX,F_LENX,F_ELFA,f_SEGV,F_ADRU,F_LENU,F_R0,F_R1,%F_ENTR,F_argc
// [ADRX, +LENX) = extent of compressed program // [ADRX, +LENX) = extent of compressed program
// [ADRU, +LENU) = params to munmap unfolded stub // [ADRU, +LENU) = params to munmap unfolded stub
F_ADRX= 0*NBPW F_ADRX= 0*NBPW
F_obinfo= F_ADRX // unmap_all_pages in lo bits F_obinfo= F_ADRX // unmap_all_pages in lo bits
F_LENX= 1*NBPW F_LENX= 1*NBPW
F_ELFA= 2*NBPW F_ELFA= 2*NBPW
F_ADRU= 3*NBPW F_SEGV= 3*NBPW
F_LENU= 4*NBPW F_ADRU= 4*NBPW
F_R0= 5*NBPW F_LENU= 5*NBPW
F_R1= 6*NBPW F_R0= 6*NBPW
F_ENTR= 7*NBPW F_R1= 7*NBPW
F_qflg = F_ENTR // QNX mmap flags F_ENTR= 8*NBPW
F_ARGC= 8*NBPW F_qflg= F_ENTR // QNX mmap flags
F_argc= 9*NBPW
is_ptinterp= (1<<0) is_ptinterp= (1<<0)
unmap_all_pages= (1<<1) unmap_all_pages= (1<<1)
@@ -162,17 +164,17 @@ unmap_all_pages= (1<<1)
/* In: /* In:
r4= ADRX | unmap_all_pages r4= ADRX | unmap_all_pages
r5= LENX r5= LENX
sp/ ADRX|uap,LENX,ELFA,ADRU,LENU,r0,r1,%entry, argc,argv,0,envp,0,auxv sp/ ADRX|uap,LENX,ELFA,r0,r1,%entry,SEGV,ADRU,LENU, argc,argv,0,envp,0,auxv
(ADRX,LENX) = extent of compressed program (ADRX,LENX) = extent of compressed program
(ADRU,LENU) = params to munmap unfolded stub (ADRU,LENU) = params to munmap unfolded stub
*/ */
L05: L05:
ldmia sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12} // F_ADRX .. F_ARGC ldmia sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11,r12} // F_ADRX .. F_ARGC
mov r1,sp @ src mov r1,sp @ src
tst r4,#unmap_all_pages; bne 0f; sub sp,sp,#PATH_MAX; 0: tst r3,#unmap_all_pages; bne 0f; sub sp,sp,#PATH_MAX; 0:
mov r0,sp @ dst mov r0,sp @ dst
stmdb sp!,{r4,r5,r6,r7,r8,r9,r10,r11,r12} stmdb sp!,{r3,r4,r5,r6,r7,r8,r9,r10,r11,r12}
0: // copy argv down 0: // copy argv down
ldr r3,[r1],#NBPW; cmp r3,#0 ldr r3,[r1],#NBPW; cmp r3,#0
@@ -255,6 +257,9 @@ r_elfa .req r9
add sp,sp,#MAX_ELF_HDR_32 + OVERHEAD @ un-alloca add sp,sp,#MAX_ELF_HDR_32 + OVERHEAD @ un-alloca
str r0,[sp,#F_ENTR] @ entry address str r0,[sp,#F_ENTR] @ entry address
adr lr,0f; ldr pc,[sp,#F_SEGV] // cancel_sigsegv
0:
// Map 1 page of /proc/self/exe so that it does not disappear // Map 1 page of /proc/self/exe so that it does not disappear
ldr r0,[sp,#F_obinfo]; tst r0,#unmap_all_pages; bne no_map_pse ldr r0,[sp,#F_obinfo]; tst r0,#unmap_all_pages; bne no_map_pse
mov arg6,#0 @ SEEK_SET offset mov arg6,#0 @ SEEK_SET offset
@@ -290,7 +295,7 @@ sweep:
add sp,sp,#(1<<18) @ pop stack add sp,sp,#(1<<18) @ pop stack
#endif //} #endif //}
add sp,sp,#3*NBPW // toss F_ADRX,F_LENX,F_ELFA add sp,sp,#4*NBPW // toss F_ADRX,F_LENX,F_ELFA,F_SEGV
ldmia sp!,{arg1,arg2} @ F_ADRU,F_LENU ldmia sp!,{arg1,arg2} @ F_ADRU,F_LENU
stmdb sp!,{r_auxe} stmdb sp!,{r_auxe}
mov r3,#0 @ clear registers: paranoia mov r3,#0 @ clear registers: paranoia
@@ -315,6 +320,9 @@ sweep:
#endif /*}*/ #endif /*}*/
ldmia sp!,{r12} // r_auxe ldmia sp!,{r12} // r_auxe
ldr pc,[r12,#NBPW -2*NBPW] @ hatch: Elf32_auxv_t[AT_NULL@.a_type].a_val ldr pc,[r12,#NBPW -2*NBPW] @ hatch: Elf32_auxv_t[AT_NULL@.a_type].a_val
// hatch:
// svc 0 // In: r7= __NR_munmap; arg1= F_ADRU; arg2= F_LENU
// pop {r0,r1,pc} // F_R0, F_R1, F_ENTR
f_unfilter: @ (char *ptr, uint len, uint cto, uint fid) f_unfilter: @ (char *ptr, uint len, uint cto, uint fid)
ptr .req r0 ptr .req r0
+215 -8
View File
@@ -76,12 +76,18 @@ PAGE_SIZE = -(~0<<PAGE_SHIFT)
// /usr/include/asm-generic/unistd.h // /usr/include/asm-generic/unistd.h
__NR_close = 0x39 // 57 __NR_close = 0x39 // 57
__NR_execve = 0xdd // 221
__NR_exit = 0x5d // 93 __NR_exit = 0x5d // 93
__NR_fork = 0xdc // 220
__NR_getppid = 0xad // 173
__NR_memfd_create= 0x117 // 279 __NR_memfd_create= 0x117 // 279
__NR_mmap = 0xde // 222 __NR_mmap = 0xde // 222
__NR_mprotect = 0xe2 // 226 __NR_mprotect = 0xe2 // 226
__NR_munmap = 0xd7 // 215 __NR_munmap = 0xd7 // 215
__NR_openat = 0x38 // 56 __NR_openat = 0x38 // 56
__NR_pipe2 = 0x3b // 59
__NR_read = 0x3f // 63
__NR_sigaction = 0x86 // 134
AT_FDCWD= -100 AT_FDCWD= -100
__NR_write = 0x40 // 64 __NR_write = 0x40 // 64
@@ -134,6 +140,13 @@ wszuf .req w21
xszuf .req x21 xszuf .req x21
xFOLD .req x20 xFOLD .req x20
wPrivAnon .req w19 wPrivAnon .req w19
cancel_SEGV .req x18
D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
D_GETPM= 2*NBPW
D_PRIVANON= 2*NBPW + 2*4
D_FOLD= 2*NBPW + 3*4 // .data space at start of unfold
// http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf
// x18 is CLOBBERED: "The platform register" // x18 is CLOBBERED: "The platform register"
@@ -154,7 +167,198 @@ _start: .globl _start
#endif /*}*/ #endif /*}*/
stp x0,x1,[sp,#-2*NBPW]! // ABI: -static crt0 might pass data in x0,x1 stp x0,x1,[sp,#-2*NBPW]! // ABI: -static crt0 might pass data in x0,x1
ldr wPrivAnon,mflg ldr wPrivAnon,mflg
adr cancel_SEGV,cancel_dummy
section ELFSIGSEGV
// install SIGSEGV handler for debugging hardware and de-compressor
SIGSEGV= 11
SA_SIGINFO= 4 // /usr/include/bits/sigaction.h
SA_RESTORER= 0x04000000
sa_sigaction = 0 * NBPW
sa_flags = 1 * NBPW
sa_mask = 3 * NBPW // location of mask
sa_restorer = 4 * NBPW
sa_frame = 8 * NBPW
adr x0,sigsegv_sigaction // handler
mov x1,#SA_SIGINFO // flag bits
stp x0,x1,[sp,-sa_frame]! // .sa_sigaction, .sa_flags
str xzr,[sp,sa_mask] // .sa_mask
str xzr,[sp,sa_restorer]
mov x3,#8 // 8 bytes ==> 64 bits
mov x2,xzr // do not save old_sigaction
mov x1,sp // &new_sigaction
mov w0,#SIGSEGV
do_sys __NR_sigaction
add sp,sp,sa_frame
adr cancel_SEGV,cancel_sigsegv
b L300
#if 0 //{ TEST ONLY
mov x0,#0xc0;mov x1,#0xc1;mov x2,#0xc2;mov x3,#0xc3;mov x4,#0xc4;mov x5,#0xc5;mov x6,#0xc6;mov x7,#0xc7
mov x8,#0xc8;mov x9,#0xc9;mov x10,#0xca;mov x11,#0xcb;mov x12,#0xcc;mov x13,#0xcd;mov x14,#0xce;mov x15,#0xcf
mov x16,#0xd0;mov x17,#0xd1;mov x18,#0xd2;mov x19,#0xd3;mov x20,#0xd4;mov x21,#0xd5;mov x22,#0xd6;mov x23,#0xd7
mov x24,#0xd8;mov x25,#0xd9;mov x26,#0xda;mov x27,#0xdb;mov x28,#0xdc;mov x29,#0xdd;mov x30,#0xde
ldr x0,[x0] // cause SIGSEGV
#endif //}
proc_self_cmdline:
.asciz "/proc/self/cmdline"
announce_sigaction:
.asciz "\n\nSIGSEGV address space:\n"
end_announce_sigaction:
proc_self_maps:
.asciz "/proc/self/maps"
minus_q:
.asciz "-q"
path_gdb:
.asciz "/usr/bin/gdb"
commands_gdb:
.ascii "set prompt\n" // null string prompt
.ascii "info inferiors\n"
.ascii "print \"x0-x7\"\n"
.ascii "x/8xg $sp + 0x138\n"
.ascii "print \"x8-x15\"\n"
.ascii "x/8xg\n"
.ascii "print \"x16-x23\"\n"
.ascii "x/8xg\n"
.ascii "print \"x24-x30\"\n"
.ascii "x/7xg\n"
.ascii "set $pc = *(long *)($sp + 0x238)\n"
.ascii "print \"faulting instr\"\n"
.ascii "x/i $pc\n"
.ascii "print \"fault context\"\n"
.ascii "x/15i $pc - 7*4\n"
//.ascii "print \"intercept stack\"\n"
//.ascii "x/76xg $sp\n"
.ascii "set $sp = *(long *)($sp + 0x230)\n"
.ascii "print \"user stack\"\n"
.ascii "x/64xg $sp\n"
.ascii "kill\n"
.ascii "quit 1"
.byte 0
commands_gdb_end:
.balign 4
#define r_fd w19
PATH_MAX= 4096
child:
#if 1 //{ pipe input to gdb
mov arg1w,#0; do_sys __NR_close // fd_stdin
stp xzr,xzr,[sp,-2 * NBPW]! // &fd_pipe[2]; 4 bytes each; but stack align
mov arg2w,#0
mov arg1,sp
do_sys __NR_pipe2 // read size will be 0 (fd_stdin)
add x16,sp,#4
ldr r_fd,[x16] // write side of pipe
add sp,sp,#2*NBPW
mov w2,#commands_gdb_end - commands_gdb // arg3 len
adr x1,commands_gdb // arg2
mov w0,r_fd // arg1 fd
do_sys __NR_write
mov w0,r_fd; do_sys __NR_close
#endif //}
sub sp,sp,#PATH_MAX
mov arg3w,#O_RDONLY
adr arg2,proc_self_cmdline
mov arg1,#-1 // fake FD_CWD
do_sys __NR_openat; mov r_fd,w0
mov arg2,sp // buffer
mov arg3w,#PATH_MAX
do_sys __NR_read
mov arg1w,r_fd; do_sys __NR_close
do_sys __NR_getppid
stp xzr,xzr,[sp,-2 * NBPW]! // decimal(pid) fits in 16 bytes
mov w1,w0; mov x0,sp; call unsimal
mov arg4,sp // &"pid" (result of unsimal)
add arg3,sp,#2 * NBPW // cmdline argv[0] [skip "pid"]
adr arg2,minus_q
adr arg1,path_gdb // arg1 path
stp arg1,arg2,[sp,-6 *NBPW]! // path_gdb, "-q"
stp arg3,arg4,[sp,2 *NBPW] // argv[0], "pid"
str xzr,[sp,4 * NBPW] // NULL
mov arg3,#0 // _envviron BUG
mov arg2,sp // &argv
do_sys __NR_execve
0:
b 0b
// ucontext_t, mcontext_t, gregset_t, gret_t, REG_xxx: <sys/ucontext.h>
// stack_t <bits/types/stack_t.h>
__restore_rt:
nop
sigsegv_sigaction:
stp x1,x2,[sp,-2 * NBPW] // save siginfo *, ucontext *
// print /proc/self/maps of child (same as parent: the beauty of fork())
mov x2,#end_announce_sigaction - announce_sigaction // arg3 len
adr x1,announce_sigaction // arg2 buf
mov w0,#2 // arg1 fd_stderr
do_sys __NR_write
mov w2,#O_RDONLY // arg3 flags
adr x1,proc_self_maps // arg2 path
mov w0,#-1 // fake FD_CWD
do_sys __NR_openat
mov r_fd,w0 // fd_maps
BUFLEN= 4096
sub sp,sp,#BUFLEN
loop_maps:
mov x2,#BUFLEN // arg3 buflen
mov x1,sp // arg2 buffer
mov w0,r_fd // arg1 fd_maps
do_sys __NR_read
cbz w0,done_maps
mov x2,x0 // arg3 buflen
mov x1,sp // arg2 buf
mov w0,#2 // fd_stderr
do_sys __NR_write
b loop_maps
done_maps:
add sp,sp,#BUFLEN // discard buffer
mov x0,x16; do_sys __NR_close
// end printing of /proc/self/maps
mov arg1,#0; mov arg2,#0 // paranoia
do_sys __NR_fork; cbz x0,child
parent:
b parent // spin; paused by gdb
unsimal: // (dst, value)
stp lr,xzr,[sp,-2 * NBPW]!; call 0f
ldp lr,x1,[sp],#2 * NBPW
strb w1,[x0] // terminator
ret
0:
mov w2,#0xcccd
movk w2, 0xcccc, lsl 16 // 0xcccccccd ==> 4/5 as 32-bit fraction
umull x2,w1,w2
//add x2,x2,#0x1000 // BUG? unsimal(p, 730)
lsr x3,x2,35 // quo(value, 10)
add w2,w3,w3,lsl 2 // 5 * quo
sub w1,w1,w2,lsl 1 // rem = (val - (10 * quo))
stp lr,x1,[sp,-2 * NBPW]!
cbz x3,1f; mov w1,w3; call 0b
1:
ldp lr,x1,[sp],#2 * NBPW; add w1,w1,#'0'; strb w1,[x0],#1
ret
cancel_sigsegv:
mov x3,#8 // 8 bytes ==> 64 bits
mov x2,xzr // no old
mov x1,xzr // no new
mov w0,#SIGSEGV
do_sys __NR_sigaction
ret
L300:
section ELFMAINX2
add x0,sp,#(1+ 2)*NBPW add x0,sp,#(1+ 2)*NBPW
call zfind // avoid feint of 0==argc; out: x0= &envp call zfind // avoid feint of 0==argc; out: x0= &envp
call zfind; mov xauxv,x0 // &Elf64_auxv call zfind; mov xauxv,x0 // &Elf64_auxv
@@ -175,8 +379,11 @@ F_LENU= 3 * NBPW
neg xPMASK,x2 // save for folded code neg xPMASK,x2 // save for folded code
str xPMASK,[sp,#F_PMASK] str xPMASK,[sp,#F_PMASK]
adr xelfa,sz_pack2
ldr w0,[xelfa] // sz_pack2 causes unknown R_AARCH64_LD_PREL_LO19
str x0,[sp,#F_SZPK2]
sub xelfa,xelfa,w0,uxtw
call main call main
L00:
mov xFOLD,lr mov xFOLD,lr
mov w1,#MFD_EXEC // flags mov w1,#MFD_EXEC // flags
@@ -231,7 +438,8 @@ wmeth .req w4
.unreq xmeth .unreq xmeth
.unreq wmeth .unreq wmeth
str xPMASK,[sp] // propagate PAGE_MASK str xPMASK,[sp] // propagate PAGE_MASK D_PMASK
str cancel_SEGV,[sp, #D_XSIGSEGV]
// Write de-compressed stub // Write de-compressed stub
ldr w2,[xFOLD,#sz_unc + LBINFO - LxFOLD] // .sz_unc of fold ldr w2,[xFOLD,#sz_unc + LBINFO - LxFOLD] // .sz_unc of fold
@@ -255,13 +463,16 @@ wmeth .req w4
// Use the unfolded stub // Use the unfolded stub
ldr wLENC,[sp,#F_SZPK2] ldr wLENC,[sp,#F_SZPK2]
ldr w1,[xFOLD, #LOBINFO - LxFOLD] // O_BINFO ldr w1,[xFOLD, #LOBINFO - LxFOLD] // O_BINFO
add lr,xADRU,#3*4 + NBPW // jmp to fold_begin add lr,xADRU,#D_FOLD // jmp to fold_begin
sub wLENC,wLENC,w1 sub wLENC,wLENC,w1
str xLENC,[sp,#F_SZPK2] str xLENC,[sp,#F_SZPK2]
bic w1,w1,#unmap_all_pages bic w1,w1,#unmap_all_pages
add xADRC,xelfa,x1 // &b_info of compressed input data add xADRC,xelfa,x1 // &b_info of compressed input data
jr lr // goto unfolded stub jr lr // goto unfolded stub
cancel_dummy:
ret
zfind: zfind:
ldr x1,[x0],#NBPW; cbnz x1,zfind ldr x1,[x0],#NBPW; cbnz x1,zfind
ret ret
@@ -383,12 +594,8 @@ strupx:
.asciz "upx" .asciz "upx"
.balign 4 .balign 4
main: main: // In: w0= sz_pack2
lr .req x30 lr .req x30
add xelfa,lr,#sz_pack2 - L00 // &sz_pack2
ldr w0,[xelfa]
sub xelfa,xelfa,w0,uxtw
str x0,[sp,#F_SZPK2]
callr lr callr lr
LxFOLD: LxFOLD:
LOBINFO: LOBINFO:
+9 -6
View File
@@ -84,16 +84,16 @@ PATH_MAX= 4096
#define OVERHEAD 2048 #define OVERHEAD 2048
#include "MAX_ELF_HDR.S" #include "MAX_ELF_HDR.S"
PAGE_MASK: .quad ~0<<12 // default PAGE_MASK: .quad ~0<<12 // default D_PMASK
get_page_mask: .globl get_page_mask cancel_sigsegv: .quad 0 // D_XSIGSEGV
get_page_mask: .globl get_page_mask // D_GETPM
ldr x0,PAGE_MASK ldr x0,PAGE_MASK
ret ret
bits_privanon: // known offset (2*NBPW + 2*4) D_PRIVANON
bits_privanon: // known offset (NBPW + 2*4)
.int MAP_PRIVATE | MAP_ANONYMOUS // Linux default; else QNX .int MAP_PRIVATE | MAP_ANONYMOUS // Linux default; else QNX
fold_begin: // known offset (NBPW + 3*4) fold_begin: // known offset D_FOLD = (2*NBPW + 3*4)
//// bkpt // DEBUG
b L10 b L10
// In: sp/ PMASK,LENC,ADRU,LENU, x0,x1, argc,argv,... // In: sp/ PMASK,LENC,ADRU,LENU, x0,x1, argc,argv,...
@@ -271,6 +271,9 @@ no_env_pse:
add sp,sp,#MAX_ELF_HDR_64 + OVERHEAD // un-alloca add sp,sp,#MAX_ELF_HDR_64 + OVERHEAD // un-alloca
mov xfexp,x0 // entry address mov xfexp,x0 // entry address
ldr x0,cancel_sigsegv
blr x0 // callr
// Discard pages of compressed input data (includes [ADRC,+LENC) ) // Discard pages of compressed input data (includes [ADRC,+LENC) )
ldr x1,[xelfa,#p_memsz+sz_Phdr+sz_Ehdr] // Phdr[C_TEXT= 1].p_memsz ldr x1,[xelfa,#p_memsz+sz_Phdr+sz_Ehdr] // Phdr[C_TEXT= 1].p_memsz
mov x0,xelfa // hi &Elf64_Ehdr mov x0,xelfa // hi &Elf64_Ehdr
+18 -9
View File
@@ -129,7 +129,7 @@ Pprotect: .globl Pprotect
b mprotect b mprotect
Psync: .globl Psync // (addr, len, flags) Psync: .globl Psync // (addr, len, flags)
mflr r0; bl 0f; 0: mflr r6; mtlr r0; lwz r0,page_mask - 0b(r6) mflr r0; bl 0f; 0: mflr r6; mtlr r0; ld r0,page_mask - 0b(r6)
andc r0,a0,r0 // offset within page andc r0,a0,r0 // offset within page
sub a0,a0,r0 sub a0,a0,r0
add a1,a1,r0 add a1,a1,r0
@@ -418,21 +418,30 @@ close: .globl close
li r0,SYS_close; 5: b sysgo li r0,SYS_close; 5: b sysgo
upxfd_create: .globl upxfd_create // (char *tag, unsigned flags) upxfd_create: .globl upxfd_create // (char *tag, unsigned flags)
stdu a0,-AL_STK(sp) // push tag onto aligned stack
0: // try memfd_create 0: // try memfd_create
ld a0,0(sp) // get tag
li r0,SYS_memfd_create; sc; bns+ ok_memfd li r0,SYS_memfd_create; sc; bns+ ok_memfd
cmpwi a2,0; beq no_memfd // memfd_create failed twice // failed syscall returns errno in a0
li a2,0; b 0b // try again without MFD_EXEC cmpwi a0,EINVAL; bne 8f // unexpected error number
cmpwi a1,0; beq no_memfd // memfd_create failed twice
li a1,0; b 0b // try again without MFD_EXEC
no_memfd: // so try /dev/shm no_memfd: // so try /dev/shm
O_RDWR= 2 O_RDWR= 2
O_DIRECTORY= 040000 // 0x4000 O_DIRECTORY= 040000 // 0x4000
O_TMPFILE= 020000000 // 0x400000 O_TMPFILE= 020000000 // 0x400000
mflr r6; bl 0f; .asciz "/dev/shm"; .balign 4; mflr r6
0: mflr a1; mtlr r6 bl 0f; .asciz "/dev/shm"; .balign 4
li a2,0700 0: mflr a0
lis a3,O_TMPFILE>>16 mtlr r6
ori a3,a3,O_RDWR | O_DIRECTORY li a2,0700 // mode
li r0,SYS_open; sc; bns+ ok_memfd; teq r0,r0 lis a1,O_TMPFILE>>16
ori a1,a1,O_RDWR | O_DIRECTORY
li r0,SYS_open; sc; bns+ ok_memfd // name, flags, mode
8:
teq r0,r0 // unexpected errno
ok_memfd: ok_memfd:
addi sp,sp,AL_STK // toss tag
ret ret
__NR_memfd_create= 360 __NR_memfd_create= 360
+211
View File
@@ -0,0 +1,211 @@
/*
; riscv64-expand.S -- decompressors for riscv64
;
; This file is part of the UPX executable compressor.
;
; Copyright (C) 1996-2021 Markus Franz Xaver Johannes Oberhumer
; Copyright (C) 1996-2021 Laszlo Molnar
; Copyright (C) 2000-2021 John F. Reiser
; All Rights Reserved.
;
; UPX and the UCL library are free software; you can redistribute them
; and/or modify them under the terms of the GNU General Public License as
; published by the Free Software Foundation; either version 2 of
; the License, or (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; see the file COPYING.
; If not, write to the Free Software Foundation, Inc.,
; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Markus F.X.J. Oberhumer Laszlo Molnar
; <markus@oberhumer.com> <ezerotven+github@gmail.com>
;
; John F. Reiser
; <jreiser@users.sourceforge.net>
;
*/
NBPW = 8
#include "arch/riscv/64/macros.S"
.macro call subr; jal \subr; .endm
section EXP_HEAD
sz_unc= 0
sz_cpr= 4
b_method= 8
b_ftid= 9
b_cto8= 10
b_extra= 11
sz_binfo= 12
f_expand: .globl f_expand // f_expand(b_info *, dst, &dstlen)
// Supervisor for de-compression, un-filter, and sync_cache
// Input to supervisor:
#define fx_src a0
#define fx_dst a1
#define fx_dstlen a2
PUSH4 fx_src,fx_dst,fx_dstlen,ra // MATCH_95 params to unfilter and sync_cache
// Input to de-compressor:
#define xsrc a0
#define xsrclen a1
#define xdst a2
#define xdstlen a3
#define meth a4
lbu meth,b_method(fx_src)
mv xdstlen,fx_dstlen // arg4
mv xdst,fx_dst // arg3
lw xsrclen,sz_cpr(xsrc) // arg2
addi xsrc,fx_src,sz_binfo // arg1
call decompress
mv a3,a0 // save retval
POP4 fx_src,fx_dst,fx_dstlen,ra // MATCH_95 fx_src,fx_dst,fx_dstlen,ra
lw fx_dst,(fx_dst) // actual length used by decompressor
PUSH3 fx_src,fx_dst,a2 // MATCH_96 params for sync_cache
lbu a3,b_ftid(sp)
lbu a2,b_cto8(sp)
beqz a3,no_unf
//NYI #include "arch/arm64/v8/bxx.S" // unfilter code; args in registers, fall-through return
no_unf:
POP2 a0,a1 // MATCH_96 dst, len
add a1,a1,a0 // lo, hi
//NYI sync_cache // in macros.S
POP1 a0 // MATCH_96 retval from decompress
ret
#undef fx_src
#undef fx_dst
#undef fx_dstlen
#undef xsrc
#undef xsrclen
#undef xdst
#undef xdstlen
decompress: // (src *, cpr_len, dst *, &dstlen);
// sections NRV2B, etc, inserted here by addLoader() from ::buildLinuxLoader()
section EXP_TAIL
// Fall through: daisy chain had no matching method
li a0,-1
mv a1,meth
ebreak // EXP_TAIL daisy chain fail
#define src a0
#define bits a1
#define dst a2
#define off a3
#define len a4
#define disp a5
#define retbit t0
#define bytpre t1
.globl eof
// sync_cache is done in tail of f_expand, after possible unfilter
// NYI: eof_n2b, eof_n2d, eof_n2e should be unified.
eof_n2b: // .globl eof_n2b .type eof_n2b,%function
eof: // MATCH_90 end of a compressed extent; need sync_cache after unfilter
ld a2,0*NBPW(sp) // &input_eof
sub a0,src,a3 // src -= eof; // return 0: good; else: bad
ld a1,1*NBPW(sp) // original dst
sub dst,dst,a1 // dst -= original dst; actual length of output
ld a1,2*NBPW(sp) // &dstlen
sw dst,(a1) // actual length used at dst XXX: 4GB
ld ra,3*NBPW(sp)
addi sp,sp,4*NBPW
ret
// WINDOWS_BACK compatibility seems to be broken
// if POP3 replaces POP2+POP1 (MATCH_92, MATCH_91)
#define srclim a7
eof_n2d: // .globl eof_n2d
eof_n2e: // .globl eof_n2e
POP2 a3,a4 // MATCH_92 r3= orig_dst; r4= plen_dst
SUB2 src,srclim // 0 if actual src length equals expected length
SUB2 dst,a3 // actual dst length
sw dst,(a4)
POP1 ra // MATCH_91
ret
eof_lzma: .globl eof_lzma
POP4 x2,x3, fp,ra // MATCH_94 x2= orig_dst; x3= plen_dst
ret
upx_mmap_and_fd: .globl upx_mmap_and_fd
// UMF_LINUX goes here
#define M_NRV2B_LE32 2
#define M_NRV2B_8 3
#define M_NRV2D_LE32 5
#define M_NRV2D_8 6
#define M_NRV2E_LE32 8
#define M_NRV2E_8 9
#define M_CL1B_LE32 11
#define M_LZMA 14
#define NO_METHOD_CHECK 1 /* subsumed here by daisy chain */
getbit:
srli retbit,bits,63 # hi bit of 64
slli bits,bits,1; beq bits,zero,refill
ret
/* On refill: prefetch next byte, for latency reduction on literals and offsets. */
refill:
lw bits,(src); addi src,src,4
srli retbit,bits,31 # hi bit of 4 bytes fetched
slli bits,bits,1; lbu bytpre,(src) # prefetch
ori bits,bits,1 # the flag bit
slli bits,bits,32 # hi 32 bits in 64-bit register
ret
/* jump on next bit {0,1} with prediction {y==>likely, n==>unlikely} */
/* Prediction omitted for now. */
#define jnextb0np jnextb0yp
#define jnextb0yp GETBITp; beq retbit,zero,
#define jnextb1np jnextb1yp
#define jnextb1yp GETBITp; bne retbit,zero,
#define GETBITp \
call getbit
/* Same, but without prefetch (not useful for length of match.) */
#define jnextb0n jnextb0y
#define jnextb0y GETBIT; beq retbit,zero,
#define jnextb1n jnextb1y
#define jnextb1y GETBIT; bne retbit,zero,
#define GETBIT \
call getbit
/* rotate next bit into bottom bit of reg */
#define getnextbp(reg) GETBITp; slli reg,reg,1; or reg,reg,retbit
#define getnextb(reg) getnextbp(reg)
section NRV2E
li t0,M_NRV2E_LE32; bne meth,t0,not_nrv2e
//NYI #include "arch/arm64/v8/nrv2e_d.S"
not_nrv2e:
section NRV2D
li t0,M_NRV2D_LE32; bne meth,t0,not_nrv2d
//NYI #include "arch/arm64/v8/nrv2d_d.S"
not_nrv2d:
section NRV2B
li t0,M_NRV2B_LE32; bne meth,t0,not_nrv2b
#include "arch/riscv/64/nrv2b_d.S"
not_nrv2b:
section LZMA_DAISY
li t0,M_LZMA; bne meth,t0,not_lzma
//NYI #include "arch/arm64/v8/lzma_d.S"
not_lzma:
+287
View File
@@ -0,0 +1,287 @@
/* riscv64-linux.elf-entry.S -- Linux program entry point & decompressor (Elf binary)
*
* This file is part of the UPX executable compressor.
*
* Copyright (C) 1996-2025 Markus Franz Xaver Johannes Oberhumer
* Copyright (C) 1996-2025 Laszlo Molnar
* Copyright (C) 2000-2025 John F. Reiser
* All Rights Reserved.
*
* UPX and the UCL library are free software; you can redistribute them
* and/or modify them under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.
* If not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Markus F.X.J. Oberhumer Laszlo Molnar
* <markus@oberhumer.com> <ezerotven+github@gmail.com>
*
* John F. Reiser
* <jreiser@users.sourceforge.net>
*/
#include "arch/riscv/64/macros.S"
#include "arch/riscv/64/regs.h"
NBPW= 8
/* These from /usr/include/unistd_64.h */
__NR_close= 57
__NR_exit= 93
__NR_ftruncate= 64
__NR_memfd_create= 279
__NR_mmap= 222
__NR_mprotect= 226
__NR_msync= 227
__NR_openat= 56
__NR_write= 64
sz_Ehdr= 64
e_phnum= 56
sz_Phdr= 56
sz_l_info= 12
l_lsize= 8
sz_p_info= 12
sz_b_info= 12
sz_unc= 0
sz_cpr= 4
b_method= 8
AT_PAGESZ= 6
PROT_READ= 1
PROT_WRITE= 2
PROT_EXEC= 4
MAP_SHARED= 1
MAP_PRIVATE= 2
MAP_FIXED= 0x10
MAP_ANONYMOUS= 0x20
MFD_EXEC= 0x0010
SYS_mmap= 9 // 64-bit mode only!
FD_stderr= 2
M_NRV2B_LE32=2 // ../conf.h
M_NRV2D_LE32=5
M_NRV2E_LE32=8
// https://www.uclibc.org/docs/psABI-x86_64.pdf
section ELFMAINX
sz_pack2= .-4
_start: .globl _start
//// nop; int3 # uncomment for debugging
ld s0,0(sp) // argc
addi s1,sp,NBPW // argv
//NYI lea cancel_dummy(%rip),%r15
section ELFMAINX2
// same as in riscv64-linux.elf-fold.S
F_FRAME= 8*NBPW
F_EOF= 7*NBPW
F_ENTR= 6*NBPW; F_PMASK= F_ENTR
F_RDX= 5*NBPW
F_LENU= 4*NBPW
F_ADRU= 3*NBPW
F_ELFA= 2*NBPW
F_LENX= 1*NBPW
F_ADRX= 0*NBPW
D_FOLD= 2*NBPW // .data space at start of unfold
D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
// find auxv
slli t0,s0,3 // NBPW * argc
add t0,t0,a1 // end argv
0: // find end of env
addi t0,t0,NBPW // &env[k]
ld t1,(t0); bnez t1,0b
// find AT_PAGESZ in auxv
addi t0,t0,NBPW // &auxv
li a7,AT_PAGESZ // desired key
0:
ld t1,(t0); ld t2,NBPW(t0); addi t0,t0,2*NBPW
beq t1,a7,1f // found it
bne t1,zero,0b // keep searching
li t2,0x1000 // default PAGE_SIZE
1:
sub a7,zero,t2 // PAGE_MASK
2:
// Create anonymous temporary file on mfd; like upxfd_create
jal arg1,0f
str_upx:
.asciz "upx"
0:
// lla arg1,str_upx
li arg2,MFD_EXEC // flags
syscall __NR_memfd_create
bne a0,zero,ok_memfd // success
no_memfd: // so try /dev/shm
O_RDWR= 2
O_DIRECTORY= 0200000 // 0x010000
O_TMPFILE= 020000000 // 0x400000
# lla arg1,str_devmem
jal arg1,0f
str_devmem:
.asciz "/dev/mem"
.balign 4
0:
li arg2,0700 // mode
li arg3,O_RDWR | O_TMPFILE | O_DIRECTORY
syscall __NR_openat
ok_memfd:
#define mfd s2
mv mfd,rv
lla t0,sz_pack2
#define elfa s3
lw t1,(t0); sub elfa,t0,t1
#define binf s4
lla binf,4+o_binfo
#define lenu s5
lw lenu,sz_unc(binf)
#define szp2 s6
#define lenx s7
sub lenx,szp2,binf
#define adrx s8
add adrx,elfa,binf
#define old_sp s9
mv old_sp,sp
// alloca()
sub sp,sp,lenu; andi sp,sp,-2*NBPW
// Decompress the rest of this loader, and jump to it.
#define dst a2
#define src a0
#define lsrc a1
mv dst,sp
lw lsrc,sz_cpr(binf)
lbu t0,b_method(binf); li t1,M_NRV2B_LE32|(0<<8); beq t0,t1,0f; ebreak
0:
add t0,lsrc,src; sw t0,F_EOF(old_sp)
//%rsp:
// MATCH_10 old_sp
// MATCH_11 &input_eof
//%rbp === old_sp: array of F_FRAME
#define src a0
#define bits a1
#define dst a2
#define off a3
#define len a4
#define disp a5
#define retbit t0
#define bytpre t1
/* jump on next bit {0,1} with prediction {y==>likely, n==>unlikely} */
/* Prediction omitted for now. */
#define jnextb0np jnextb0yp
#define jnextb0yp GETBITp; beq retbit,zero,
#define jnextb1np jnextb1yp
#define jnextb1yp GETBITp; bne retbit,zero,
#define GETBITp \
call getbit
/* Same, but without prefetch (not useful for length of match.) */
#define jnextb0n jnextb0y
#define jnextb0y GETBIT; beq retbit,zero,
#define jnextb1n jnextb1y
#define jnextb1y GETBIT; bne retbit,zero,
#define GETBIT \
call getbit
/* rotate next bit into bottom bit of reg */
#define getnextbp(reg) GETBITp; slli reg,reg,1; or reg,reg,retbit
#define getnextb(reg) getnextbp(reg)
// We already checked the method and no filter.
#define NO_METHOD_CHECK 1
#include "arch/riscv/64/nrv2b_d.S"
getbit:
srli retbit,bits,63 # hi bit of 64
slli bits,bits,1; beq bits,zero,refill
ret
/* On refill: prefetch next byte, for latency reduction on literals and offsets. */
refill:
lw bits,(src); addi src,src,4
srli retbit,bits,31 # hi bit of 4 bytes fetched
slli bits,bits,1; lbu bytpre,(src) # prefetch
ori bits,bits,1 # the flag bit
slli bits,bits,32 # hi 32 bits in 64-bit register
ret
n2b_EOFbad:
ebreak
eof_n2b:
lw t0,F_EOF(old_sp)
bne t0,src,n2b_EOFbad
// Write de-compressed 'fold' to file
lw t0,F_PMASK(old_sp); sw t0,D_PMASK(sp) // propagate PAGE_MASK
lwu arg3,F_LENU(old_sp)
mv arg2,sp
mv arg1,mfd
mv s2,arg3 // LENU
0: // /dev/shm might be restricted to 8KiB at a time!
syscall __NR_write
add arg2,arg2,rv // ptr += count
sub arg3,arg3,rv // decrement count
bnez arg3,0b // not finished
// de-alloca()
mv sp,old_sp
// Map unfolded code the SELinux way
li arg6,0 // offset
mv arg5,mfd
li arg4,MAP_SHARED
li arg3,PROT_READ|PROT_EXEC // FIXME: add PROT_WRITE for DEBUG only
mv arg2,s2 // LENU
li arg1,0 // (%arg1)dst = 0; // kernel chooses addr
syscall __NR_mmap
sw rv,F_ADRU(old_sp)
mv arg1,mfd
syscall __NR_close
// Use the copy.
ld a0,F_ADRU(sp) //
addi a0,a0,D_FOLD // beyond .data
jr a0 // goto unfolded stub
// IDENTSTR goes here
section ELFMAINZ
.balign 4
o_binfo:
.long O_BINFO // offset of b_info for .text | is_ptinerp | unmap_all_pages
FOLD:
// { b_info={sz_unc, sz_cpr, {4 char}}, folded_loader...}
/*__XTHEENDX__*/
/* vim:set ts=8 sw=8 et: */
+340
View File
@@ -0,0 +1,340 @@
/* riscv64-linux.elf-fold.S -- linkage to C code to process Elf binary
*
* This file is part of the UPX executable compressor.
*
* Copyright (C) 2000-2025 John F. Reiser
* All Rights Reserved.
*
* UPX and the UCL library are free software; you can redistribute them
* and/or modify them under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; see the file COPYING.
* If not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Markus F.X.J. Oberhumer Laszlo Molnar
* <markus@oberhumer.com> <ezerotven+github@gmail.com>
*
* John F. Reiser
* <jreiser@users.sourceforge.net>
*/
NBPW= 8
#include "arch/riscv/64/macros.S"
#include "arch/riscv/64/regs.h"
PATH_MAX= 4096 // /usr/include/linux/limits.h
sz_b_info= 12
sz_unc= 0
sz_cpr= 4
sz_l_info= 12
sz_p_info= 12
MAP_PRIVATE= 0x02
MAP_FIXED= 0x10
PROT_READ= 0x1
O_RDONLY= 0
FD_CWD= -100
OVERHEAD=2048
/* 64-bit mode only! */
__NR_read= 0
__NR_write= 1
__NR_openat= 2 //NYI
__NR_close= 3
__NR_mmap= 9
__NR_mprotect= 10
__NR_munmap= 11
__NR_msync= 26 // 0x1a
MS_SYNC= 4
__NR_brk= 12
__NR_memfd_create= 0x13f // 319
__NR_ftruncate= 0x4d // 77
__NR_exit= 60
__NR_readlink= 89
unmap_all_pages= (1<<1)
is_ptinterp= (1<<0)
// same as in riscv64-linux.elf-entry.S
F_FRAME= 8*NBPW
F_EOF= 7*NBPW // sometimes omitted from FRAME
F_ENTR= 6*NBPW; F_PMASK= F_ENTR
F_RDX= 5*NBPW
F_LENU= 4*NBPW
F_ADRU= 3*NBPW
F_ELFA= 2*NBPW
F_LENX= 1*NBPW
F_ADRX= 0*NBPW
D_FOLD= 2*NBPW // .data space at start of unfold
D_PMASK= 0*NBPW
D_XSIGSEGV= 1*NBPW
#define rsp sp /* x2 */
#define rax a0 /* x10 */
#define rbx s1 /* x9 */
#define rbp s0 /* x8 */
#define rcx t2 /* x7 */
#define rdx t1 /* x6 */
#define r12 t0 /* x5 */
#define rdi a5 /* x15 */
#define rsi a4 /* x14 */
#define r15 a3 /* x13 */
#define r14 a2 /* x12 */
#define r13 a1 /* x11 */
#define rfd rbp /* file descriptor for /proc/self/exe */
.balign 8
PAGE_MASK: .quad -1<<12 // default
cancel_sigsegv: .quad 0 // subroutine that cancels sigaction(SIGSEGV,)
// IN: [ADRX,+LENX): compressed data; [ADRU,+LENU): expanded fold (w/ upx_main2)
// %rsp= %rbp= &F_ADRX; %r13= O_BINFO | is_ptinterp | unmap_all_pages
// no 'section', thus '.text'; also loaded first in riscv64-linux.elf-fold.bin.
// Code from riscv64-linux2.elf-main.c is also .text, and is next.
fold_begin:
//// ebreak # DEBUG
// copy is_interp bit from r13 to F_ELFA(rbp)
ld t0,F_ELFA(rbp); andi t1,r13,is_ptinterp; or t0,t0,t1;
sd t0,F_ELFA(rbp)
// if !unmap_all_pages then need space on stack for result of readlink("/proc/self/exe",...)
mv rsi,rsp
andi t0,r13,unmap_all_pages
bnez t0,5f; li t0,PATH_MAX; sub rsp,rsp,t0; 0:
mv rdi,rsp
li rcx,8
0: // copy down ADRX,LDRX,ELFA,ADRU,LENU,rdx,%entry,argc
ld t0,(rsi); addi rsi,rsi,NBPW; addi rcx,rcx,-1
sd t0,(rdi); addi rdi,rdi,NBPW; bnez rcx,0b
5:
0: // copy down argv
ld t0,(rsi); addi rsi,rsi,NBPW
sd t0,(rdi); addi rdi,rdi,NBPW
bnez t0,0b
mv r14,rdi // remember &new_env[0]
andi t0,r13,unmap_all_pages; bnez t0,0f
sd zero,(rdi); addi rdi,rdi,NBPW // space for new_env[0]
0: // find old Elf64_auxv
ld t0,(rsi); sd t0,(rdi); bnez t0,0b
mv t2,rdi # &old Elf64_auxv
0: // find &strings (beyond auxv)
ld t0,(rsi); ld t1,NBPW(rsi); addi rsi,rsi,2*NBPW
sd t0,(rdi); sd t1,NBPW(rdi); addi rdi,rdi,2*NBPW
bnez t0,0b
mv r15,rdi # beyond auxv
mv r13,rsi # beginning of strings
sub rdi,rdi,t2 # -length of auxv
andi t0,r13,unmap_all_pages; beqz t0,env_pse
ori rfd,rfd,~0; mv r14,rdi; j no_env_pse # no fd; beyond auxv
env_pse:
li arg3,0 # O_RdONLY
lla arg2,proc_self_exe
li arg1,FD_CWD
call openat; mv rfd,rv # fd
li arg3,-1+ PATH_MAX # buflen
mv arg2,sp # buffer
lla arg1,proc_self_exe
syscall __NR_readlink; bgez rv,0f
// readlink() failed. Set the result equal to the argument.
lla arg2,proc_self_exe # failure result= "/proc/self/exe"
li rcx,15 # sizeof "/proc/self/exe"
0:
// std
addi rdi,r13,-1 # dst last byte
sb zero,(rdi) # terminate
addi rsi,arg2,-1
add rsi,rsi,rcx # src last byte
0: // slide up (hi end goes first)
lbu t0,(rsi); addi rsi,rsi,-1; addi rcx,rcx,-1
sb t0,(rdi); addi rdi,rdi,-1; bnez rcx,0b
// add new env " =..."
li t0,' '; sb t0,-3(rdi); sb t0,-2(rdi); sb t0,-1(rdi); addi rdi,rdi,-3
sd rdi,(r14) # new_env[0]
andi rdi,rdi,-NBPW # align
mv rcx,r15
sub rsp,rsp,rcx # byte count
addi rdi,rdi,-NBPW # &last qword of new auxv
addi rsi,r15,-NBPW # &last qword of old auxv
// end of auxv must move by even number of NBPW
mv t0,rdi
xor t0,t0,rsi
andi t0,t0,NBPW
sub rdi,rdi,t0
mv r14,rdi # &last qword of new auxv
srl rcx,rcx,3
0:
ld t0,(rsi); addi rsi,rsi,-NBPW; addi rcx,rcx,-1
sd t0,(rdi); addi rdi,rdi,-NBPW; bnez rcx,0b
addi rsp,rdi,NBPW
// cld
add arg4,r14,r12; addi arg4,arg4,NBPW # &new Elf64_auxv %r12 dead
no_env_pse:
ld arg1,F_ADRX(rbp)
ld arg2,F_LENX(rbp)
andi arg1,arg1,~(is_ptinterp | unmap_all_pages)
ld arg5,F_ELFA(rbp) # ELFA | is_ptinterp
andi t0,arg5,is_ptinterp; or arg4,arg4,t0 # transfer is_ptinterp to &new_ELF64_auxv
sub arg5,arg5,t0 # and clear from ELFA
mv r13,arg5 # save ELFA
addi rsp,rsp,-OVERHEAD
mv arg3,rsp # &ELf64_Ehdr temporary space
call upx_main2 # Out: rv= entry
// entry= upx_main2(
// b_info *arg1, {%rdi}
// total_size arg2, {%rsi}
// Elf64_Ehdr *arg3, {%rdx}
// Elf32_Auxv_t *arg4, {%rcx}
// Elf64_Addr elfaddr {%r8}
// )
// rsp/ {OVERHEAD},ADRU,LENU,rdx,%entry, argc,argv,0,envp,0,auxv,0,strings
li t0,OVERHEAD
add rsp,rsp,t0 # remove Elf64_Ehdr temporary space
#define r_fd ebx
ld rfd,(rbp) //NYI
sd rv,3*NBPW(rsp) # entry
//NYI call *cancel_sigsegv(%rip)
sz_Ehdr= 8*NBPW
e_type= 16
ET_EXEC= 2
sz_Phdr= 7*NBPW
p_memsz= 5*NBPW
// Discard pages of compressed data (includes [ADRX,+LENX) )
addi arg2,r13,p_memsz+sz_Phdr+sz_Ehdr # Phdr[C_TEXT= 1].p_memsz
//cmpw $ET_EXEC, e_type(%r13); jne 1f
mv arg1,r13; call brk // also sets the brk
1:
mv arg1,r13; call munmap # discard C_TEXT compressed data
// Map 1 page of /proc/self/exe so that the symlink does not disappear.
bltz rfd,no_pse_map
li arg6,0 # 0 offset
mv arg5,rfd
li arg4,MAP_PRIVATE
li arg3,PROT_READ
li arg2,1<<12
li arg1,0
call mmap
mv arg1,rfd
call close
no_pse_map:
ld arg1,F_ADRU(rbp) # ADRU: unfolded upx_main2 etc.
ld arg2,F_LENU(rbp)
li a7,__NR_munmap
jr r14 # goto: syscall; pop %rdx; ret
get_page_mask: .globl get_page_mask
ld rv,PAGE_MASK
ret
section SYSCALLS
my_bkpt: .globl my_bkpt
ebreak // my_bkpt
ret
proc_self_exe:
.asciz "/proc/self/exe"
.balign 4
upxfd_create: .globl upxfd_create // (char *tag, unsigned flags)
0: // try memfd_create
syscall __NR_memfd_create; j ok_memfd //NYI
O_RDWR= 2
O_DIRECTORY= 0200000 // 0x010000
O_TMPFILE= 020000000 // 0x400000
li arg4,0700 # mode
li arg3,O_RDWR|O_DIRECTORY|O_TMPFILE
la arg3,dev_shm
li arg1,FD_CWD
syscall __NR_openat
ok_memfd:
ret
Pmap: .globl Pmap // page-align the lo end
ld t0,PAGE_MASK; xori t0,t0,~0 // frag mask
and arg1,arg1,t0 // frag
sub arg1,arg1,t0
add arg2,arg2,t0
mmap: .globl mmap
li a7,__NR_mmap
sysgo:
sys_check:
ebreak // sys_check
syscall 0 //NYI
//NYI syscall error checking
ret
Psync: .globl Psync
li a7,__NR_msync
j 5f
Pprotect: .globl Pprotect
li a7,__NR_mprotect
j 5f
Punmap: .globl Punmap // page-align the lo end
li a7,__NR_munmap
5:
ld t0,PAGE_MASK; xori t0,t0,~0 // frag mask
and t0,t0,arg1 // frag
sub arg1,arg1,t0
add arg2,arg2,t0
j sysgo
munmap: .globl munmap
li a7,__NR_munmap; 5: j 5f
exit: .globl exit
li a7,__NR_exit; 5: j 5f
brk: .globl brk
li a7,__NR_brk; 5: j 5f
close: .globl close
li a7,__NR_close; 5: j 5f
ftruncate: .globl ftruncate
li a7,__NR_ftruncate; 5: j 5f
open: .globl openat
li a7,__NR_openat; 5: j 5f
mprotect: .globl mprotect
li a7,__NR_mprotect; 5: j 5f
msync: .globl msync
li a7,__NR_msync; 5: j 5f
Pwrite: .globl Pwrite
write: .globl write
li a7,__NR_write; 5: j 5f
read: .globl read
li a7,__NR_read; 5: j sysgo
// vim:set ts=8 sw=8 et:
+37
View File
@@ -0,0 +1,37 @@
/* riscv64-linux.elf-fold.lds -- static linker script to build riscv64-linux.elf-fold.bin
This file is part of the UPX executable compressor.
Copyright (C) 2000-2025 John F. Reiser
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer Laszlo Molnar
<markus@oberhumer.com> <ezerotven+github@gmail.com>
John F. Reiser
<jreiser@users.sourceforge.net>
*/
OUTPUT_FORMAT("elf64-littleriscv64", "elf64-littleriscv64", "elf64-littleriscv64")
OUTPUT_ARCH(riscv64)
SECTIONS
{
. = SIZEOF_HEADERS;
}
@@ -0,0 +1,5 @@
.section HUMF_A, "ax"
j upx_mmap_and_fd_android
.section HUMF_L, "ax"
j upx_mmap_and_fd_linux
+1
View File
@@ -0,0 +1 @@
#include "amd64-linux.elf-main2.c"
+10
View File
@@ -74,6 +74,16 @@ extern void my_bkpt(void const *, ...);
/*und*/ : "x30"); \ /*und*/ : "x30"); \
str; \ str; \
}) })
#elif defined(__riscv) //}{
#define ANDROID_FRIEND 0
#define addr_string(string) ({ \
char const *str; \
asm("jal 0f; .string \"" string "\"; .balign 4; 0: mv %0,ra" \
/*out*/ : "=r"(str) \
/* in*/ : \
/*und*/ : "x30"); \
str; \
})
#else //}{ #else //}{
#define ANDROID_FRIEND 0 #define ANDROID_FRIEND 0
#error addr_string #error addr_string
+23 -4
View File
@@ -2,17 +2,36 @@ file format elf64-x86-64
Sections: Sections:
Idx Name Size VMA LMA File off Algn Flags Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 0193 0 0 040 2**0 CONTENTS 0 ELFMAINX 010 0 0 040 2**0 CONTENTS
1 ELFMAINZ 04 0 0 01d4 2**2 CONTENTS 1 ELFSIGSEGV 0310 0 0 050 2**0 CONTENTS
2 ELFMAINX2 0194 0 0 0360 2**0 CONTENTS
3 ELFMAINZ 04 0 0 04f4 2**2 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFMAINX 0 ELFMAINX 0000000000000000 l d ELFMAINX 0 ELFMAINX
0000000000000000 l d ELFMAINX2 0 ELFMAINX2
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFSIGSEGV 0 ELFSIGSEGV
0000000000000000 g ELFMAINX 0 _start 0000000000000000 g ELFMAINX 0 _start
0000000000000000 *UND* 0 O_BINFO 0000000000000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]: RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
0000000000000073 R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc 000000000000000c R_X86_64_PC32 ELFMAINX2+0x0000000000000158
RELOCATION RECORDS FOR [ELFSIGSEGV]:
OFFSET TYPE VALUE
00000000000000a2 R_X86_64_PC32 ELFMAINX2+0x000000000000015d
0000000000000250 R_X86_64_PC32 ELFMAINX2+0x000000000000015d
0000000000000262 R_X86_64_PC32 ELFMAINX2+0x000000000000015d
000000000000026a R_X86_64_PC32 ELFMAINX2+0x000000000000015d
00000000000002a5 R_X86_64_PC32 ELFMAINX2+0x000000000000015d
00000000000002bf R_X86_64_PC32 ELFMAINX2+0x000000000000015d
00000000000002d4 R_X86_64_PC32 ELFMAINX2+0x000000000000015d
RELOCATION RECORDS FOR [ELFMAINX2]:
OFFSET TYPE VALUE
000000000000005e R_X86_64_PC32 ELFMAINX+0xfffffffffffffff8
000000000000006a R_X86_64_PC32 ELFMAINZ+0xfffffffffffffffc
RELOCATION RECORDS FOR [ELFMAINZ]: RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
+8 -8
View File
@@ -8,14 +8,14 @@ Linker script and memory map
0x0000000000000040 . = SIZEOF_HEADERS 0x0000000000000040 . = SIZEOF_HEADERS
.text 0x0000000000000000 0x9cd .text 0x0000000000000000 0x9d9
.text 0x0000000000000000 0x165 tmp/amd64-linux.elf-fold.o .text 0x0000000000000000 0x173 tmp/amd64-linux.elf-fold.o
0x000000000000015d get_page_mask 0x000000000000016b get_page_mask
*fill* 0x0000000000000165 0x3 00 *fill* 0x0000000000000173 0x1 00
.text 0x0000000000000168 0x0 tmp/amd64-expand.o .text 0x0000000000000174 0x0 tmp/amd64-expand.o
.text 0x0000000000000168 0x865 tmp/amd64-linux.elf-main2.o .text 0x0000000000000174 0x865 tmp/amd64-linux.elf-main2.o
0x0000000000000898 upx_main2 0x00000000000008a4 upx_main2
0x00000000000002c6 underlay 0x00000000000002d2 underlay
UMF_LINUX 0x0000000000000000 0xf9 UMF_LINUX 0x0000000000000000 0xf9
UMF_LINUX 0x0000000000000000 0xf9 tmp/amd64-linux.elf-upxfd_linux.o UMF_LINUX 0x0000000000000000 0xf9 tmp/amd64-linux.elf-upxfd_linux.o
+18 -18
View File
@@ -8,18 +8,18 @@ Idx Name Size VMA LMA File off Algn
3 SO_MAIN 0813 0 0 0150 2**4 CONTENTS 3 SO_MAIN 0813 0 0 0150 2**4 CONTENTS
4 SO_HEAD 044 0 0 0963 2**0 CONTENTS 4 SO_HEAD 044 0 0 0963 2**0 CONTENTS
5 ptr_NEXT 0 0 0 09a7 2**0 CONTENTS 5 ptr_NEXT 0 0 0 09a7 2**0 CONTENTS
6 SO_TAIL 0c9 0 0 09a7 2**0 CONTENTS 6 SO_TAIL 0fa 0 0 09a7 2**0 CONTENTS
7 EXP_HEAD 0e9 0 0 0a70 2**0 CONTENTS 7 EXP_HEAD 0e9 0 0 0aa1 2**0 CONTENTS
8 NRV2E 0e8 0 0 0b59 2**0 CONTENTS 8 NRV2E 0e8 0 0 0b8a 2**0 CONTENTS
9 NRV2D 0db 0 0 0c41 2**0 CONTENTS 9 NRV2D 0db 0 0 0c72 2**0 CONTENTS
10 NRV2B 0c4 0 0 0d1c 2**0 CONTENTS 10 NRV2B 0c4 0 0 0d4d 2**0 CONTENTS
11 LZMA_DAISY 0a 0 0 0de0 2**0 CONTENTS 11 LZMA_DAISY 0a 0 0 0e11 2**0 CONTENTS
12 LZMA_ELF00 065 0 0 0dea 2**0 CONTENTS 12 LZMA_ELF00 065 0 0 0e1b 2**0 CONTENTS
13 LZMA_DEC10 09f7 0 0 0e4f 2**0 CONTENTS 13 LZMA_DEC10 09f7 0 0 0e80 2**0 CONTENTS
14 LZMA_DEC20 09f7 0 0 01846 2**0 CONTENTS 14 LZMA_DEC20 09f7 0 0 01877 2**0 CONTENTS
15 LZMA_DEC30 019 0 0 0223d 2**0 CONTENTS 15 LZMA_DEC30 019 0 0 0226e 2**0 CONTENTS
16 EXP_TAIL 014 0 0 02258 2**2 CONTENTS 16 EXP_TAIL 014 0 0 02288 2**2 CONTENTS
17 STRCON 04b 0 0 0226c 2**0 CONTENTS 17 STRCON 04b 0 0 0229c 2**0 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
0000000000000000 l d SO_HEAD 0 SO_HEAD 0000000000000000 l d SO_HEAD 0 SO_HEAD
0000000000000000 l d EXP_HEAD 0 EXP_HEAD 0000000000000000 l d EXP_HEAD 0 EXP_HEAD
@@ -54,22 +54,22 @@ SYMBOL TABLE:
0000000000000000 g F UMF_LINUX 0f9 upx_mmap_and_fd_linux 0000000000000000 g F UMF_LINUX 0f9 upx_mmap_and_fd_linux
0000000000000000 g F SO_TAIL 0 eof 0000000000000000 g F SO_TAIL 0 eof
00000000000004c3 g F SO_MAIN 0b9 prep_SELinux 00000000000004c3 g F SO_MAIN 0b9 prep_SELinux
00000000000000c1 g SO_TAIL 0 write 00000000000000ba g SO_TAIL 0 write
00000000000003fa g F SO_MAIN 01d PF_to_PROT 00000000000003fa g F SO_MAIN 01d PF_to_PROT
00000000000000af g SO_TAIL 0 memfd_create 00000000000000c2 g SO_TAIL 0 memfd_create
00000000000000c5 g SO_TAIL 0 read 00000000000000be g SO_TAIL 0 read
0000000000000184 g F SO_MAIN 0ef make_hatch 0000000000000184 g F SO_MAIN 0ef make_hatch
0000000000000013 g SO_TAIL 0 memset 0000000000000013 g SO_TAIL 0 memset
0000000000000042 g SO_TAIL 0 msync 0000000000000042 g SO_TAIL 0 msync
0000000000000011 g SO_TAIL 0 my_bkpt 0000000000000011 g SO_TAIL 0 my_bkpt
0000000000000046 g SO_TAIL 0 Pprotect 0000000000000046 g SO_TAIL 0 Pprotect
00000000000000c1 g SO_TAIL 0 Pwrite 00000000000000ba g SO_TAIL 0 Pwrite
0000000000000095 g SO_TAIL 0 Punmap 0000000000000095 g SO_TAIL 0 Punmap
00000000000000a7 g SO_TAIL 0 exit 00000000000000a7 g SO_TAIL 0 exit
00000000000000ba g SO_TAIL 0 openat 00000000000000b3 g SO_TAIL 0 openat
0000000000000080 g SO_TAIL 0 open 0000000000000080 g SO_TAIL 0 open
0000000000000057 g SO_TAIL 0 mprotect 0000000000000057 g SO_TAIL 0 mprotect
00000000000000b6 g SO_TAIL 0 close 00000000000000af g SO_TAIL 0 close
000000000000057c g F SO_MAIN 0297 upx_so_main 000000000000057c g F SO_MAIN 0297 upx_so_main
RELOCATION RECORDS FOR [HUMF_A]: RELOCATION RECORDS FOR [HUMF_A]:
+81 -59
View File
@@ -2,53 +2,100 @@ file format elf32-littlearm
Sections: Sections:
Idx Name Size VMA LMA File off Algn Flags Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINY 0 0 0 034 2**0 CONTENTS 0 ELFSIGSEGV 05c 0 0 034 2**0 CONTENTS
1 HUMF_A 04 0 0 034 2**0 CONTENTS 1 ELFMAINX2 0598 0 0 090 2**2 CONTENTS
2 HUMF_L 04 0 0 038 2**0 CONTENTS 2 ELFMAINY 0 0 0 0628 2**0 CONTENTS
3 UMF_ANDROID 0544 0 0 03c 2**2 CONTENTS 3 HUMF_A 04 0 0 0628 2**0 CONTENTS
4 UMF_LINUX 0144 0 0 0580 2**2 CONTENTS 4 HUMF_L 04 0 0 062c 2**0 CONTENTS
5 ELFMAINX 0264 0 0 06c4 2**2 CONTENTS 5 UMF_ANDROID 0544 0 0 0630 2**2 CONTENTS
6 ELFMAINZ 0218 0264 0264 0928 2**0 CONTENTS 6 UMF_LINUX 0144 0 0 0b74 2**2 CONTENTS
7 ELFMAINX 028 0 0 0cb8 2**0 CONTENTS
8 ELFMAINZ 0218 028 028 0ce0 2**0 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
00000000 l d ELFSIGSEGV 0 ELFSIGSEGV
00000000 l d ELFMAINX2 0 ELFMAINX2
00000000 l d UMF_ANDROID 0 UMF_ANDROID 00000000 l d UMF_ANDROID 0 UMF_ANDROID
00000000 l d UMF_LINUX 0 UMF_LINUX 00000000 l d UMF_LINUX 0 UMF_LINUX
00000000 l d ELFMAINX 0 ELFMAINX 00000000 l d ELFMAINX 0 ELFMAINX
00000264 l d ELFMAINZ 0 ELFMAINZ 00000028 l d ELFMAINZ 0 ELFMAINZ
00000000 l d ELFMAINY 0 ELFMAINY 00000000 l d ELFMAINY 0 ELFMAINY
00000000 l d HUMF_A 0 HUMF_A 00000000 l d HUMF_A 0 HUMF_A
00000000 l d HUMF_L 0 HUMF_L 00000000 l d HUMF_L 0 HUMF_L
00000258 g ELFMAINX 0 get_page_mask 0000058c g ELFMAINX2 0 get_page_mask
00000000 *UND* 0 MFLG 00000000 *UND* 0 MFLG
00000350 g ELFMAINZ 0 getpid 00000114 g ELFMAINZ 0 getpid
00000264 g ELFMAINX 0 upx_mmap_and_fd 00000598 g ELFMAINX2 0 upx_mmap_and_fd
0000026c g ELFMAINZ 0 memcpy 00000030 g ELFMAINZ 0 memcpy
00000000 *UND* 0 O_BINFO 00000000 *UND* 0 O_BINFO
00000404 g ELFMAINZ 0 Psync 000001c8 g ELFMAINZ 0 Psync
000002b0 g ELFMAINZ 0 mempcpy 00000074 g ELFMAINZ 0 mempcpy
0000033c g ELFMAINZ 0 ftruncate 00000100 g ELFMAINZ 0 ftruncate
00000364 g ELFMAINZ 0 lseek 00000128 g ELFMAINZ 0 lseek
000002c4 g F UMF_ANDROID 0280 upx_mmap_and_fd_android 000002c4 g F UMF_ANDROID 0280 upx_mmap_and_fd_android
00000434 g ELFMAINZ 0 mmap 000001f8 g ELFMAINZ 0 mmap
00000000 g F UMF_LINUX 0144 upx_mmap_and_fd_linux 00000000 g F UMF_LINUX 0144 upx_mmap_and_fd_linux
000003c8 g ELFMAINZ 0 uname 0000018c g ELFMAINZ 0 uname
00000000 g ELFMAINY 0 end_decompress 00000000 g ELFMAINY 0 end_decompress
000003f0 g ELFMAINZ 0 write 000001b4 g ELFMAINZ 0 write
00000314 g ELFMAINZ 0 fdatasync 000000d8 g ELFMAINZ 0 fdatasync
00000264 g ELFMAINZ 0 get_upxfn_path 00000028 g ELFMAINZ 0 get_upxfn_path
000002cc g ELFMAINZ 0 memfd_create 00000090 g ELFMAINZ 0 memfd_create
00000004 g ELFMAINX 0 _start 00000004 g ELFMAINX 0 _start
000003a0 g ELFMAINZ 0 read 00000164 g ELFMAINZ 0 read
000003dc g ELFMAINZ 0 unlink 000001a0 g ELFMAINZ 0 unlink
00000290 g ELFMAINZ 0 memset 00000054 g ELFMAINZ 0 memset
00000194 g F ELFMAINX 0c4 ucl_nrv2b_decompress_8 000004c8 g F ELFMAINX2 0c4 ucl_nrv2b_decompress_8
0000042c g ELFMAINZ 0 my_bkpt 000001f0 g ELFMAINZ 0 my_bkpt
00000328 g ELFMAINZ 0 fsync 000000ec g ELFMAINZ 0 fsync
000003b4 g ELFMAINZ 0 stat 00000178 g ELFMAINZ 0 stat
0000047c g ELFMAINZ 0 cpr0 00000240 g ELFMAINZ 0 cpr0
00000300 g ELFMAINZ 0 exit 000000c4 g ELFMAINZ 0 exit
0000038c g ELFMAINZ 0 open 00000150 g ELFMAINZ 0 open
00000378 g ELFMAINZ 0 mkdir 0000013c g ELFMAINZ 0 mkdir
000002ec g ELFMAINZ 0 close 000000b0 g ELFMAINZ 0 close
RELOCATION RECORDS FOR [ELFSIGSEGV]:
OFFSET TYPE VALUE
00000000 R_ARM_PC24 ELFMAINX2
00000038 R_ARM_PC24 ELFSIGSEGV
RELOCATION RECORDS FOR [ELFMAINX2]:
OFFSET TYPE VALUE
00000004 R_ARM_PC24 ELFMAINX2
00000008 R_ARM_PC24 ELFMAINX2
00000014 R_ARM_PC24 ELFMAINX2
0000001c R_ARM_PC24 ELFMAINX2
00000030 R_ARM_PC24 ELFMAINZ
00000068 R_ARM_PC24 ELFMAINX2
00000078 R_ARM_PC24 upx_mmap_and_fd
00000080 R_ARM_PC24 ELFMAINX2
000000b0 R_ARM_PC24 ELFMAINX2
000000f0 R_ARM_PC24 ELFMAINX2
0000020c R_ARM_PC24 ELFMAINX2
00000238 R_ARM_PC24 ELFMAINX2
000003dc R_ARM_PC24 ELFMAINX2
000003f4 R_ARM_PC24 ELFMAINX2
0000041c R_ARM_PC24 ELFMAINX2
00000420 R_ARM_PC24 ELFMAINX2
0000042c R_ARM_PC24 ELFMAINX2
000004a0 R_ARM_PC24 ELFMAINX2
000004a4 R_ARM_PC24 ELFMAINX2
000004c0 R_ARM_PC24 ELFMAINX2
000004d8 R_ARM_PC24 ELFMAINX2
00000510 R_ARM_PC24 ELFMAINX2
00000518 R_ARM_PC24 ELFMAINX2
0000051c R_ARM_PC24 ELFMAINX2
0000052c R_ARM_PC24 ELFMAINX2
00000530 R_ARM_PC24 ELFMAINX2
00000534 R_ARM_PC24 ELFMAINX2
00000540 R_ARM_PC24 ELFMAINX2
00000550 R_ARM_PC24 ELFMAINX2
00000554 R_ARM_PC24 ELFMAINX2
0000055c R_ARM_PC24 ELFMAINX2
00000564 R_ARM_PC24 ELFMAINX2
00000568 R_ARM_PC24 ELFMAINX2
00000584 R_ARM_PC24 ELFMAINX2
00000588 R_ARM_PC24 ELFMAINX2
RELOCATION RECORDS FOR [HUMF_A]: RELOCATION RECORDS FOR [HUMF_A]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
@@ -171,32 +218,7 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINX]: RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
00000000 R_ARM_ABS32 MFLG 00000000 R_ARM_ABS32 MFLG
00000010 R_ARM_PC24 ELFMAINX
00000014 R_ARM_PC24 ELFMAINX 00000014 R_ARM_PC24 ELFMAINX
00000020 R_ARM_PC24 ELFMAINX
00000028 R_ARM_PC24 ELFMAINX
00000058 R_ARM_PC24 ELFMAINZ
00000090 R_ARM_PC24 ELFMAINX
000000a0 R_ARM_PC24 upx_mmap_and_fd
000000a8 R_ARM_PC24 ELFMAINX
000000d8 R_ARM_PC24 ELFMAINX
00000114 R_ARM_PC24 ELFMAINX
0000018c R_ARM_PC24 ELFMAINX
000001a4 R_ARM_PC24 ELFMAINX
000001dc R_ARM_PC24 ELFMAINX
000001e4 R_ARM_PC24 ELFMAINX
000001e8 R_ARM_PC24 ELFMAINX
000001f8 R_ARM_PC24 ELFMAINX
000001fc R_ARM_PC24 ELFMAINX
00000200 R_ARM_PC24 ELFMAINX
0000020c R_ARM_PC24 ELFMAINX
0000021c R_ARM_PC24 ELFMAINX
00000220 R_ARM_PC24 ELFMAINX
00000228 R_ARM_PC24 ELFMAINX
00000230 R_ARM_PC24 ELFMAINX
00000234 R_ARM_PC24 ELFMAINX
00000250 R_ARM_PC24 ELFMAINX
00000254 R_ARM_PC24 ELFMAINX
RELOCATION RECORDS FOR [ELFMAINZ]: RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
+10 -11
View File
@@ -7,24 +7,23 @@ Name Origin Length Attributes
Linker script and memory map Linker script and memory map
.text 0x0000000000000000 0xcb8 .text 0x0000000000000000 0xcc0
.text 0x0000000000000000 0x398 tmp/arm.v4a-linux.elf-fold.o .text 0x0000000000000000 0x3a0 tmp/arm.v4a-linux.elf-fold.o
0x0000000000000004 get_page_mask 0x0000000000000004 get_page_mask
0x0000000000000338 memcpy 0x0000000000000340 memcpy
0x0000000000000048 Psync 0x0000000000000048 Psync
0x000000000000037c mempcpy 0x0000000000000384 mempcpy
0x00000000000000b0 mmap 0x00000000000000b0 mmap
0x0000000000000098 mmap_privanon 0x0000000000000098 mmap_privanon
0x000000000000000c get_upxfn_path 0x000000000000000c get_upxfn_path
0x000000000000035c memset 0x0000000000000364 memset
0x00000000fffffff4 page_mask
0x0000000000000024 Pprotect 0x0000000000000024 Pprotect
0x0000000000000024 mprotect 0x0000000000000024 mprotect
.text 0x0000000000000398 0x0 tmp/arm.v4a-linux.elf-help_umf.o .text 0x00000000000003a0 0x0 tmp/arm.v4a-linux.elf-help_umf.o
.text 0x0000000000000398 0x0 tmp/arm.v4a-expand.o .text 0x00000000000003a0 0x0 tmp/arm.v4a-expand.o
.text 0x0000000000000398 0x920 tmp/arm.v4a-linux.elf-main2.o .text 0x00000000000003a0 0x920 tmp/arm.v4a-linux.elf-main2.o
0x0000000000000c54 underlay 0x0000000000000c5c underlay
0x0000000000000b24 upx_main 0x0000000000000b2c upx_main
SYSCALLS 0x0000000000000000 0x214 SYSCALLS 0x0000000000000000 0x214
SYSCALLS 0x0000000000000000 0x214 tmp/arm.v4a-linux.elf-fold.o SYSCALLS 0x0000000000000000 0x214 tmp/arm.v4a-linux.elf-fold.o
+57 -35
View File
@@ -2,14 +2,18 @@ file format elf32-littlearm
Sections: Sections:
Idx Name Size VMA LMA File off Algn Flags Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINY 0 0 0 034 2**0 CONTENTS 0 ELFSIGSEGV 05c 0 0 034 2**0 CONTENTS
1 ELFMAINZ 0218 0 0 034 2**0 CONTENTS 1 ELFMAINX2 0598 0 0 090 2**2 CONTENTS
2 HUMF_A 04 0 0 024c 2**0 CONTENTS 2 ELFMAINY 0 0 0 0628 2**0 CONTENTS
3 HUMF_L 04 0 0 0250 2**0 CONTENTS 3 ELFMAINZ 0218 0 0 0628 2**0 CONTENTS
4 UMF_ANDROID 054c 0 0 0254 2**2 CONTENTS 4 HUMF_A 04 0 0 0840 2**0 CONTENTS
5 UMF_LINUX 0140 0 0 07a0 2**2 CONTENTS 5 HUMF_L 04 0 0 0844 2**0 CONTENTS
6 ELFMAINX 0264 0 0 08e0 2**2 CONTENTS 6 UMF_ANDROID 054c 0 0 0848 2**2 CONTENTS
7 UMF_LINUX 0140 0 0 0d94 2**2 CONTENTS
8 ELFMAINX 028 0 0 0ed4 2**0 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
00000000 l d ELFSIGSEGV 0 ELFSIGSEGV
00000000 l d ELFMAINX2 0 ELFMAINX2
00000000 l d ELFMAINZ 0 ELFMAINZ 00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 l d UMF_ANDROID 0 UMF_ANDROID 00000000 l d UMF_ANDROID 0 UMF_ANDROID
00000000 l d UMF_LINUX 0 UMF_LINUX 00000000 l d UMF_LINUX 0 UMF_LINUX
@@ -17,10 +21,10 @@ SYMBOL TABLE:
00000000 l d ELFMAINY 0 ELFMAINY 00000000 l d ELFMAINY 0 ELFMAINY
00000000 l d HUMF_A 0 HUMF_A 00000000 l d HUMF_A 0 HUMF_A
00000000 l d HUMF_L 0 HUMF_L 00000000 l d HUMF_L 0 HUMF_L
00000258 g ELFMAINX 0 get_page_mask 0000058c g ELFMAINX2 0 get_page_mask
00000000 *UND* 0 MFLG 00000000 *UND* 0 MFLG
000000ec g ELFMAINZ 0 getpid 000000ec g ELFMAINZ 0 getpid
00000264 g ELFMAINX 0 upx_mmap_and_fd 00000598 g ELFMAINX2 0 upx_mmap_and_fd
00000008 g ELFMAINZ 0 memcpy 00000008 g ELFMAINZ 0 memcpy
00000000 *UND* 0 O_BINFO 00000000 *UND* 0 O_BINFO
000001a0 g ELFMAINZ 0 Psync 000001a0 g ELFMAINZ 0 Psync
@@ -40,7 +44,7 @@ SYMBOL TABLE:
0000013c g ELFMAINZ 0 read 0000013c g ELFMAINZ 0 read
00000178 g ELFMAINZ 0 unlink 00000178 g ELFMAINZ 0 unlink
0000002c g ELFMAINZ 0 memset 0000002c g ELFMAINZ 0 memset
00000194 g F ELFMAINX 0c4 ucl_nrv2b_decompress_8 000004c8 g F ELFMAINX2 0c4 ucl_nrv2b_decompress_8
000001c8 g ELFMAINZ 0 my_bkpt 000001c8 g ELFMAINZ 0 my_bkpt
000000c4 g ELFMAINZ 0 fsync 000000c4 g ELFMAINZ 0 fsync
00000150 g ELFMAINZ 0 stat 00000150 g ELFMAINZ 0 stat
@@ -50,6 +54,49 @@ SYMBOL TABLE:
00000114 g ELFMAINZ 0 mkdir 00000114 g ELFMAINZ 0 mkdir
00000088 g ELFMAINZ 0 close 00000088 g ELFMAINZ 0 close
RELOCATION RECORDS FOR [ELFSIGSEGV]:
OFFSET TYPE VALUE
00000000 R_ARM_PC24 ELFMAINX2
00000038 R_ARM_PC24 ELFSIGSEGV
RELOCATION RECORDS FOR [ELFMAINX2]:
OFFSET TYPE VALUE
00000004 R_ARM_PC24 ELFMAINX2
00000008 R_ARM_PC24 ELFMAINX2
00000014 R_ARM_PC24 ELFMAINX2
0000001c R_ARM_PC24 ELFMAINX2
00000030 R_ARM_PC24 ELFMAINZ
00000068 R_ARM_PC24 ELFMAINX2
00000078 R_ARM_PC24 upx_mmap_and_fd
00000080 R_ARM_PC24 ELFMAINX2
000000b0 R_ARM_PC24 ELFMAINX2
000000f0 R_ARM_PC24 ELFMAINX2
0000020c R_ARM_PC24 ELFMAINX2
00000238 R_ARM_PC24 ELFMAINX2
000003dc R_ARM_PC24 ELFMAINX2
000003f4 R_ARM_PC24 ELFMAINX2
0000041c R_ARM_PC24 ELFMAINX2
00000420 R_ARM_PC24 ELFMAINX2
0000042c R_ARM_PC24 ELFMAINX2
000004a0 R_ARM_PC24 ELFMAINX2
000004a4 R_ARM_PC24 ELFMAINX2
000004c0 R_ARM_PC24 ELFMAINX2
000004d8 R_ARM_PC24 ELFMAINX2
00000510 R_ARM_PC24 ELFMAINX2
00000518 R_ARM_PC24 ELFMAINX2
0000051c R_ARM_PC24 ELFMAINX2
0000052c R_ARM_PC24 ELFMAINX2
00000530 R_ARM_PC24 ELFMAINX2
00000534 R_ARM_PC24 ELFMAINX2
00000540 R_ARM_PC24 ELFMAINX2
00000550 R_ARM_PC24 ELFMAINX2
00000554 R_ARM_PC24 ELFMAINX2
0000055c R_ARM_PC24 ELFMAINX2
00000564 R_ARM_PC24 ELFMAINX2
00000568 R_ARM_PC24 ELFMAINX2
00000584 R_ARM_PC24 ELFMAINX2
00000588 R_ARM_PC24 ELFMAINX2
RELOCATION RECORDS FOR [ELFMAINZ]: RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
0000000c R_ARM_PC24 ELFMAINZ 0000000c R_ARM_PC24 ELFMAINZ
@@ -183,29 +230,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINX]: RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
00000000 R_ARM_ABS32 MFLG 00000000 R_ARM_ABS32 MFLG
00000010 R_ARM_PC24 ELFMAINX
00000014 R_ARM_PC24 ELFMAINX 00000014 R_ARM_PC24 ELFMAINX
00000020 R_ARM_PC24 ELFMAINX
00000028 R_ARM_PC24 ELFMAINX
00000058 R_ARM_PC24 ELFMAINZ
00000090 R_ARM_PC24 ELFMAINX
000000a0 R_ARM_PC24 upx_mmap_and_fd
000000a8 R_ARM_PC24 ELFMAINX
000000d8 R_ARM_PC24 ELFMAINX
00000114 R_ARM_PC24 ELFMAINX
0000018c R_ARM_PC24 ELFMAINX
000001a4 R_ARM_PC24 ELFMAINX
000001dc R_ARM_PC24 ELFMAINX
000001e4 R_ARM_PC24 ELFMAINX
000001e8 R_ARM_PC24 ELFMAINX
000001f8 R_ARM_PC24 ELFMAINX
000001fc R_ARM_PC24 ELFMAINX
00000200 R_ARM_PC24 ELFMAINX
0000020c R_ARM_PC24 ELFMAINX
0000021c R_ARM_PC24 ELFMAINX
00000220 R_ARM_PC24 ELFMAINX
00000228 R_ARM_PC24 ELFMAINX
00000230 R_ARM_PC24 ELFMAINX
00000234 R_ARM_PC24 ELFMAINX
00000250 R_ARM_PC24 ELFMAINX
00000254 R_ARM_PC24 ELFMAINX
+10 -11
View File
@@ -7,24 +7,23 @@ Name Origin Length Attributes
Linker script and memory map Linker script and memory map
.text 0x0000000000000000 0xcb8 .text 0x0000000000000000 0xcc0
.text 0x0000000000000000 0x398 tmp/arm.v5a-linux.elf-fold.o .text 0x0000000000000000 0x3a0 tmp/arm.v5a-linux.elf-fold.o
0x0000000000000004 get_page_mask 0x0000000000000004 get_page_mask
0x0000000000000338 memcpy 0x0000000000000340 memcpy
0x0000000000000048 Psync 0x0000000000000048 Psync
0x000000000000037c mempcpy 0x0000000000000384 mempcpy
0x00000000000000b0 mmap 0x00000000000000b0 mmap
0x0000000000000098 mmap_privanon 0x0000000000000098 mmap_privanon
0x000000000000000c get_upxfn_path 0x000000000000000c get_upxfn_path
0x000000000000035c memset 0x0000000000000364 memset
0x00000000fffffff4 page_mask
0x0000000000000024 Pprotect 0x0000000000000024 Pprotect
0x0000000000000024 mprotect 0x0000000000000024 mprotect
.text 0x0000000000000398 0x0 tmp/arm.v5a-linux.elf-help_umf.o .text 0x00000000000003a0 0x0 tmp/arm.v5a-linux.elf-help_umf.o
.text 0x0000000000000398 0x0 tmp/arm.v5a-expand.o .text 0x00000000000003a0 0x0 tmp/arm.v5a-expand.o
.text 0x0000000000000398 0x920 tmp/arm.v5a-linux.elf-main2.o .text 0x00000000000003a0 0x920 tmp/arm.v5a-linux.elf-main2.o
0x0000000000000c54 underlay 0x0000000000000c5c underlay
0x0000000000000b24 upx_main 0x0000000000000b2c upx_main
SYSCALLS 0x0000000000000000 0x214 SYSCALLS 0x0000000000000000 0x214
SYSCALLS 0x0000000000000000 0x214 tmp/arm.v5a-linux.elf-fold.o SYSCALLS 0x0000000000000000 0x214 tmp/arm.v5a-linux.elf-fold.o
+17 -8
View File
@@ -2,25 +2,34 @@ file format elf64-littleaarch64
Sections: Sections:
Idx Name Size VMA LMA File off Algn Flags Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINX 0228 0 0 040 2**2 CONTENTS 0 ELFMAINX 010 0 0 040 2**0 CONTENTS
1 ELFMAINY 0 0 0 0268 2**0 CONTENTS 1 ELFSIGSEGV 0378 0 0 050 2**2 CONTENTS
2 ELFMAINZ 01c 0 0 0268 2**2 CONTENTS 2 ELFMAINX2 0234 0 0 03c8 2**2 CONTENTS
3 ELFMAINY 0 0 0 05fc 2**0 CONTENTS
4 ELFMAINZ 0c 0 0 05fc 2**2 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFMAINX 0 ELFMAINX 0000000000000000 l d ELFMAINX 0 ELFMAINX
0000000000000000 l d ELFMAINX2 0 ELFMAINX2
0000000000000000 l d ELFMAINZ 0 ELFMAINZ
0000000000000000 l d ELFSIGSEGV 0 ELFSIGSEGV
0000000000000000 l d ELFMAINY 0 ELFMAINY 0000000000000000 l d ELFMAINY 0 ELFMAINY
0000000000000000 *UND* 0 MFLG 0000000000000000 *UND* 0 MFLG
0000000000000004 g ELFMAINX 0 _start 0000000000000004 g ELFMAINX 0 _start
000000000000014c g F ELFMAINX 0dc ucl_nrv2b_decompress_32 0000000000000158 g F ELFMAINX2 0dc ucl_nrv2b_decompress_32
0000000000000000 g ELFMAINY 0 end_decompress 0000000000000000 g ELFMAINY 0 end_decompress
0000000000000000 *UND* 0 O_BINFO 0000000000000000 *UND* 0 O_BINFO
RELOCATION RECORDS FOR [ELFMAINX]: RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
0000000000000000 R_AARCH64_ABS32 MFLG 0000000000000000 R_AARCH64_ABS32 MFLG
000000000000003c R_AARCH64_CALL26 ELFMAINZ+0x0000000000000004 000000000000000c R_AARCH64_ADR_PREL_LO21 ELFMAINX2+0x0000000000000148
0000000000000048 R_AARCH64_ADR_PREL_LO21 ELFMAINZ
RELOCATION RECORDS FOR [ELFMAINX2]:
OFFSET TYPE VALUE
0000000000000030 R_AARCH64_ADR_PREL_LO21 ELFMAINX-0x0000000000000004
0000000000000040 R_AARCH64_CALL26 ELFMAINZ+0x0000000000000004
000000000000004c R_AARCH64_ADR_PREL_LO21 ELFMAINZ
RELOCATION RECORDS FOR [ELFMAINZ]: RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
0000000000000018 R_AARCH64_ABS32 O_BINFO 0000000000000008 R_AARCH64_ABS32 O_BINFO
+13 -13
View File
@@ -12,19 +12,19 @@ LOAD tmp/arm64-expand.o
LOAD tmp/arm64-linux.elf-main2.o LOAD tmp/arm64-linux.elf-main2.o
OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64) OUTPUT(tmp/arm64-linux.elf-fold.bin elf64-littleaarch64)
.text 0x0000000000000000 0xb84 .text 0x0000000000000000 0xb94
.text 0x0000000000000000 0x2c4 tmp/arm64-linux.elf-fold.o .text 0x0000000000000000 0x2d4 tmp/arm64-linux.elf-fold.o
0x0000000000000008 get_page_mask 0x0000000000000010 get_page_mask
0x0000000000000018 mmap_privanon 0x0000000000000020 mmap_privanon
0x0000000000000028 Psync 0x0000000000000030 Psync
0x0000000000000098 msync 0x00000000000000a0 msync
0x00000000000000a4 mmap 0x00000000000000ac mmap
0x00000000000000c0 Pprotect 0x00000000000000c8 Pprotect
0x00000000000000c0 mprotect 0x00000000000000c8 mprotect
.text 0x00000000000002c4 0x0 tmp/arm64-expand.o .text 0x00000000000002d4 0x0 tmp/arm64-expand.o
.text 0x00000000000002c4 0x8c0 tmp/arm64-linux.elf-main2.o .text 0x00000000000002d4 0x8c0 tmp/arm64-linux.elf-main2.o
0x00000000000009e0 underlay 0x00000000000009f0 underlay
0x0000000000000a4c upx_main2 0x0000000000000a5c upx_main2
.data 0x0000000000000000 0x0 .data 0x0000000000000000 0x0
.data 0x0000000000000000 0x0 tmp/arm64-linux.elf-fold.o .data 0x0000000000000000 0x0 tmp/arm64-linux.elf-fold.o
+57 -35
View File
@@ -2,14 +2,18 @@ file format elf32-bigarm
Sections: Sections:
Idx Name Size VMA LMA File off Algn Flags Idx Name Size VMA LMA File off Algn Flags
0 ELFMAINY 0 0 0 034 2**0 CONTENTS 0 ELFSIGSEGV 05c 0 0 034 2**0 CONTENTS
1 ELFMAINZ 0218 0 0 034 2**0 CONTENTS 1 ELFMAINX2 0598 0 0 090 2**2 CONTENTS
2 HUMF_A 04 0 0 024c 2**0 CONTENTS 2 ELFMAINY 0 0 0 0628 2**0 CONTENTS
3 HUMF_L 04 0 0 0250 2**0 CONTENTS 3 ELFMAINZ 0218 0 0 0628 2**0 CONTENTS
4 UMF_ANDROID 0544 0 0 0254 2**2 CONTENTS 4 HUMF_A 04 0 0 0840 2**0 CONTENTS
5 UMF_LINUX 0144 0 0 0798 2**2 CONTENTS 5 HUMF_L 04 0 0 0844 2**0 CONTENTS
6 ELFMAINX 0264 0 0 08dc 2**2 CONTENTS 6 UMF_ANDROID 0544 0 0 0848 2**2 CONTENTS
7 UMF_LINUX 0144 0 0 0d8c 2**2 CONTENTS
8 ELFMAINX 028 0 0 0ed0 2**0 CONTENTS
SYMBOL TABLE: SYMBOL TABLE:
00000000 l d ELFSIGSEGV 0 ELFSIGSEGV
00000000 l d ELFMAINX2 0 ELFMAINX2
00000000 l d ELFMAINZ 0 ELFMAINZ 00000000 l d ELFMAINZ 0 ELFMAINZ
00000000 l d UMF_ANDROID 0 UMF_ANDROID 00000000 l d UMF_ANDROID 0 UMF_ANDROID
00000000 l d UMF_LINUX 0 UMF_LINUX 00000000 l d UMF_LINUX 0 UMF_LINUX
@@ -17,10 +21,10 @@ SYMBOL TABLE:
00000000 l d ELFMAINY 0 ELFMAINY 00000000 l d ELFMAINY 0 ELFMAINY
00000000 l d HUMF_A 0 HUMF_A 00000000 l d HUMF_A 0 HUMF_A
00000000 l d HUMF_L 0 HUMF_L 00000000 l d HUMF_L 0 HUMF_L
00000258 g ELFMAINX 0 get_page_mask 0000058c g ELFMAINX2 0 get_page_mask
00000000 *UND* 0 MFLG 00000000 *UND* 0 MFLG
000000ec g ELFMAINZ 0 getpid 000000ec g ELFMAINZ 0 getpid
00000264 g ELFMAINX 0 upx_mmap_and_fd 00000598 g ELFMAINX2 0 upx_mmap_and_fd
00000008 g ELFMAINZ 0 memcpy 00000008 g ELFMAINZ 0 memcpy
00000000 *UND* 0 O_BINFO 00000000 *UND* 0 O_BINFO
000001a0 g ELFMAINZ 0 Psync 000001a0 g ELFMAINZ 0 Psync
@@ -40,7 +44,7 @@ SYMBOL TABLE:
0000013c g ELFMAINZ 0 read 0000013c g ELFMAINZ 0 read
00000178 g ELFMAINZ 0 unlink 00000178 g ELFMAINZ 0 unlink
0000002c g ELFMAINZ 0 memset 0000002c g ELFMAINZ 0 memset
00000194 g F ELFMAINX 0c4 ucl_nrv2b_decompress_8 000004c8 g F ELFMAINX2 0c4 ucl_nrv2b_decompress_8
000001c8 g ELFMAINZ 0 my_bkpt 000001c8 g ELFMAINZ 0 my_bkpt
000000c4 g ELFMAINZ 0 fsync 000000c4 g ELFMAINZ 0 fsync
00000150 g ELFMAINZ 0 stat 00000150 g ELFMAINZ 0 stat
@@ -50,6 +54,49 @@ SYMBOL TABLE:
00000114 g ELFMAINZ 0 mkdir 00000114 g ELFMAINZ 0 mkdir
00000088 g ELFMAINZ 0 close 00000088 g ELFMAINZ 0 close
RELOCATION RECORDS FOR [ELFSIGSEGV]:
OFFSET TYPE VALUE
00000000 R_ARM_PC24 ELFMAINX2
00000038 R_ARM_PC24 ELFSIGSEGV
RELOCATION RECORDS FOR [ELFMAINX2]:
OFFSET TYPE VALUE
00000004 R_ARM_PC24 ELFMAINX2
00000008 R_ARM_PC24 ELFMAINX2
00000014 R_ARM_PC24 ELFMAINX2
0000001c R_ARM_PC24 ELFMAINX2
00000030 R_ARM_PC24 ELFMAINZ
00000068 R_ARM_PC24 ELFMAINX2
00000078 R_ARM_PC24 upx_mmap_and_fd
00000080 R_ARM_PC24 ELFMAINX2
000000b0 R_ARM_PC24 ELFMAINX2
000000f0 R_ARM_PC24 ELFMAINX2
0000020c R_ARM_PC24 ELFMAINX2
00000238 R_ARM_PC24 ELFMAINX2
000003dc R_ARM_PC24 ELFMAINX2
000003f4 R_ARM_PC24 ELFMAINX2
0000041c R_ARM_PC24 ELFMAINX2
00000420 R_ARM_PC24 ELFMAINX2
0000042c R_ARM_PC24 ELFMAINX2
000004a0 R_ARM_PC24 ELFMAINX2
000004a4 R_ARM_PC24 ELFMAINX2
000004c0 R_ARM_PC24 ELFMAINX2
000004d8 R_ARM_PC24 ELFMAINX2
00000510 R_ARM_PC24 ELFMAINX2
00000518 R_ARM_PC24 ELFMAINX2
0000051c R_ARM_PC24 ELFMAINX2
0000052c R_ARM_PC24 ELFMAINX2
00000530 R_ARM_PC24 ELFMAINX2
00000534 R_ARM_PC24 ELFMAINX2
00000540 R_ARM_PC24 ELFMAINX2
00000550 R_ARM_PC24 ELFMAINX2
00000554 R_ARM_PC24 ELFMAINX2
0000055c R_ARM_PC24 ELFMAINX2
00000564 R_ARM_PC24 ELFMAINX2
00000568 R_ARM_PC24 ELFMAINX2
00000584 R_ARM_PC24 ELFMAINX2
00000588 R_ARM_PC24 ELFMAINX2
RELOCATION RECORDS FOR [ELFMAINZ]: RELOCATION RECORDS FOR [ELFMAINZ]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
0000000c R_ARM_PC24 ELFMAINZ 0000000c R_ARM_PC24 ELFMAINZ
@@ -181,29 +228,4 @@ OFFSET TYPE VALUE
RELOCATION RECORDS FOR [ELFMAINX]: RELOCATION RECORDS FOR [ELFMAINX]:
OFFSET TYPE VALUE OFFSET TYPE VALUE
00000000 R_ARM_ABS32 MFLG 00000000 R_ARM_ABS32 MFLG
00000010 R_ARM_PC24 ELFMAINX
00000014 R_ARM_PC24 ELFMAINX 00000014 R_ARM_PC24 ELFMAINX
00000020 R_ARM_PC24 ELFMAINX
00000028 R_ARM_PC24 ELFMAINX
00000058 R_ARM_PC24 ELFMAINZ
00000090 R_ARM_PC24 ELFMAINX
000000a0 R_ARM_PC24 upx_mmap_and_fd
000000a8 R_ARM_PC24 ELFMAINX
000000d8 R_ARM_PC24 ELFMAINX
00000114 R_ARM_PC24 ELFMAINX
0000018c R_ARM_PC24 ELFMAINX
000001a4 R_ARM_PC24 ELFMAINX
000001dc R_ARM_PC24 ELFMAINX
000001e4 R_ARM_PC24 ELFMAINX
000001e8 R_ARM_PC24 ELFMAINX
000001f8 R_ARM_PC24 ELFMAINX
000001fc R_ARM_PC24 ELFMAINX
00000200 R_ARM_PC24 ELFMAINX
0000020c R_ARM_PC24 ELFMAINX
0000021c R_ARM_PC24 ELFMAINX
00000220 R_ARM_PC24 ELFMAINX
00000228 R_ARM_PC24 ELFMAINX
00000230 R_ARM_PC24 ELFMAINX
00000234 R_ARM_PC24 ELFMAINX
00000250 R_ARM_PC24 ELFMAINX
00000254 R_ARM_PC24 ELFMAINX
+10 -11
View File
@@ -7,24 +7,23 @@ Name Origin Length Attributes
Linker script and memory map Linker script and memory map
.text 0x0000000000000000 0xccc .text 0x0000000000000000 0xcd4
.text 0x0000000000000000 0x398 tmp/armeb.v4a-linux.elf-fold.o .text 0x0000000000000000 0x3a0 tmp/armeb.v4a-linux.elf-fold.o
0x0000000000000004 get_page_mask 0x0000000000000004 get_page_mask
0x0000000000000338 memcpy 0x0000000000000340 memcpy
0x0000000000000048 Psync 0x0000000000000048 Psync
0x000000000000037c mempcpy 0x0000000000000384 mempcpy
0x00000000000000b0 mmap 0x00000000000000b0 mmap
0x0000000000000098 mmap_privanon 0x0000000000000098 mmap_privanon
0x000000000000000c get_upxfn_path 0x000000000000000c get_upxfn_path
0x000000000000035c memset 0x0000000000000364 memset
0x00000000fffffff4 page_mask
0x0000000000000024 Pprotect 0x0000000000000024 Pprotect
0x0000000000000024 mprotect 0x0000000000000024 mprotect
.text 0x0000000000000398 0x0 tmp/armeb.v4a-linux.elf-help_umf.o .text 0x00000000000003a0 0x0 tmp/armeb.v4a-linux.elf-help_umf.o
.text 0x0000000000000398 0x0 tmp/armeb.v4a-expand.o .text 0x00000000000003a0 0x0 tmp/armeb.v4a-expand.o
.text 0x0000000000000398 0x934 tmp/armeb.v4a-linux.elf-main2.o .text 0x00000000000003a0 0x934 tmp/armeb.v4a-linux.elf-main2.o
0x0000000000000c68 underlay 0x0000000000000c70 underlay
0x0000000000000b34 upx_main 0x0000000000000b3c upx_main
SYSCALLS 0x0000000000000000 0x214 SYSCALLS 0x0000000000000000 0x214
SYSCALLS 0x0000000000000000 0x214 tmp/armeb.v4a-linux.elf-fold.o SYSCALLS 0x0000000000000000 0x214 tmp/armeb.v4a-linux.elf-fold.o
+5 -5
View File
@@ -27,8 +27,8 @@ OUTPUT(tmp/powerpc64-linux.elf-fold.bin elf64-powerpc)
.bss 0x0000000000000000 0x0 .bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64-linux.elf-fold.o .bss 0x0000000000000000 0x0 tmp/powerpc64-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0x148 SYSCALLS 0x0000000000000000 0x15c
SYSCALLS 0x0000000000000000 0x148 tmp/powerpc64-linux.elf-fold.o SYSCALLS 0x0000000000000000 0x15c tmp/powerpc64-linux.elf-fold.o
0x0000000000000008 mmap 0x0000000000000008 mmap
0x0000000000000020 munmap 0x0000000000000020 munmap
0x0000000000000028 mprotect 0x0000000000000028 mprotect
@@ -44,9 +44,9 @@ SYSCALLS 0x0000000000000000 0x148
0x0000000000000070 openat 0x0000000000000070 openat
0x0000000000000078 close 0x0000000000000078 close
0x0000000000000080 upxfd_create 0x0000000000000080 upxfd_create
0x00000000000000d8 memfd_create 0x00000000000000ec memfd_create
0x000000000000011c memcpy 0x0000000000000130 memcpy
0x0000000000000140 my_bkpt 0x0000000000000154 my_bkpt
.comment 0x0000000000000000 0x33 .comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64-linux.elf-fold.o .comment 0x0000000000000000 0x33 tmp/powerpc64-linux.elf-fold.o
+5 -5
View File
@@ -27,8 +27,8 @@ OUTPUT(tmp/powerpc64le-linux.elf-fold.bin elf64-powerpcle)
.bss 0x0000000000000000 0x0 .bss 0x0000000000000000 0x0
.bss 0x0000000000000000 0x0 tmp/powerpc64le-linux.elf-fold.o .bss 0x0000000000000000 0x0 tmp/powerpc64le-linux.elf-fold.o
SYSCALLS 0x0000000000000000 0x148 SYSCALLS 0x0000000000000000 0x15c
SYSCALLS 0x0000000000000000 0x148 tmp/powerpc64le-linux.elf-fold.o SYSCALLS 0x0000000000000000 0x15c tmp/powerpc64le-linux.elf-fold.o
0x0000000000000008 mmap 0x0000000000000008 mmap
0x0000000000000020 munmap 0x0000000000000020 munmap
0x0000000000000028 mprotect 0x0000000000000028 mprotect
@@ -44,9 +44,9 @@ SYSCALLS 0x0000000000000000 0x148
0x0000000000000070 openat 0x0000000000000070 openat
0x0000000000000078 close 0x0000000000000078 close
0x0000000000000080 upxfd_create 0x0000000000000080 upxfd_create
0x00000000000000d8 memfd_create 0x00000000000000ec memfd_create
0x000000000000011c memcpy 0x0000000000000130 memcpy
0x0000000000000140 my_bkpt 0x0000000000000154 my_bkpt
.comment 0x0000000000000000 0x33 .comment 0x0000000000000000 0x33
.comment 0x0000000000000000 0x33 tmp/powerpc64le-linux.elf-fold.o .comment 0x0000000000000000 0x33 tmp/powerpc64le-linux.elf-fold.o
+347 -345
View File
@@ -33,351 +33,6 @@
namespace upx { namespace upx {
/*************************************************************************
// core util
**************************************************************************/
// disable taking the address => force passing by reference (instead of pointer)
#define UPX_CXX_DISABLE_ADDRESS(Klass) \
private: \
Klass *operator&() const noexcept DELETED_FUNCTION;
// disable copy and move
#define UPX_CXX_DISABLE_COPY(KlassName) \
private: \
KlassName(const KlassName &) noexcept DELETED_FUNCTION; /* copy constructor */ \
KlassName &operator=(const KlassName &) noexcept DELETED_FUNCTION; /* copy assignment */
#define UPX_CXX_DISABLE_MOVE(KlassName) \
private: \
KlassName(KlassName &&) noexcept DELETED_FUNCTION; /* move constructor */ \
KlassName &operator=(KlassName &&) noexcept DELETED_FUNCTION; /* move assignment */
#define UPX_CXX_DISABLE_COPY_MOVE(KlassName) \
UPX_CXX_DISABLE_COPY(KlassName) \
UPX_CXX_DISABLE_MOVE(KlassName)
// fun with C++: disable common "new" and ALL "delete" operators
// https://en.cppreference.com/w/cpp/memory/new/operator_delete
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
private: \
/* common allocation functions (4) */ \
static void *operator new(std::size_t) DELETED_FUNCTION; \
static void *operator new[](std::size_t) DELETED_FUNCTION; \
static void *operator new(std::size_t, void *) DELETED_FUNCTION; \
static void *operator new[](std::size_t, void *) DELETED_FUNCTION; \
/* replaceable placement deallocation functions (4) */ \
static void operator delete(void *, const std::nothrow_t &) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, const std::nothrow_t &) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::align_val_t, const std::nothrow_t &) \
noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t, const std::nothrow_t &) \
noexcept DELETED_FUNCTION; \
/* non-allocating placement deallocation functions (2) */ \
static void operator delete(void *, void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, void *) noexcept DELETED_FUNCTION;
/* class-specific usual deallocation functions (8) */
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_A__(Klass) \
protected: \
static void operator delete(void *) noexcept {} \
static void operator delete(void *, std::align_val_t) noexcept {} \
static void operator delete(void *, std::size_t) noexcept {} \
static void operator delete(void *, std::size_t, std::align_val_t) noexcept {} \
private: \
static void operator delete[](void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION;
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_B__(Klass) \
private: \
static void operator delete(void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION;
/* class-specific usual destroying deallocation functions (4) */
#if __cplusplus >= 202002L
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass) \
protected: \
static void operator delete(Klass *, std::destroying_delete_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::align_val_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t, std::align_val_t) \
noexcept {} \
private:
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass) \
private: \
static void operator delete(Klass *, std::destroying_delete_t) noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::align_val_t) \
noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t) \
noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t, std::align_val_t) \
noexcept DELETED_FUNCTION;
#else
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass) private:
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass) private:
#endif
// for classes which may have virtual methods
#define UPX_CXX_DISABLE_NEW_DELETE(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_A__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass)
// this only works for classes WITHOUT any virtual methods
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_B__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass)
#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) // do not use std::align_val_t
#undef UPX_CXX_DISABLE_NEW_DELETE
#undef UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL
#define UPX_CXX_DISABLE_NEW_DELETE(Klass) private:
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private:
#endif
class noncopyable {
protected:
forceinline constexpr noncopyable() noexcept {}
#if __cplusplus >= 202002L
forceinline constexpr ~noncopyable() noexcept = default;
#else
forceinline ~noncopyable() noexcept = default;
#endif
UPX_CXX_DISABLE_COPY_MOVE(noncopyable)
};
/*************************************************************************
// <type_traits>
**************************************************************************/
// is_bounded_array from C++20
template <class T>
struct is_bounded_array : public std::false_type {};
template <class T, std::size_t N>
struct is_bounded_array<T[N]> : public std::true_type {};
template <class T>
inline constexpr bool is_bounded_array_v = is_bounded_array<T>::value;
// is_same_all and is_same_any: std::is_same for multiple types
template <class T, class... Ts>
struct is_same_all : public std::conjunction<std::is_same<T, Ts>...> {};
template <class T, class... Ts>
inline constexpr bool is_same_all_v = is_same_all<T, Ts...>::value;
template <class T, class... Ts>
struct is_same_any : public std::disjunction<std::is_same<T, Ts>...> {};
template <class T, class... Ts>
inline constexpr bool is_same_any_v = is_same_any<T, Ts...>::value;
// remove_cvref from C++20
template <class T>
struct remove_cvref {
typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
};
template <class T>
using remove_cvref_t = typename remove_cvref<T>::type;
// type_identity from C++20
template <class T>
struct type_identity {
typedef T type;
};
template <class T>
using type_identity_t = typename type_identity<T>::type;
/*************************************************************************
// <bit> C++20
**************************************************************************/
template <class T>
forceinline constexpr bool has_single_bit(T x) noexcept {
return !(x == 0) && (x & (x - 1)) == 0;
}
/*************************************************************************
// <algorithm>
**************************************************************************/
template <class T>
inline constexpr T align_down(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
r = x - (x & (alignment - 1));
return r;
}
template <class T>
inline constexpr T align_down_gap(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
r = x & (alignment - 1);
return r;
}
template <class T>
inline constexpr T align_up(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
constexpr T zero = {};
r = x + ((zero - x) & (alignment - 1));
return r;
}
template <class T>
inline constexpr T align_up_gap(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
constexpr T zero = {};
r = (zero - x) & (alignment - 1);
return r;
}
template <class T>
forceinline constexpr T min(const T &a, const T &b) noexcept {
return b < a ? b : a;
}
template <class T>
forceinline constexpr T max(const T &a, const T &b) noexcept {
return a < b ? b : a;
}
template <class T>
inline constexpr bool is_uminmax_type = std::is_integral_v<T> && std::is_unsigned_v<T>;
template <class T, class = std::enable_if_t<is_uminmax_type<T>, T> >
forceinline constexpr T umin(const T &a, const T &b) noexcept {
return b < a ? b : a;
}
template <class T, class = std::enable_if_t<is_uminmax_type<T>, T> >
forceinline constexpr T umax(const T &a, const T &b) noexcept {
return a < b ? b : a;
}
template <class T>
forceinline constexpr T wrapping_add(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>);
typedef std::make_unsigned_t<T> U;
return T(U(a) + U(b));
}
template <class T>
forceinline constexpr T wrapping_sub(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>);
typedef std::make_unsigned_t<T> U;
return T(U(a) - U(b));
}
/*************************************************************************
// util
**************************************************************************/
template <std::size_t Size>
struct UnsignedSizeOf final {
static_assert(Size >= 1 && Size <= UPX_RSIZE_MAX_MEM);
static constexpr unsigned value = unsigned(Size);
};
// a static_cast that does not trigger -Wcast-align warnings
template <class Result, class From>
forceinline constexpr Result ptr_static_cast(From *ptr) noexcept {
static_assert(std::is_pointer_v<Result>);
// don't cast through "void *" if type is convertible
typedef std::conditional_t<std::is_convertible_v<decltype(ptr), Result>, Result, void *>
VoidPtr;
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
return static_cast<Result>(static_cast<VoidPtr>(ptr));
}
template <class Result, class From>
forceinline constexpr Result ptr_static_cast(const From *ptr) noexcept {
static_assert(std::is_pointer_v<Result>);
static_assert(std::is_const_v<std::remove_pointer_t<Result> >); // required
// don't cast through "const void *" if type is convertible
typedef std::conditional_t<std::is_convertible_v<decltype(ptr), Result>, Result, const void *>
VoidPtr;
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
return static_cast<Result>(static_cast<VoidPtr>(ptr));
}
#if WITH_THREADS
// cast "T *" to "std::atomic<T> *"
template <class T>
forceinline std::atomic<T> *ptr_std_atomic_cast(T *ptr) noexcept {
// TODO later: make sure that this cast is indeed legal
std::atomic<T> *result = ptr_static_cast<std::atomic<T> *>(ptr);
static_assert(sizeof(*result) == sizeof(*ptr));
static_assert(alignof(decltype(*result)) == alignof(decltype(*ptr)));
return result;
}
#endif // WITH_THREADS
// atomic_exchange
template <class T>
forceinline T atomic_exchange(T *ptr, T new_value) noexcept {
#if 1
static_assert(sizeof(T) == sizeof(void *)); // UPX convention: restrict to pointer-size for now
#endif
static_assert(std::is_standard_layout_v<T>);
static_assert(std::is_trivially_copyable_v<T>);
#if !(WITH_THREADS)
T old_value = *ptr;
*ptr = new_value;
return old_value;
#else
static_assert(sizeof(T) <= sizeof(void *)); // UPX convention: restrict to fundamental types
static_assert(alignof(T) == sizeof(T)); // UPX convention: require proper alignment
#if __has_builtin(__atomic_exchange_n) && defined(__ATOMIC_SEQ_CST)
return __atomic_exchange_n(ptr, new_value, __ATOMIC_SEQ_CST);
#elif __has_builtin(__sync_swap)
return __sync_swap(ptr, new_value);
#else
return std::atomic_exchange(ptr_std_atomic_cast(ptr), new_value);
#endif
#endif
}
// helper classes so we don't leak memory on exceptions
template <class T>
struct ObjectDeleter final {
T **items; // public
std::size_t count; // public
explicit ObjectDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~ObjectDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
delete item; // single object delete
}
}
};
template <class T>
struct ArrayDeleter final {
T **items; // public
std::size_t count; // public
explicit ArrayDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~ArrayDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
delete[] item; // array delete
}
}
};
template <class T>
struct MallocDeleter final {
T **items; // public
std::size_t count; // public
explicit MallocDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~MallocDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
::free(item); // free memory from malloc()
}
}
};
/************************************************************************* /*************************************************************************
// compile_time // compile_time
**************************************************************************/ **************************************************************************/
@@ -594,6 +249,353 @@ forceinline constexpr void set_ne64(byte *p, upx_uint64_t v) noexcept {
} // namespace compile_time } // namespace compile_time
/*************************************************************************
// core util
**************************************************************************/
// disable taking the address => force passing by reference (instead of pointer)
#define UPX_CXX_DISABLE_ADDRESS(Klass) \
private: \
Klass *operator&() const noexcept DELETED_FUNCTION;
// disable copy and move
#define UPX_CXX_DISABLE_COPY(KlassName) \
private: \
KlassName(const KlassName &) noexcept DELETED_FUNCTION; /* copy constructor */ \
KlassName &operator=(const KlassName &) noexcept DELETED_FUNCTION; /* copy assignment */
#define UPX_CXX_DISABLE_MOVE(KlassName) \
private: \
KlassName(KlassName &&) noexcept DELETED_FUNCTION; /* move constructor */ \
KlassName &operator=(KlassName &&) noexcept DELETED_FUNCTION; /* move assignment */
#define UPX_CXX_DISABLE_COPY_MOVE(KlassName) \
UPX_CXX_DISABLE_COPY(KlassName) \
UPX_CXX_DISABLE_MOVE(KlassName)
// fun with C++: disable common "new" and ALL "delete" operators
// https://en.cppreference.com/w/cpp/memory/new/operator_delete
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
private: \
/* common allocation functions (4) */ \
static void *operator new(std::size_t) DELETED_FUNCTION; \
static void *operator new[](std::size_t) DELETED_FUNCTION; \
static void *operator new(std::size_t, void *) DELETED_FUNCTION; \
static void *operator new[](std::size_t, void *) DELETED_FUNCTION; \
/* replaceable placement deallocation functions (4) */ \
static void operator delete(void *, const std::nothrow_t &) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, const std::nothrow_t &) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::align_val_t, const std::nothrow_t &) \
noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t, const std::nothrow_t &) \
noexcept DELETED_FUNCTION; \
/* non-allocating placement deallocation functions (2) */ \
static void operator delete(void *, void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, void *) noexcept DELETED_FUNCTION;
/* class-specific usual deallocation functions (8) */
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_A__(Klass) \
protected: \
static void operator delete(void *) noexcept {} \
static void operator delete(void *, std::align_val_t) noexcept {} \
static void operator delete(void *, std::size_t) noexcept {} \
static void operator delete(void *, std::size_t, std::align_val_t) noexcept {} \
private: \
static void operator delete[](void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION;
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_B__(Klass) \
private: \
static void operator delete(void *) noexcept DELETED_FUNCTION; \
static void operator delete[](void *) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t) noexcept DELETED_FUNCTION; \
static void operator delete(void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION; \
static void operator delete[](void *, std::size_t, std::align_val_t) noexcept DELETED_FUNCTION;
/* class-specific usual destroying deallocation functions (4) */
#if __cplusplus >= 202002L
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass) \
protected: \
static void operator delete(Klass *, std::destroying_delete_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::align_val_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t) noexcept {} \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t, std::align_val_t) \
noexcept {} \
private:
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass) \
private: \
static void operator delete(Klass *, std::destroying_delete_t) noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::align_val_t) \
noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t) \
noexcept DELETED_FUNCTION; \
static void operator delete(Klass *, std::destroying_delete_t, std::size_t, std::align_val_t) \
noexcept DELETED_FUNCTION;
#else
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass) private:
#define UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass) private:
#endif
// for classes which may have virtual methods
#define UPX_CXX_DISABLE_NEW_DELETE(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_A__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_A__(Klass)
// this only works for classes WITHOUT any virtual methods
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDF_B__(Klass) \
UPX_CXX_DISABLE_NEW_DELETE_IMPL_CSUDDF_B__(Klass)
#if defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION) // do not use std::align_val_t
#undef UPX_CXX_DISABLE_NEW_DELETE
#undef UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL
#define UPX_CXX_DISABLE_NEW_DELETE(Klass) private:
#define UPX_CXX_DISABLE_NEW_DELETE_NO_VIRTUAL(Klass) private:
#endif
class noncopyable {
protected:
forceinline constexpr noncopyable() noexcept {}
#if __cplusplus >= 202002L
forceinline constexpr ~noncopyable() noexcept = default;
#else
forceinline ~noncopyable() noexcept = default;
#endif
UPX_CXX_DISABLE_COPY_MOVE(noncopyable)
};
/*************************************************************************
// <type_traits>
**************************************************************************/
// is_bounded_array from C++20
template <class T>
struct is_bounded_array : public std::false_type {};
template <class T, std::size_t N>
struct is_bounded_array<T[N]> : public std::true_type {};
template <class T>
inline constexpr bool is_bounded_array_v = is_bounded_array<T>::value;
// is_same_all and is_same_any: std::is_same for multiple types
template <class T, class... Ts>
struct is_same_all : public std::conjunction<std::is_same<T, Ts>...> {};
template <class T, class... Ts>
struct is_same_any : public std::disjunction<std::is_same<T, Ts>...> {};
template <class T, class... Ts>
inline constexpr bool is_same_all_v = is_same_all<T, Ts...>::value;
template <class T, class... Ts>
inline constexpr bool is_same_any_v = is_same_any<T, Ts...>::value;
// remove_cvref from C++20
template <class T>
struct remove_cvref {
typedef typename std::remove_cv<typename std::remove_reference<T>::type>::type type;
};
template <class T>
using remove_cvref_t = typename remove_cvref<T>::type;
// type_identity from C++20
template <class T>
struct type_identity {
typedef T type;
};
template <class T>
using type_identity_t = typename type_identity<T>::type;
/*************************************************************************
// <bit> C++20
**************************************************************************/
template <class T>
forceinline constexpr bool has_single_bit(T x) noexcept {
return !(x == 0) && (x & (x - 1)) == 0;
}
/*************************************************************************
// <algorithm>
**************************************************************************/
template <class T>
inline constexpr T align_down(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
r = x - (x & (alignment - 1));
return r;
}
template <class T>
inline constexpr T align_down_gap(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
r = x & (alignment - 1);
return r;
}
template <class T>
inline constexpr T align_up(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
constexpr T zero = {};
r = x + ((zero - x) & (alignment - 1));
return r;
}
template <class T>
inline constexpr T align_up_gap(const T &x, const T &alignment) noexcept {
// assert_noexcept(has_single_bit(alignment)); // (not constexpr)
T r = {};
constexpr T zero = {};
r = (zero - x) & (alignment - 1);
return r;
}
template <class T>
forceinline constexpr T min(const T &a, const T &b) noexcept {
return b < a ? b : a;
}
template <class T>
forceinline constexpr T max(const T &a, const T &b) noexcept {
return a < b ? b : a;
}
template <class T>
inline constexpr bool is_uminmax_type = std::is_integral_v<T> && std::is_unsigned_v<T>;
template <class T, class = std::enable_if_t<is_uminmax_type<T>, T> >
forceinline constexpr T umin(const T &a, const T &b) noexcept {
return b < a ? b : a;
}
template <class T, class = std::enable_if_t<is_uminmax_type<T>, T> >
forceinline constexpr T umax(const T &a, const T &b) noexcept {
return a < b ? b : a;
}
template <class T>
forceinline constexpr T wrapping_add(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>);
typedef std::make_unsigned_t<T> U;
return T(U(a) + U(b));
}
template <class T>
forceinline constexpr T wrapping_sub(const T &a, const T &b) noexcept {
static_assert(std::is_integral_v<T>);
typedef std::make_unsigned_t<T> U;
return T(U(a) - U(b));
}
/*************************************************************************
// util
**************************************************************************/
template <std::size_t Size>
struct UnsignedSizeOf final {
static_assert(Size >= 1 && Size <= UPX_RSIZE_MAX_MEM);
static constexpr unsigned value = unsigned(Size);
};
// a static_cast that does not trigger -Wcast-align warnings
template <class Result, class From>
forceinline constexpr Result ptr_static_cast(From *ptr) noexcept {
static_assert(std::is_pointer_v<Result>);
// don't cast through "void *" if type is convertible
typedef std::conditional_t<std::is_convertible_v<decltype(ptr), Result>, Result, void *>
VoidPtr;
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
return static_cast<Result>(static_cast<VoidPtr>(ptr));
}
template <class Result, class From>
forceinline constexpr Result ptr_static_cast(const From *ptr) noexcept {
static_assert(std::is_pointer_v<Result>);
static_assert(std::is_const_v<std::remove_pointer_t<Result> >); // required
// don't cast through "const void *" if type is convertible
typedef std::conditional_t<std::is_convertible_v<decltype(ptr), Result>, Result, const void *>
VoidPtr;
// NOLINTNEXTLINE(bugprone-multi-level-implicit-pointer-conversion)
return static_cast<Result>(static_cast<VoidPtr>(ptr));
}
#if WITH_THREADS
// cast "T *" to "std::atomic<T> *"
template <class T>
forceinline std::atomic<T> *ptr_std_atomic_cast(T *ptr) noexcept {
// TODO later: make sure that this cast is indeed legal
std::atomic<T> *result = ptr_static_cast<std::atomic<T> *>(ptr);
static_assert(sizeof(*result) == sizeof(*ptr));
static_assert(alignof(decltype(*result)) == alignof(decltype(*ptr)));
return result;
}
#endif // WITH_THREADS
// atomic_exchange
template <class T>
forceinline T atomic_exchange(T *ptr, T new_value) noexcept {
#if 1
static_assert(sizeof(T) == sizeof(void *)); // UPX convention: restrict to pointer-size for now
#endif
static_assert(std::is_standard_layout_v<T>);
static_assert(std::is_trivially_copyable_v<T>);
#if !(WITH_THREADS)
T old_value = *ptr;
*ptr = new_value;
return old_value;
#else
static_assert(sizeof(T) <= sizeof(void *)); // UPX convention: restrict to fundamental types
static_assert(alignof(T) == sizeof(T)); // UPX convention: require proper alignment
#if __has_builtin(__atomic_exchange_n) && defined(__ATOMIC_SEQ_CST)
return __atomic_exchange_n(ptr, new_value, __ATOMIC_SEQ_CST);
#elif __has_builtin(__sync_swap)
return __sync_swap(ptr, new_value);
#else
return std::atomic_exchange(ptr_std_atomic_cast(ptr), new_value);
#endif
#endif
}
// helper classes so we don't leak memory on exceptions
template <class T>
struct ObjectDeleter final {
static_assert(std::is_nothrow_destructible_v<T>);
T **items; // public
std::size_t count; // public
explicit ObjectDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~ObjectDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
delete item; // single object delete
}
}
};
template <class T>
struct ArrayDeleter final {
static_assert(std::is_nothrow_destructible_v<T>);
T **items; // public
std::size_t count; // public
explicit ArrayDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~ArrayDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
delete[] item; // array delete
}
}
};
template <class T>
struct MallocDeleter final {
T **items; // public
std::size_t count; // public
explicit MallocDeleter(T **p, std::size_t n) noexcept : items(p), count(n) {}
~MallocDeleter() noexcept { delete_items(); }
void delete_items() noexcept {
for (std::size_t i = 0; i < count; i++) {
T *item = atomic_exchange(&items[i], (T *) nullptr);
::free(item); // free memory from malloc()
}
}
};
/************************************************************************* /*************************************************************************
// TriBool - tri-state bool // TriBool - tri-state bool
// an enum with an underlying type and 3 values // an enum with an underlying type and 3 values
+1
View File
@@ -237,6 +237,7 @@ private:
#endif #endif
}; };
static Stats stats; static Stats stats;
#if DEBUG #if DEBUG
// debugging aid // debugging aid
struct Debug { struct Debug {
+2 -2
View File
@@ -115,8 +115,8 @@
#if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_BIG_ENDIAN__ + 0 != 4321) #if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_BIG_ENDIAN__ + 0 != 4321)
#error "unexpected __ORDER_BIG_ENDIAN__" #error "unexpected __ORDER_BIG_ENDIAN__"
#endif #endif
#if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_LITTLE_ENDIAN__ + 0 != 1234) #if !defined(__ORDER_LITTLE_ENDIAN__) || (__ORDER_LITTLE_ENDIAN__ + 0 != 1234)
#error "unexpected __ORDER_BIG_ENDIAN__" #error "unexpected __ORDER_LITTLE_ENDIAN__"
#endif #endif
#if (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__) #if (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
#error "unexpected __BYTE_ORDER__" #error "unexpected __BYTE_ORDER__"
+1
View File
@@ -48,6 +48,7 @@
#undef i386 #undef i386
#undef large #undef large
#undef linux #undef linux
#undef mc68000
#undef mips #undef mips
#undef near #undef near
#undef powerpc #undef powerpc
+2
View File
@@ -225,6 +225,7 @@ XSPAN_NAMESPACE_END
#ifndef XSPAN_DELETED_FUNCTION #ifndef XSPAN_DELETED_FUNCTION
#define XSPAN_DELETED_FUNCTION = delete #define XSPAN_DELETED_FUNCTION = delete
#endif #endif
// function/method constraints // function/method constraints
#define XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION(From, To, RType) \ #define XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION(From, To, RType) \
typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < From, To>::value, RType > ::type typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < From, To>::value, RType > ::type
@@ -250,6 +251,7 @@ XSPAN_NAMESPACE_END
#include "xspan_impl_ptr_or_span.h" #include "xspan_impl_ptr_or_span.h"
#include "xspan_impl_span.h" #include "xspan_impl_span.h"
#include "xspan_impl_ptr.h" #include "xspan_impl_ptr.h"
#undef XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION #undef XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION
#undef XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION #undef XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION
#undef XSPAN_REQUIRES_CONVERTIBLE_A #undef XSPAN_REQUIRES_CONVERTIBLE_A
+5 -5
View File
@@ -1,7 +1,7 @@
#pragma once #pragma once
#define UPX_VERSION_HEX 0x050001 /* 05.00.01 */ #define UPX_VERSION_HEX 0x050003 /* 05.00.03 */
#define UPX_VERSION_STRING "5.0.1" #define UPX_VERSION_STRING "5.0.3"
#define UPX_VERSION_STRING4 "5.01" #define UPX_VERSION_STRING4 "5.03"
#define UPX_VERSION_DATE "May 6th 2025" #define UPX_VERSION_DATE "Jul 21st 2025"
#define UPX_VERSION_DATE_ISO "2025-05-06" #define UPX_VERSION_DATE_ISO "2025-07-21"
#define UPX_VERSION_YEAR "2025" #define UPX_VERSION_YEAR "2025"