mirror of
https://github.com/upx/upx
synced 2025-10-05 19:20:23 +08:00
CI updates
This commit is contained in:
parent
2cf1c32d18
commit
decc1efb74
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -116,7 +116,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
@ -203,7 +203,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
@ -271,7 +271,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
@ -373,7 +373,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
@ -505,7 +505,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
4
.github/workflows/test-alpine-linux.yml
vendored
4
.github/workflows/test-alpine-linux.yml
vendored
|
@ -34,7 +34,7 @@ jobs:
|
|||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: missing nodejs on host
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: 'upx*/build/*/upx'
|
||||
|
@ -61,7 +61,7 @@ jobs:
|
|||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: missing nodejs on host
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: 'upx*/build/*/upx'
|
||||
|
|
|
@ -41,7 +41,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -82,7 +82,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -81,7 +81,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -68,7 +68,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -160,7 +160,7 @@ jobs:
|
|||
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: missing nodejs on host
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: 'upx with space*/build/*/*/*/upx'
|
||||
|
|
|
@ -86,7 +86,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -85,7 +85,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
2
.github/workflows/weekly-ci-cc-zigcc.yml
vendored
2
.github/workflows/weekly-ci-cc-zigcc.yml
vendored
|
@ -120,7 +120,7 @@ jobs:
|
|||
# GitHub Actions magic: set "artifact_name" environment value for use in next step
|
||||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
2
.github/workflows/weekly-ci-rt-checkers.yml
vendored
2
.github/workflows/weekly-ci-rt-checkers.yml
vendored
|
@ -72,7 +72,7 @@ jobs:
|
|||
echo "artifact_name=$N" >> $GITHUB_ENV
|
||||
- name: ${{ format('Upload artifact {0}', env.artifact_name) }}
|
||||
if: ${{ !startsWith(matrix.container, 'i386/') }} # i386: missing nodejs on host
|
||||
uses: actions/upload-artifact@v3
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ env.artifact_name }}
|
||||
path: tmp/artifact
|
||||
|
|
|
@ -120,7 +120,7 @@ build/extra/gcc-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD=ON
|
|||
build/extra/gcc-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||
build/extra/gcc-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||
build/extra/gcc-std-cxx23/%: export CC = gcc -std=gnu2x
|
||||
build/extra/gcc-std-cxx23/%: export CXX = g++ -std=gnu++23
|
||||
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_CXX_STANDARD=ON
|
||||
|
||||
|
@ -221,8 +221,8 @@ ifneq ($(CXX),)
|
|||
UPX_XTARGET := $(UPX_XTARGET)
|
||||
build/xtarget/$(UPX_XTARGET)/debug: PHONY; $(call run_config_and_build,$@,Debug)
|
||||
build/xtarget/$(UPX_XTARGET)/release: PHONY; $(call run_config_and_build,$@,Release)
|
||||
build/xtarget/$(UPX_XTARGET)/%: export CC
|
||||
build/xtarget/$(UPX_XTARGET)/%: export CXX
|
||||
build/xtarget/$(UPX_XTARGET)/%: export CC := $(CC)
|
||||
build/xtarget/$(UPX_XTARGET)/%: export CXX := $(CXX)
|
||||
# shortcuts
|
||||
xtarget/all: xtarget/debug xtarget/release
|
||||
xtarget/debug: build/xtarget/$(UPX_XTARGET)/debug
|
||||
|
@ -246,12 +246,22 @@ __add_cmake_config = $(and $($1),-D$1="$($1)")
|
|||
# pass common CMake settings from environment/make to cmake
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_VERBOSE_MAKEFILE)
|
||||
# pass common CMake toolchain settings from environment/make to cmake
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_ADDR2LINE)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_AR)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_DLLTOOL)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_LINKER)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_NM)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJCOPY)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_OBJDUMP)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_RANLIB)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_READELF)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_STRIP)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_TAPI)
|
||||
# pass common CMake LTO toolchain settings from environment/make to cmake (for use with "-flto")
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_AR)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_C_COMPILER_RANLIB)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_AR)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CXX_COMPILER_RANLIB)
|
||||
# pass common CMake cross compilation settings from environment/make to cmake
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_SYSTEM_NAME)
|
||||
build/%: UPX_CMAKE_CONFIG_FLAGS += $(call __add_cmake_config,CMAKE_CROSSCOMPILING_EMULATOR)
|
||||
|
|
114
src/packmast.cpp
114
src/packmast.cpp
|
@ -136,7 +136,7 @@ static noinline tribool try_can_unpack(PackerBase *pb, void *user) may_throw {
|
|||
/*static*/
|
||||
PackerBase *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const Options *o,
|
||||
void *user) may_throw {
|
||||
#define D(Klass) \
|
||||
#define VISIT(Klass) \
|
||||
do { \
|
||||
static_assert(std::is_class_v<Klass>); \
|
||||
static_assert(std::is_nothrow_destructible_v<Klass>); \
|
||||
|
@ -159,91 +159,91 @@ PackerBase *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const O
|
|||
//
|
||||
if (!o->dos_exe.force_stub) {
|
||||
// dos32
|
||||
D(PackDjgpp2);
|
||||
D(PackTmt);
|
||||
D(PackWcle);
|
||||
VISIT(PackDjgpp2);
|
||||
VISIT(PackTmt);
|
||||
VISIT(PackWcle);
|
||||
// Windows
|
||||
// D(PackW64PeArm64EC); // NOT YET IMPLEMENTED
|
||||
// D(PackW64PeArm64); // NOT YET IMPLEMENTED
|
||||
D(PackW64PeAmd64);
|
||||
D(PackW32PeI386);
|
||||
D(PackWinCeArm);
|
||||
// VISIT(PackW64PeArm64EC); // NOT YET IMPLEMENTED
|
||||
// VISIT(PackW64PeArm64); // NOT YET IMPLEMENTED
|
||||
VISIT(PackW64PeAmd64);
|
||||
VISIT(PackW32PeI386);
|
||||
VISIT(PackWinCeArm);
|
||||
}
|
||||
D(PackExe); // dos/exe
|
||||
VISIT(PackExe); // dos/exe
|
||||
|
||||
//
|
||||
// linux kernel
|
||||
//
|
||||
D(PackVmlinuxARMEL);
|
||||
D(PackVmlinuxARMEB);
|
||||
D(PackVmlinuxPPC32);
|
||||
D(PackVmlinuxPPC64LE);
|
||||
D(PackVmlinuxAMD64);
|
||||
D(PackVmlinuxI386);
|
||||
D(PackVmlinuzI386);
|
||||
D(PackBvmlinuzI386);
|
||||
D(PackVmlinuzARMEL);
|
||||
VISIT(PackVmlinuxARMEL);
|
||||
VISIT(PackVmlinuxARMEB);
|
||||
VISIT(PackVmlinuxPPC32);
|
||||
VISIT(PackVmlinuxPPC64LE);
|
||||
VISIT(PackVmlinuxAMD64);
|
||||
VISIT(PackVmlinuxI386);
|
||||
VISIT(PackVmlinuzI386);
|
||||
VISIT(PackBvmlinuzI386);
|
||||
VISIT(PackVmlinuzARMEL);
|
||||
|
||||
//
|
||||
// linux
|
||||
//
|
||||
if (!o->o_unix.force_execve) {
|
||||
if (o->o_unix.use_ptinterp) {
|
||||
D(PackLinuxElf32x86interp);
|
||||
VISIT(PackLinuxElf32x86interp);
|
||||
}
|
||||
D(PackFreeBSDElf32x86);
|
||||
D(PackNetBSDElf32x86);
|
||||
D(PackOpenBSDElf32x86);
|
||||
D(PackLinuxElf32x86);
|
||||
D(PackLinuxElf64amd);
|
||||
D(PackLinuxElf32armLe);
|
||||
D(PackLinuxElf32armBe);
|
||||
D(PackLinuxElf64arm);
|
||||
D(PackLinuxElf32ppc);
|
||||
D(PackLinuxElf64ppc);
|
||||
D(PackLinuxElf64ppcle);
|
||||
D(PackLinuxElf32mipsel);
|
||||
D(PackLinuxElf32mipseb);
|
||||
D(PackLinuxI386sh);
|
||||
VISIT(PackFreeBSDElf32x86);
|
||||
VISIT(PackNetBSDElf32x86);
|
||||
VISIT(PackOpenBSDElf32x86);
|
||||
VISIT(PackLinuxElf32x86);
|
||||
VISIT(PackLinuxElf64amd);
|
||||
VISIT(PackLinuxElf32armLe);
|
||||
VISIT(PackLinuxElf32armBe);
|
||||
VISIT(PackLinuxElf64arm);
|
||||
VISIT(PackLinuxElf32ppc);
|
||||
VISIT(PackLinuxElf64ppc);
|
||||
VISIT(PackLinuxElf64ppcle);
|
||||
VISIT(PackLinuxElf32mipsel);
|
||||
VISIT(PackLinuxElf32mipseb);
|
||||
VISIT(PackLinuxI386sh);
|
||||
}
|
||||
D(PackBSDI386);
|
||||
D(PackMachFat); // cafebabe conflict
|
||||
D(PackLinuxI386); // cafebabe conflict
|
||||
VISIT(PackBSDI386);
|
||||
VISIT(PackMachFat); // cafebabe conflict
|
||||
VISIT(PackLinuxI386); // cafebabe conflict
|
||||
|
||||
// Mach (Darwin / macOS)
|
||||
D(PackDylibAMD64);
|
||||
D(PackMachPPC32); // TODO: this works with upx 3.91..3.94 but got broken in 3.95; FIXME
|
||||
D(PackMachI386);
|
||||
D(PackMachAMD64);
|
||||
D(PackMachARMEL);
|
||||
D(PackMachARM64EL);
|
||||
VISIT(PackDylibAMD64);
|
||||
VISIT(PackMachPPC32); // TODO: this works with upx 3.91..3.94 but got broken in 3.95; FIXME
|
||||
VISIT(PackMachI386);
|
||||
VISIT(PackMachAMD64);
|
||||
VISIT(PackMachARMEL);
|
||||
VISIT(PackMachARM64EL);
|
||||
|
||||
// 2010-03-12 omit these because PackMachBase<T>::pack4dylib (p_mach.cpp)
|
||||
// does not understand what the Darwin (Apple Mac OS X) dynamic loader
|
||||
// assumes about .dylib file structure.
|
||||
// D(PackDylibI386);
|
||||
// D(PackDylibPPC32);
|
||||
// VISIT(PackDylibI386);
|
||||
// VISIT(PackDylibPPC32);
|
||||
|
||||
//
|
||||
// misc
|
||||
//
|
||||
D(PackTos); // atari/tos
|
||||
D(PackPs1); // ps1/exe
|
||||
D(PackSys); // dos/sys
|
||||
D(PackCom); // dos/com
|
||||
VISIT(PackTos); // atari/tos
|
||||
VISIT(PackPs1); // ps1/exe
|
||||
VISIT(PackSys); // dos/sys
|
||||
VISIT(PackCom); // dos/com
|
||||
|
||||
return nullptr;
|
||||
#undef D
|
||||
#undef VISIT
|
||||
}
|
||||
|
||||
/*static*/ PackerBase *PackMaster::getPacker(InputFile *f) {
|
||||
/*static*/ PackerBase *PackMaster::getPacker(InputFile *f) may_throw {
|
||||
PackerBase *pb = visitAllPackers(try_can_pack, f, opt, f);
|
||||
if (!pb)
|
||||
throwUnknownExecutableFormat();
|
||||
return pb;
|
||||
}
|
||||
|
||||
/*static*/ PackerBase *PackMaster::getUnpacker(InputFile *f) {
|
||||
/*static*/ PackerBase *PackMaster::getUnpacker(InputFile *f) may_throw {
|
||||
PackerBase *pb = visitAllPackers(try_can_unpack, f, opt, f);
|
||||
if (!pb)
|
||||
throwNotPacked();
|
||||
|
@ -254,31 +254,31 @@ PackerBase *PackMaster::visitAllPackers(visit_func_t func, InputFile *f, const O
|
|||
// delegation from work.cpp
|
||||
**************************************************************************/
|
||||
|
||||
void PackMaster::pack(OutputFile *fo) {
|
||||
void PackMaster::pack(OutputFile *fo) may_throw {
|
||||
assert(packer == nullptr);
|
||||
packer = getPacker(fi);
|
||||
packer->doPack(fo);
|
||||
}
|
||||
|
||||
void PackMaster::unpack(OutputFile *fo) {
|
||||
void PackMaster::unpack(OutputFile *fo) may_throw {
|
||||
assert(packer == nullptr);
|
||||
packer = getUnpacker(fi);
|
||||
packer->doUnpack(fo);
|
||||
}
|
||||
|
||||
void PackMaster::test() {
|
||||
void PackMaster::test() may_throw {
|
||||
assert(packer == nullptr);
|
||||
packer = getUnpacker(fi);
|
||||
packer->doTest();
|
||||
}
|
||||
|
||||
void PackMaster::list() {
|
||||
void PackMaster::list() may_throw {
|
||||
assert(packer == nullptr);
|
||||
packer = getUnpacker(fi);
|
||||
packer->doList();
|
||||
}
|
||||
|
||||
void PackMaster::fileInfo() {
|
||||
void PackMaster::fileInfo() may_throw {
|
||||
assert(packer == nullptr);
|
||||
packer = visitAllPackers(try_can_unpack, fi, opt, fi);
|
||||
if (!packer)
|
||||
|
|
|
@ -47,16 +47,15 @@ public:
|
|||
void fileInfo() may_throw;
|
||||
|
||||
typedef tribool (*visit_func_t)(PackerBase *pb, void *user);
|
||||
static PackerBase *visitAllPackers(visit_func_t, InputFile *f, const Options *, void *user)
|
||||
may_throw;
|
||||
static noinline PackerBase *visitAllPackers(visit_func_t, InputFile *f, const Options *,
|
||||
void *user) may_throw;
|
||||
|
||||
private:
|
||||
OwningPointer(PackerBase) packer = nullptr; // owner
|
||||
InputFile *const fi; // reference, required
|
||||
|
||||
static PackerBase *getPacker(InputFile *f) may_throw;
|
||||
static PackerBase *getUnpacker(InputFile *f) may_throw;
|
||||
|
||||
OwningPointer(PackerBase) packer = nullptr; // owner
|
||||
InputFile *const fi; // reference, required
|
||||
// setup local options for each file
|
||||
Options local_options;
|
||||
Options *saved_opt = nullptr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user