mirror of
https://github.com/upx/upx.git
synced 2025-08-11 22:52:30 +08:00
all: cleanups
This commit is contained in:
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
@ -1,5 +1,4 @@
|
||||
# Support for GitHub Actions -- https://github.com/features/actions
|
||||
# Copyright (C) Markus Franz Xaver Johannes Oberhumer
|
||||
|
||||
# note: GitHub Actions runner images are frequently updated, and
|
||||
# unfortunately this sometimes breaks builds in mysterious ways...
|
||||
@ -7,17 +6,10 @@
|
||||
|
||||
name: 'CI'
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '*'
|
||||
- '!appveyor*'
|
||||
- '!gitea*'
|
||||
- '!gitlab*'
|
||||
- '!travis*'
|
||||
workflow_dispatch:
|
||||
on: [push, workflow_dispatch]
|
||||
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
UPX_CMAKE_BUILD_FLAGS: --verbose
|
||||
|
||||
jobs:
|
||||
@ -30,7 +22,6 @@ jobs:
|
||||
uname -a; pwd; id; umask
|
||||
mkdir ../deps; cd ../deps; mkdir packages
|
||||
# for ubuntu-22.04: install python2-minimal
|
||||
##export DEBIAN_FRONTEND=noninteractive
|
||||
##sudo apt-get update && sudo apt-get install -y --no-install-recommends python2-minimal
|
||||
# manually install compat libs from Ubuntu 16.04
|
||||
wget -q 'http://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb'
|
||||
@ -69,7 +60,6 @@ jobs:
|
||||
- name: 'Install extra 32-bit packages'
|
||||
if: ${{ matrix.use_m32 }}
|
||||
run: |
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
sudo dpkg --add-architecture i386
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-multilib g++-multilib
|
||||
@ -143,17 +133,18 @@ jobs:
|
||||
uses: actions/checkout@v3
|
||||
with: { submodules: true }
|
||||
- name: 'Check out test suite'
|
||||
if: ${{ matrix.testsuite }}
|
||||
run: 'git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite'
|
||||
- name: 'Build cmake extra/clang/debug'
|
||||
run: 'make build/extra/clang/debug'
|
||||
- name: 'Build cmake extra/clang/release'
|
||||
run: 'make build/extra/clang/release'
|
||||
- name: 'Build cmake extra/gcc/debug'
|
||||
if: ${{ matrix.gcc != '' }}
|
||||
run: 'make build/extra/gcc/debug CC=${{ matrix.gcc }} CXX=${{ matrix.gxx }}'
|
||||
- name: 'Build cmake extra/gcc/release'
|
||||
if: ${{ matrix.gcc != '' }}
|
||||
run: 'make build/extra/gcc/release CC=${{ matrix.gcc }} CXX=${{ matrix.gxx }}'
|
||||
- name: 'Build cmake extra/clang/debug'
|
||||
run: 'make build/extra/clang/debug'
|
||||
- name: 'Build cmake extra/clang/release'
|
||||
run: 'make build/extra/clang/release'
|
||||
- name: 'Make artifact'
|
||||
run: |
|
||||
N=upx-${GITHUB_REF_NAME}-${GITHUB_SHA:0:7}-${{ matrix.os }}
|
||||
@ -187,8 +178,8 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# windows-2019 used to work but got broken with the 20220821.1
|
||||
# runner-image update; disable for now
|
||||
# windows-2019 used to work but got broken with the 20220821.1 runner-image update;
|
||||
# as you cannot download that image this is painful to debug; disable for now
|
||||
# see https://github.com/actions/runner-images.git
|
||||
####- { os: windows-2019 }
|
||||
- { os: windows-2022 }
|
||||
@ -199,7 +190,7 @@ jobs:
|
||||
- name: 'Check out test suite'
|
||||
run: 'git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite'
|
||||
- name: 'Inspect runner-image settings'
|
||||
# see https://github.com/actions/runner-images.git
|
||||
# debug remote image; also see https://github.com/actions/runner-images.git
|
||||
if: ${{ false }}
|
||||
run: |
|
||||
Get-Command bash; Get-Command cmake; Get-Command make
|
||||
@ -294,7 +285,7 @@ jobs:
|
||||
cat .GITREV.txt
|
||||
set /p GITREV=<.GITREV.txt
|
||||
set sources=%s%\*.cpp %s%\check\*.cpp %s%\compress\*.cpp %s%\console\*.cpp %s%\filter\*.cpp %s%\util\*.cpp
|
||||
cl -std:c++17 -Zc:__cplusplus -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" -DWITH_ZSTD=0 %DEFS% -I%H%\vendor -I%H%\vendor\boost-pfr\include -Feupx.exe %sources% %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
|
||||
cl -MT -std:c++17 -Zc:__cplusplus -EHsc -J -O2 -W4 -WX -DUPX_VERSION_GITREV="""%GITREV%""" -DWITH_ZSTD=0 %DEFS% -I%H%\vendor -I%H%\vendor\boost-pfr\include -Feupx.exe %sources% %BDIR%\ucl\ucl.lib %BDIR%\zlib\zlib.lib /link setargv.obj
|
||||
- name: 'Make artifact'
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -100,8 +100,7 @@ endif()
|
||||
# targets and compilation flags
|
||||
#***********************************************************************
|
||||
|
||||
#find_package(Threads)
|
||||
|
||||
#find_package(Threads) # multithreading is currently not used; maybe in UPX version 5
|
||||
set(UPX_CONFIG_DISABLE_ZSTD ON) # zstd is currently not used; maybe in UPX version 5
|
||||
|
||||
file(GLOB ucl_SOURCES "vendor/ucl/src/*.c")
|
||||
@ -150,6 +149,8 @@ if(MSVC)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_WARNINGS)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||
# set __cplusplus according to selected C++ standard
|
||||
add_definitions(-Zc:__cplusplus)
|
||||
else()
|
||||
# protect against security threats caused by misguided compiler "optimizations"
|
||||
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
|
||||
@ -190,7 +191,7 @@ upx_sanitize_target(${t})
|
||||
if(MSVC)
|
||||
target_compile_options(${t} PRIVATE -J -W4 ${warn_WX})
|
||||
else()
|
||||
target_compile_options(${t} PRIVATE -Wall -Wextra -Wvla ${warn_Werror})
|
||||
target_compile_options(${t} PRIVATE -Wall -Wextra -Wcast-align -Wcast-qual -Wpointer-arith -Wvla -Wwrite-strings ${warn_Werror})
|
||||
endif()
|
||||
|
||||
set(t upx_vendor_zlib)
|
||||
@ -228,7 +229,7 @@ endif()
|
||||
#upx_compile_target_debug_with_O2(${t})
|
||||
upx_sanitize_target(${t})
|
||||
if(MSVC)
|
||||
target_compile_options(${t} PRIVATE -Zc:__cplusplus -EHsc -J -W4 ${warn_WX})
|
||||
target_compile_options(${t} PRIVATE -EHsc -J -W4 ${warn_WX})
|
||||
else()
|
||||
target_compile_options(${t} PRIVATE
|
||||
-Wall -Wextra -Wcast-align -Wcast-qual -Wmissing-declarations -Wpointer-arith
|
||||
|
2
THANKS
2
THANKS
@ -55,6 +55,6 @@ Salvador Eduardo Tropea
|
||||
for beta testing
|
||||
Stefan Widmann
|
||||
for the win32/pe TLS callback support
|
||||
The WINE project (http://www.winehq.com/)
|
||||
The WINE project (https://www.winehq.com/)
|
||||
for lots of useful information found in their PE loader sources
|
||||
Natascha
|
||||
|
@ -44,7 +44,7 @@ RUN apt-get install -y \
|
||||
gdb lsb-release valgrind \
|
||||
&& true
|
||||
RUN cd /usr/bin \
|
||||
# create unversioned clang symlinks
|
||||
# create unversioned clang symlinks in /usr/local/bin
|
||||
&& for f in clang*-14 llvm-*-14 scan-*-14; do ln -s -v ../../bin/$f /usr/local/bin/${f%-14}; done \
|
||||
&& ln -s -v ../../bin/obj2yaml-14 /usr/local/bin/llvm-obj2yaml \
|
||||
&& ln -s -v ../../bin/yaml2obj-14 /usr/local/bin/llvm-yaml2obj \
|
||||
|
@ -122,6 +122,18 @@ ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_gt("abc", "abz"))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(!compile_time::string_ge("abc", "abz"))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(compile_time::string_le("abc", "abz"))
|
||||
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_BIT == 8)
|
||||
#if '\0' - 1 < 0
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 127)
|
||||
#else
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(CHAR_MAX == 255)
|
||||
#endif
|
||||
#if L'\0' - 1 < 0
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((wchar_t) -1 < 0)
|
||||
#else
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((wchar_t) -1 > 0)
|
||||
#endif
|
||||
|
||||
/*************************************************************************
|
||||
// upx_compiler_sanity_check()
|
||||
// assert a sane architecture and compiler
|
||||
@ -133,9 +145,8 @@ template <class T>
|
||||
struct TestBELE {
|
||||
__acc_static_noinline bool test(void) {
|
||||
// POD checks
|
||||
// COMPILE_TIME_ASSERT(std::is_pod<T>::value); // deprecated in C++20
|
||||
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value);
|
||||
COMPILE_TIME_ASSERT(std::is_trivial<T>::value);
|
||||
COMPILE_TIME_ASSERT(std::is_standard_layout<T>::value)
|
||||
COMPILE_TIME_ASSERT(std::is_trivial<T>::value)
|
||||
// alignment checks
|
||||
{
|
||||
COMPILE_TIME_ASSERT_ALIGNED1(T)
|
||||
|
@ -43,10 +43,10 @@ enum {
|
||||
CMD_FILEINFO,
|
||||
CMD_HELP,
|
||||
CMD_LICENSE,
|
||||
CMD_VERSION
|
||||
CMD_VERSION,
|
||||
};
|
||||
|
||||
struct options_t {
|
||||
struct options_t final {
|
||||
int cmd;
|
||||
|
||||
// compression options
|
||||
|
@ -252,7 +252,7 @@ Packer *PackMaster::getUnpacker(InputFile *f) {
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
// delegation
|
||||
// delegation from work.cpp
|
||||
**************************************************************************/
|
||||
|
||||
void PackMaster::pack(OutputFile *fo) {
|
||||
|
@ -25,8 +25,9 @@
|
||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef __UPX_PACKMASTER_H
|
||||
#define __UPX_PACKMASTER_H 1
|
||||
#pragma once
|
||||
#ifndef UPX_PACKMASTER_H__
|
||||
#define UPX_PACKMASTER_H__ 1
|
||||
|
||||
class Packer;
|
||||
class InputFile;
|
||||
@ -36,10 +37,10 @@ class OutputFile;
|
||||
// interface for work.cpp
|
||||
**************************************************************************/
|
||||
|
||||
class PackMaster {
|
||||
class PackMaster final {
|
||||
public:
|
||||
PackMaster(InputFile *f, options_t *o = nullptr);
|
||||
virtual ~PackMaster();
|
||||
~PackMaster();
|
||||
|
||||
void pack(OutputFile *fo);
|
||||
void unpack(OutputFile *fo);
|
||||
|
10
src/pefile.h
10
src/pefile.h
@ -236,7 +236,7 @@ protected:
|
||||
PEDIR_BOUNDIM = 11,
|
||||
PEDIR_IAT = 12,
|
||||
PEDIR_DELAYIMP = 13, // Delay Import Descriptor
|
||||
PEDIR_COMRT = 14 // Com+ Runtime Header
|
||||
PEDIR_COMRT = 14, // Com+ Runtime Header
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -251,7 +251,7 @@ protected:
|
||||
PEFL_SHARED = 0x10000000,
|
||||
PEFL_EXEC = 0x20000000,
|
||||
PEFL_READ = 0x40000000,
|
||||
PEFL_WRITE = 0x80000000
|
||||
PEFL_WRITE = 0x80000000,
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -267,7 +267,7 @@ protected:
|
||||
REMOVABLE_SWAP = 0x0400,
|
||||
SYSTEM_PROGRAM = 0x1000,
|
||||
DLL_FLAG = 0x2000,
|
||||
FBIG_ENDIAN = 0x8000
|
||||
FBIG_ENDIAN = 0x8000,
|
||||
};
|
||||
|
||||
//NEW: DLL characteristics definition for ASLR, ... - Stefan Widmann
|
||||
@ -281,7 +281,7 @@ protected:
|
||||
IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800,
|
||||
IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000,
|
||||
IMAGE_DLLCHARACTERISTICS_CONTROL_FLOW_GUARD = 0x4000,
|
||||
IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000
|
||||
IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000,
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -297,7 +297,7 @@ protected:
|
||||
IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER = 12,
|
||||
IMAGE_SUBSYSTEM_EFI_ROM = 13,
|
||||
IMAGE_SUBSYSTEM_XBOX = 14,
|
||||
IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16
|
||||
IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16,
|
||||
};
|
||||
|
||||
// predefined resource types
|
||||
|
@ -143,31 +143,27 @@ struct XSpan_is_convertible
|
||||
typename detail::XSpan_void_to_T<From, To>::type> {};
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
#if DEBUG
|
||||
// char => char
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<char, char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<char, const char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<const char, const char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<const char, char>::value))
|
||||
|
||||
// void => void
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<void, void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<void, const void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<const void, const void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<const void, void>::value))
|
||||
|
||||
// char => void
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<char, void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<char, const void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((XSpan_is_convertible<const char, const void>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<const char, void>::value))
|
||||
|
||||
// void => char
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<void, char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<void, const char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<const void, const char>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER((!XSpan_is_convertible<const void, char>::value))
|
||||
|
||||
// char => int
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(!(XSpan_is_convertible<char, int>::value))
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER(!(XSpan_is_convertible<char, const int>::value))
|
||||
@ -200,14 +196,14 @@ XSPAN_NAMESPACE_END
|
||||
#ifndef XSPAN_DELETED_FUNCTION
|
||||
#define XSPAN_DELETED_FUNCTION = delete
|
||||
#endif
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_UT(T, U, RType) \
|
||||
typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < U, T>::value, RType > ::type
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(T, U, RType) \
|
||||
typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < U, T>::value || \
|
||||
XSPAN_NS(XSpan_is_convertible)<T, U>::value, \
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION(From, To, RType) \
|
||||
typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < From, To>::value, RType > ::type
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION(A, B, RType) \
|
||||
typename std::enable_if<XSPAN_NS(XSpan_is_convertible) < A, B>::value || \
|
||||
XSPAN_NS(XSpan_is_convertible)<B, A>::value, \
|
||||
RType > ::type
|
||||
// note: these use "T" and "U"
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_R(RType) XSPAN_REQUIRES_CONVERTIBLE_UT(T, U, RType)
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_R(RType) XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION(U, T, RType)
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_A \
|
||||
XSPAN_REQUIRES_CONVERTIBLE_R(XSPAN_NS(XSpanInternalDummyArg) *) = nullptr
|
||||
#define XSPAN_REQUIRES_CONVERTIBLE_T XSPAN_REQUIRES_CONVERTIBLE_R(XSPAN_NS(XSpanInternalDummyArg) *)
|
||||
@ -223,7 +219,7 @@ XSPAN_NAMESPACE_END
|
||||
#include "xspan_impl_ptr_or_span.h"
|
||||
#include "xspan_impl_span.h"
|
||||
#include "xspan_impl_ptr.h"
|
||||
#undef XSPAN_REQUIRES_CONVERTIBLE_UT
|
||||
#undef XSPAN_REQUIRES_CONVERTIBLE_ONE_DIRECTION
|
||||
#undef XSPAN_REQUIRES_CONVERTIBLE_ANY_DIRECTION
|
||||
#undef XSPAN_REQUIRES_CONVERTIBLE_A
|
||||
#undef XSPAN_REQUIRES_CONVERTIBLE_R
|
||||
|
Reference in New Issue
Block a user