diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c90e7be0..516e946a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,8 +23,7 @@ env: UPX_DEBUG_TEST_LIBC_QSORT: 1 ZSTD_CLEVEL: 17 # 2025-08-19 - #ZIG_DIST_VERSION: 0.15.1 - ZIG_DIST_VERSION: zig-0.16.0-dev.600+12ed0ff1e + ZIG_DIST_VERSION: 0.15.1 jobs: job-rebuild-and-verify-stubs: @@ -40,7 +39,7 @@ jobs: dpkg --add-architecture i386 apt-get update && apt-get upgrade -y # install system packages - apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base python-is-python3 tar time xz-utils libc6:i386 zlib1g:i386 + apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base python3-minimal tar time xz-utils libc6:i386 zlib1g:i386 mkdir ../deps; cd ../deps; mkdir packages ### install python2-minimal packages from Debian-11 ## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb @@ -412,12 +411,13 @@ jobs: fail-fast: false matrix: include: - - { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 } - - { 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-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 } - - { name: windows-11-arm-arm64, os: windows-11-arm, vsversion: 2022, vsarch: arm64 } - - { name: windows-11-arm-arm64ec, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64ec: true } + - { name: windows-11-arm64, os: windows-11-arm, vsversion: 2022, vsarch: arm64 } + - { name: windows-11-arm64ec, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64ec: true } + # { name: windows-11-arm64x, os: windows-11-arm, vsversion: 2022, vsarch: arm64, use_arm64x: true } + - { name: windows-2022-amd64, os: windows-2022, vsversion: 2022, vsarch: amd64 } + - { 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-i386, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 } name: ${{ format('{0}', matrix.name) }} runs-on: ${{ matrix.os }} steps: @@ -435,11 +435,16 @@ jobs: 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.use_arm64x }}" == "true" ]]; then true; + echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A ARM64X" >> $GITHUB_ENV + echo "UPX_CONFIG_DISABLE_SELF_PACK_TEST=ON" >> $GITHUB_ENV elif [[ "${{ matrix.vsarch }}" == *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; + elif [[ "${{ matrix.vsarch }}" == *x86 ]]; then true; echo "UPX_CMAKE_CONFIG_FLAGS_PLATFORM=-A Win32" >> $GITHUB_ENV + else + exit 1 fi - run: make build/debug - run: make build/release @@ -484,15 +489,12 @@ jobs: fail-fast: false matrix: include: - # { name: amd64-win64-vs2019, os: windows-2019, vsversion: 2019, 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-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: 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-vs2022, os: windows-2022, vsversion: 2022, vsarch: amd64_x86 } - name: ${{ format('windows {0}', matrix.name) }} + - { name: amd64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64 } + - { name: arm64-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64 } + - { name: arm64ec-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64ec' } + # { name: arm64x-win64-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_arm64, cl_machine_flags: -arm64EC, link_machine_flags: '/machine:arm64x' } + - { name: i386-win32-vs2025, os: windows-2025, vsversion: 2022, vsarch: amd64_x86 } + name: ${{ format('windows-bh {0}', matrix.name) }} runs-on: ${{ matrix.os }} env: C: ${{ matrix.name }} @@ -553,10 +555,11 @@ jobs: - run: shopt -s globstar; file build/**/upx* || true - name: Make artifact 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-bh-${{ matrix.name }}" | sed 's/[^0-9a-zA-Z_.-]/-/g') mkdir -p "tmp/artifact/$N/$B" cp -ai build/$C/$B/upx/upx*.exe "tmp/artifact/$N/$B" - (cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") + #(cd tmp/artifact && tar --sort=name --zstd -cf "$N.tar.zst" "$N" && rm -rf "./$N" && ls -la && zstd -tq "$N.tar.zst") + (cd tmp/artifact && tar --sort=name --gzip -cf "$N.tar.gz" "$N" && rm -rf "./$N" && ls -la && gzip -tq "$N.tar.gz") echo "artifact_name=$N" >> $GITHUB_ENV - name: ${{ format('Upload artifact {0}', env.artifact_name) }} uses: actions/upload-artifact@v4 @@ -652,9 +655,9 @@ jobs: ZIG_DIST_VERSION=${ZIG_DIST_VERSION/#zig-/} 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.1/${ZIG_DIST_NAME}.tar.xz - #curl -sS -L -O https://ziglang.org/download/0.15.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 file ${ZIG_DIST_NAME}.tar.xz || true tar -xoJf ${ZIG_DIST_NAME}.tar.xz diff --git a/src/compress/compress_ucl.cpp b/src/compress/compress_ucl.cpp index bb92756c..93d8eee6 100644 --- a/src/compress/compress_ucl.cpp +++ b/src/compress/compress_ucl.cpp @@ -248,8 +248,9 @@ static void __UCL_CDECL my_free(ucl_voidp p) { free(p); } } // extern "C" int upx_ucl_init(void) { -#if (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940) - (void) ucl_init(); // TODO later +#if 1 && (ACC_CC_MSC && ACC_ARCH_I386) && (_MSC_VER >= 1940) + // @COMPILER_BUG @MSVC_BUG + (void) ucl_init(); #else if (ucl_init() != UCL_E_OK) return -1; diff --git a/src/stub/Makefile b/src/stub/Makefile index ac01b70f..69847a11 100644 --- a/src/stub/Makefile +++ b/src/stub/Makefile @@ -207,6 +207,8 @@ tc_objdump_disasm_options = ECHO_e = /bin/echo -e ECHO_E = /bin/echo -E PERL = perl +PYTHON2 = python2 +PYTHON3 = python3 UNIX2DOS := $(PERL) -i -pe 's/$$/\r/;' # trim (strip) trailing whitespace @@ -239,15 +241,15 @@ define tc endef # default tools -tc.default.bin2h = python $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub +tc.default.bin2h = $(PYTHON3) $(top_srcdir)/src/stub/scripts/bin2h.py --ident=auto-stub ##tc.default.bin2h-c = $(call tc,bin2h) --compress=14,15,0 tc.default.bin2h-c = $(call tc,bin2h) --compress=0 -tc.default.brandelf = python $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname)) -tc.default.gpp_inc = python $(top_srcdir)/src/stub/scripts/gpp_inc.py -tc.default.gpp_mkdep = python $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null +tc.default.brandelf = $(PYTHON3) $(top_srcdir)/src/stub/scripts/brandelf.py $(if $(tc_bfdname),--bfdname=$(tc_bfdname)) +tc.default.gpp_inc = $(PYTHON3) $(top_srcdir)/src/stub/scripts/gpp_inc.py +tc.default.gpp_mkdep = $(PYTHON3) $(top_srcdir)/src/stub/scripts/gpp_inc.py -o /dev/null tc.default.pp-as = i386-linux-gcc-3.4.6 -E -nostdinc -x assembler-with-cpp -Wall tc.default.sstrip = sstrip-20060518 -tc.default.xstrip = python $(top_srcdir)/src/stub/scripts/xstrip.py +tc.default.xstrip = $(PYTHON3) $(top_srcdir)/src/stub/scripts/xstrip.py # default multiarch-binutils tc.default.m-ar = multiarch-ar-2.17 diff --git a/src/stub/scripts/bin2h.py b/src/stub/scripts/bin2h.py index df9b568c..d8b12219 100644 --- a/src/stub/scripts/bin2h.py +++ b/src/stub/scripts/bin2h.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # bin2h.py -- diff --git a/src/stub/scripts/brandelf.py b/src/stub/scripts/brandelf.py index 78000892..32f2aaa3 100644 --- a/src/stub/scripts/brandelf.py +++ b/src/stub/scripts/brandelf.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # brandelf.py -- diff --git a/src/stub/scripts/gpp_inc.py b/src/stub/scripts/gpp_inc.py index 514b00d2..28058fa4 100644 --- a/src/stub/scripts/gpp_inc.py +++ b/src/stub/scripts/gpp_inc.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # gpp_inc.py -- Generic PreProcessor: include diff --git a/src/stub/scripts/xstrip.py b/src/stub/scripts/xstrip.py index ba25f40a..72dbea5a 100644 --- a/src/stub/scripts/xstrip.py +++ b/src/stub/scripts/xstrip.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # xstrip.py -- truncate ELF objects created by multiarch-objcopy-2.17 diff --git a/src/stub/src/arch/i086/Makefile.extra b/src/stub/src/arch/i086/Makefile.extra index 5e1f7e9b..5dab7ca4 100644 --- a/src/stub/src/arch/i086/Makefile.extra +++ b/src/stub/src/arch/i086/Makefile.extra @@ -198,7 +198,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),) # step 3: clean asm lzma_d_c%.S : tmp/lzma_d_c%.i cleanasm.py $(MAKEFILE_LIST) - $(PYTHON) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@ + $(PYTHON2) cleanasm.py --label-prefix=$(LABEL_PREFIX) $< $@ # step 2: compile, strip and disasm tmp/lzma_d_c%.i : tmp/lzma_d_c%.S $(MAKEFILE_LIST) @@ -233,7 +233,7 @@ ifneq ($(wildcard $(WATCOM)/binl/wcl),) $(call tc,wdis) tmp/$T_wc.obj | $(RTRIM) > tmp/$T_wc.obj.disasm endif # convert - $(PYTHON) wdis2gas.py tmp/$T_wc.obj.disasm $@ + $(PYTHON2) wdis2gas.py tmp/$T_wc.obj.disasm $@ .PRECIOUS: tmp/lzma_d_c%.i tmp/lzma_d_c%.S diff --git a/src/stub/src/arch/i086/cleanasm.py b/src/stub/src/arch/i086/cleanasm.py index f5a830c9..bfb11261 100644 --- a/src/stub/src/arch/i086/cleanasm.py +++ b/src/stub/src/arch/i086/cleanasm.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python2 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # cleanasm.py -- @@ -99,11 +99,11 @@ def main(argv): k, v = m.group(1).strip(), [0, 0, None, 0] assert k and v, (inst, args) v[2] = k # new name - if k in labels: + if labels.has_key(k): assert labels[k][:2] == v[:2] return k, v def add_label(k, v): - if k in labels: + if labels.has_key(k): assert labels[k][:2] == v[:2] else: labels[k] = v @@ -135,7 +135,7 @@ def main(argv): pos += sgn(mlen) if mlen < 0: mpos.reverse() - if debug and 1: print (mlen, m, [olines[x] for x in mpos]) + if debug and 1: print mlen, m, [olines[x] for x in mpos] dpos = [] i = -abs(mlen) while i < 0: @@ -404,7 +404,7 @@ def main(argv): assert len(r) == len(dpos) pos = pos0 for inst, args in r: - ##print (pos-pos0, inst, args) + ##print pos-pos0, inst, args olines[pos][1] = inst olines[pos][2] = args pos += 1 @@ -438,7 +438,7 @@ def main(argv): if v[:2] == [1, 2]: # external 2-byte x = inline_map.get(v[2]) if x and v[3] <= x[1]: # max. number of calls - ##print ("inline", v, x) + ##print "inline", v, x if x: olines[i][1] = x[0] olines[i][2] = "/* inlined */" @@ -449,7 +449,7 @@ def main(argv): ofp = open(ofile, "wb") current_label = None for label, inst, args, args_label in olines: - if label in labels: + if labels.has_key(label): current_label = labels[label][2] if opts.verbose: ofp.write("%s: /* %d */\n" % (labels[label][2], labels[label][3])) @@ -478,7 +478,7 @@ def main(argv): l = "%8s%-7s %s" % ("", inst, args) ofp.write(l.rstrip() + "\n") ofp.close() - ##print (olines) + ##print olines if __name__ == "__main__": diff --git a/src/stub/src/arch/i086/wdis2gas.py b/src/stub/src/arch/i086/wdis2gas.py index aa857ec5..973fcbf5 100644 --- a/src/stub/src/arch/i086/wdis2gas.py +++ b/src/stub/src/arch/i086/wdis2gas.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python2 ## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*- # # wdis2gas.py -- @@ -138,7 +138,7 @@ def main(argv): for l in olines: ofp.write(l.rstrip() + "\n") ofp.close() - ##print (olines) + ##print olines if __name__ == "__main__":