all: yet more cleanups
This commit is contained in:
@@ -11,13 +11,20 @@ CompileFlags:
|
|||||||
Add:
|
Add:
|
||||||
- -xc++
|
- -xc++
|
||||||
---
|
---
|
||||||
# common C++ flags
|
# C++ flags
|
||||||
If:
|
If:
|
||||||
PathMatch: [ src/.*\.h, src/.*\.cpp ]
|
PathMatch: [ src/.*\.h, src/.*\.cpp ]
|
||||||
PathExclude: vendor/.*
|
PathExclude: vendor/.*
|
||||||
CompileFlags:
|
CompileFlags:
|
||||||
Add:
|
Add:
|
||||||
- -std=gnu++17
|
- -std=gnu++17
|
||||||
|
---
|
||||||
|
# common flags for all C/C++ files
|
||||||
|
If:
|
||||||
|
PathMatch: [ src/.*\.h, src/.*\.c, src/.*\.cpp ]
|
||||||
|
PathExclude: vendor/.*
|
||||||
|
CompileFlags:
|
||||||
|
Add:
|
||||||
# see https://github.com/clangd/clangd/issues/1038 : Support deterministic relative include path
|
# see https://github.com/clangd/clangd/issues/1038 : Support deterministic relative include path
|
||||||
- -Ivendor
|
- -Ivendor
|
||||||
- -I../vendor
|
- -I../vendor
|
||||||
|
|||||||
@@ -168,11 +168,14 @@ jobs:
|
|||||||
env -C build/extra/gcc-m32/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
|
env -C build/extra/gcc-m32/release bash "$PWD"/misc/testsuite/mimic_ctest.sh
|
||||||
fi
|
fi
|
||||||
- name: 'Run file system test suite'
|
- name: 'Run file system test suite'
|
||||||
|
run: |
|
||||||
|
env -C build/extra/gcc/release bash "$PWD"/misc/testsuite/test_symlinks.sh
|
||||||
|
- name: 'Run file system test suite with Valgrind'
|
||||||
run: |
|
run: |
|
||||||
if command -v valgrind >/dev/null; then
|
if command -v valgrind >/dev/null; then
|
||||||
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
|
export upx_exe_runner="valgrind --leak-check=no --error-exitcode=1 --quiet --gen-suppressions=all"
|
||||||
fi
|
|
||||||
env -C build/extra/gcc/release bash "$PWD"/misc/testsuite/test_symlinks.sh
|
env -C build/extra/gcc/release bash "$PWD"/misc/testsuite/test_symlinks.sh
|
||||||
|
fi
|
||||||
- name: 'Run test suite build/extra/gcc/release'
|
- name: 'Run test suite build/extra/gcc/release'
|
||||||
run: |
|
run: |
|
||||||
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
|
export upx_testsuite_SRCDIR="$(readlink -en ../deps/upx-testsuite)"
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,6 @@
|
|||||||
/.hg*
|
/.hg*
|
||||||
/.vscode*
|
/.vscode*
|
||||||
/Makevars.global*
|
/Makevars[.-]global*
|
||||||
/Testing*
|
/Testing*
|
||||||
/build*
|
/build*
|
||||||
/maint*
|
/maint*
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
GNUmakefile*
|
GNUmakefile*
|
||||||
MMakefile*
|
MMakefile*
|
||||||
Makevars.local*
|
Makevars[.-]local*
|
||||||
compile_flags*.txt
|
compile_flags*.txt
|
||||||
Tmp*
|
Tmp*
|
||||||
tmp*
|
tmp*
|
||||||
@@ -16,6 +16,7 @@ tmp*
|
|||||||
*.a
|
*.a
|
||||||
*.bz2
|
*.bz2
|
||||||
*.d
|
*.d
|
||||||
|
*.diff
|
||||||
*.dll
|
*.dll
|
||||||
*.dylib
|
*.dylib
|
||||||
*.exe
|
*.exe
|
||||||
|
|||||||
+1
-1
@@ -101,7 +101,7 @@ ifneq ($(wildcard /usr/bin/env),)
|
|||||||
ifeq ($(shell uname),Linux)
|
ifeq ($(shell uname),Linux)
|
||||||
|
|
||||||
# Markus loves clang-format, but John hates it; find a compromise
|
# Markus loves clang-format, but John hates it; find a compromise
|
||||||
CLANG_FORMAT_EXCLUDE_FILES += miniacc.h stub/%.h
|
CLANG_FORMAT_EXCLUDE_FILES += stub/%.h util/miniacc.h
|
||||||
CLANG_FORMAT_EXCLUDE_FILES += p_lx_% p_mach% p_unix% p_vmlin%
|
CLANG_FORMAT_EXCLUDE_FILES += p_lx_% p_mach% p_unix% p_vmlin%
|
||||||
CLANG_FORMAT_FILES := $(sort $(wildcard *.[ch]* ../maint/src/*.[ch]* */*.[ch]*))
|
CLANG_FORMAT_FILES := $(sort $(wildcard *.[ch]* ../maint/src/*.[ch]* */*.[ch]*))
|
||||||
CLANG_FORMAT_FILES += $(sort $(wildcard stub/tools/*/*.[ch]*))
|
CLANG_FORMAT_FILES += $(sort $(wildcard stub/tools/*/*.[ch]*))
|
||||||
|
|||||||
+4
-4
@@ -73,15 +73,15 @@ struct LE64;
|
|||||||
// char is explicitly allowed
|
// char is explicitly allowed
|
||||||
// byte is explicitly allowed
|
// byte is explicitly allowed
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline constexpr bool is_xe16_type =
|
inline constexpr bool is_xe16_type =
|
||||||
upx::is_same_any_v<T, void, char, byte, upx_int16_t, upx_uint16_t, BE16, LE16>;
|
upx::is_same_any_v<T, void, char, byte, upx_int16_t, upx_uint16_t, BE16, LE16>;
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline constexpr bool is_xe24_type = upx::is_same_any_v<T, void, char, byte>;
|
inline constexpr bool is_xe24_type = upx::is_same_any_v<T, void, char, byte>;
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline constexpr bool is_xe32_type =
|
inline constexpr bool is_xe32_type =
|
||||||
upx::is_same_any_v<T, void, char, byte, upx_int32_t, upx_uint32_t, BE32, LE32>;
|
upx::is_same_any_v<T, void, char, byte, upx_int32_t, upx_uint32_t, BE32, LE32>;
|
||||||
template <class T>
|
template <class T>
|
||||||
static inline constexpr bool is_xe64_type =
|
inline constexpr bool is_xe64_type =
|
||||||
upx::is_same_any_v<T, void, char, byte, upx_int64_t, upx_uint64_t, BE64, LE64>;
|
upx::is_same_any_v<T, void, char, byte, upx_int64_t, upx_uint64_t, BE64, LE64>;
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
|||||||
@@ -24,8 +24,8 @@
|
|||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../headers.h"
|
#include "../util/system_headers.h"
|
||||||
#include <cmath> // std::isnan
|
#include <cmath> // std::isinf std::isnan
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -352,6 +352,11 @@ static noinline void check_basic_cxx_exception_handling(void (*func)(int)) noexc
|
|||||||
// basic floating point checks to early catch toolchain/qemu/wine/etc problems
|
// basic floating point checks to early catch toolchain/qemu/wine/etc problems
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#if defined(__clang__) && defined(__FAST_MATH__) && defined(__INTEL_LLVM_COMPILER)
|
||||||
|
// warning: comparison with NaN always evaluates to false in fast floating point modes
|
||||||
|
#pragma clang diagnostic ignored "-Wtautological-constant-compare"
|
||||||
|
#endif
|
||||||
|
|
||||||
static noinline float i64_f32_add_div(upx_int64_t a, upx_int64_t b) { return (a + b) / 1000000.0f; }
|
static noinline float i64_f32_add_div(upx_int64_t a, upx_int64_t b) { return (a + b) / 1000000.0f; }
|
||||||
static noinline float u64_f32_add_div(upx_uint64_t a, upx_uint64_t b) {
|
static noinline float u64_f32_add_div(upx_uint64_t a, upx_uint64_t b) {
|
||||||
return (a + b) / 1000000.0f;
|
return (a + b) / 1000000.0f;
|
||||||
@@ -415,7 +420,7 @@ static noinline void check_basic_floating_point(void) noexcept {
|
|||||||
|
|
||||||
#define ACC_WANT_ACC_CHK_CH 1
|
#define ACC_WANT_ACC_CHK_CH 1
|
||||||
#undef ACCCHK_ASSERT
|
#undef ACCCHK_ASSERT
|
||||||
#include "../miniacc.h"
|
#include "../util/miniacc.h"
|
||||||
|
|
||||||
void upx_compiler_sanity_check(void) noexcept {
|
void upx_compiler_sanity_check(void) noexcept {
|
||||||
const char *e = getenv("UPX_DEBUG_DOCTEST_DISABLE");
|
const char *e = getenv("UPX_DEBUG_DOCTEST_DISABLE");
|
||||||
@@ -434,7 +439,7 @@ void upx_compiler_sanity_check(void) noexcept {
|
|||||||
#define ACC_WANT_ACC_CHK_CH 1
|
#define ACC_WANT_ACC_CHK_CH 1
|
||||||
#undef ACCCHK_ASSERT
|
#undef ACCCHK_ASSERT
|
||||||
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
|
#define ACCCHK_ASSERT(expr) ACC_COMPILE_TIME_ASSERT(expr)
|
||||||
#include "../miniacc.h"
|
#include "../util/miniacc.h"
|
||||||
#undef ACCCHK_ASSERT
|
#undef ACCCHK_ASSERT
|
||||||
|
|
||||||
COMPILE_TIME_ASSERT(sizeof(char) == 1)
|
COMPILE_TIME_ASSERT(sizeof(char) == 1)
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // TODO later
|
#endif // TODO later
|
||||||
|
|
||||||
#include "../headers.h"
|
#include "../util/system_headers.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../headers.h"
|
#include "../util/system_headers.h"
|
||||||
#if WITH_BZIP2
|
#if WITH_BZIP2
|
||||||
#include <bzip2/bzlib.h>
|
#include <bzip2/bzlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
<markus@oberhumer.com>
|
<markus@oberhumer.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../headers.h"
|
#include "../util/system_headers.h"
|
||||||
#if WITH_ZSTD
|
#if WITH_ZSTD
|
||||||
#include <zstd/lib/zstd.h>
|
#include <zstd/lib/zstd.h>
|
||||||
#include <zstd/lib/zstd_errors.h>
|
#include <zstd/lib/zstd_errors.h>
|
||||||
|
|||||||
+7
-2
@@ -31,7 +31,7 @@
|
|||||||
// init
|
// init
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "headers.h"
|
#include "util/system_headers.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
#if !defined(__has_attribute)
|
#if !defined(__has_attribute)
|
||||||
@@ -190,6 +190,7 @@ typedef upx_int64_t upx_off_t;
|
|||||||
#define unlikely __acc_unlikely
|
#define unlikely __acc_unlikely
|
||||||
#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: noexcept(false) is the default for all C++ functions anyway
|
// note: noexcept(false) is the default for all C++ functions anyway
|
||||||
#define may_throw noexcept(false)
|
#define may_throw noexcept(false)
|
||||||
@@ -369,9 +370,11 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
|||||||
#define upx_return_address() nullptr
|
#define upx_return_address() nullptr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO cleanup: we now require C++17, so remove all packed_struct usage
|
// TODO later cleanup: we now require C++17, so remove all packed_struct usage
|
||||||
#define packed_struct(s) struct alignas(1) s
|
#define packed_struct(s) struct alignas(1) s
|
||||||
|
|
||||||
|
// TODO later cleanup: this was needed in the old days to catch compiler problems/bugs;
|
||||||
|
// we now require C++17, so remove this
|
||||||
#define COMPILE_TIME_ASSERT_ALIGNOF_USING_SIZEOF__(a, b) \
|
#define COMPILE_TIME_ASSERT_ALIGNOF_USING_SIZEOF__(a, b) \
|
||||||
{ \
|
{ \
|
||||||
typedef a acc_tmp_a_t; \
|
typedef a acc_tmp_a_t; \
|
||||||
@@ -395,6 +398,7 @@ inline void NO_fprintf(FILE *, const char *, ...) noexcept {}
|
|||||||
|
|
||||||
#define TABLESIZE(table) ((sizeof(table) / sizeof((table)[0])))
|
#define TABLESIZE(table) ((sizeof(table) / sizeof((table)[0])))
|
||||||
|
|
||||||
|
// TODO later: move these to upx namespace in util/cxxlib.h
|
||||||
template <class T>
|
template <class T>
|
||||||
inline T ALIGN_DOWN(const T &a, const T &b) {
|
inline T ALIGN_DOWN(const T &a, const T &b) {
|
||||||
T r;
|
T r;
|
||||||
@@ -471,6 +475,7 @@ noreturn void throwAssertFailed(const char *expr, const char *file, int line, co
|
|||||||
#define assert_noexcept assert
|
#define assert_noexcept assert
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// C++ support library
|
||||||
#include "util/cxxlib.h"
|
#include "util/cxxlib.h"
|
||||||
using upx::is_same_any_v;
|
using upx::is_same_any_v;
|
||||||
using upx::noncopyable;
|
using upx::noncopyable;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define WANT_WINDOWS_LEAN_H 1
|
#define WANT_WINDOWS_LEAN_H 1
|
||||||
#include "../headers.h"
|
#include "../util/system_headers.h"
|
||||||
#if (HAVE_CONIO_H)
|
#if (HAVE_CONIO_H)
|
||||||
#include <conio.h>
|
#include <conio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@
|
|||||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "headers.h"
|
#include "util/system_headers.h"
|
||||||
#include <typeinfo> // typeid()
|
#include <typeinfo> // typeid()
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ endif
|
|||||||
ifndef top_srcdir
|
ifndef top_srcdir
|
||||||
top_srcdir := $(srcdir)/../..
|
top_srcdir := $(srcdir)/../..
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
|
|
||||||
# update $PATH for our special stub build tools
|
# update $PATH for our special stub build tools
|
||||||
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/upx-stubtools-check-version),)
|
ifneq ($(wildcard $(HOME)/local/bin/bin-upx/upx-stubtools-check-version),)
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S lzma_d_cn.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S lzma_d_cn.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
ifneq ($(wildcard $(WATCOM)/binl/wcl),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -10,11 +10,11 @@ __dir_list += ../../../../../.. ../../../../../../.. ../../../../../../../..
|
|||||||
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
__dir_search = $(firstword $(foreach v,$1,$(if $(wildcard $v/$2),$v)) $3)
|
||||||
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
top_srcdir := $(call __dir_search,$(__dir_list),src/bele.h,NOT_FOUND)
|
||||||
endif
|
endif
|
||||||
include $(wildcard $(top_srcdir)/Makevars.global ./Makevars.local)
|
include $(wildcard $(top_srcdir)/Makevars-global.mk ./Makevars-local.mk)
|
||||||
vpath %.c $(top_srcdir)/src/stub/src/c
|
vpath %.c $(top_srcdir)/src/stub/src/c
|
||||||
|
|
||||||
STUBS =
|
STUBS =
|
||||||
include $(top_srcdir)/src/stub/src/c/Makevars.lzma
|
include $(top_srcdir)/src/stub/src/c/Makevars-lzma.mk
|
||||||
ifneq ($(UPX_LZMA_VERSION),)
|
ifneq ($(UPX_LZMA_VERSION),)
|
||||||
STUBS += lzma_d_cf.S lzma_d_cs.S
|
STUBS += lzma_d_cf.S lzma_d_cs.S
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
#define ACC_LIBC_NAKED 1
|
#define ACC_LIBC_NAKED 1
|
||||||
/*#define ACC_OS_FREESTANDING 1*/
|
/*#define ACC_OS_FREESTANDING 1*/
|
||||||
#include "miniacc.h"
|
#include "util/miniacc.h"
|
||||||
|
|
||||||
#define UPX_LZMA_COMPAT 1
|
#define UPX_LZMA_COMPAT 1
|
||||||
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@
|
|||||||
#define __STDC_FORMAT_MACROS 1
|
#define __STDC_FORMAT_MACROS 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && defined(__MINGW32__) && (defined(__clang__) || defined(__GNUC__))
|
|
||||||
#if !defined(__USE_MINGW_ANSI_STDIO)
|
#if !defined(__USE_MINGW_ANSI_STDIO)
|
||||||
|
#if defined(_WIN32) && defined(__MINGW32__) && (defined(__clang__) || defined(__GNUC__))
|
||||||
#define __USE_MINGW_ANSI_STDIO 1
|
#define __USE_MINGW_ANSI_STDIO 1
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* headers.h -- include system headers
|
/* system_headers.h -- include system headers
|
||||||
|
|
||||||
This file is part of the UPX executable compressor.
|
This file is part of the UPX executable compressor.
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "util/system_defs.h"
|
#include "system_defs.h"
|
||||||
|
|
||||||
#if !(__cplusplus + 0 >= 201703L)
|
#if !(__cplusplus + 0 >= 201703L)
|
||||||
#error "C++17 is required"
|
#error "C++17 is required"
|
||||||
@@ -56,6 +56,29 @@ static_assert(sizeof(long) == 4);
|
|||||||
static_assert(sizeof(void *) == 8);
|
static_assert(sizeof(void *) == 8);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// check expected defines
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
// these are pre-defined since gcc-4.6 (2011) and clang-3.2 (2012)
|
||||||
|
#if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_BIG_ENDIAN__ + 0 == 0)
|
||||||
|
#error "missing __ORDER_BIG_ENDIAN__"
|
||||||
|
#endif
|
||||||
|
#if !defined(__ORDER_LITTLE_ENDIAN__) || (__ORDER_LITTLE_ENDIAN__ + 0 == 0)
|
||||||
|
#error "missing __ORDER_LITTLE_ENDIAN__"
|
||||||
|
#endif
|
||||||
|
#if !defined(__BYTE_ORDER__) || (__BYTE_ORDER__ + 0 == 0)
|
||||||
|
#error "missing __BYTE_ORDER__"
|
||||||
|
#endif
|
||||||
|
#if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_BIG_ENDIAN__ + 0 != 4321)
|
||||||
|
#error "unexpected __ORDER_BIG_ENDIAN__"
|
||||||
|
#endif
|
||||||
|
#if !defined(__ORDER_BIG_ENDIAN__) || (__ORDER_LITTLE_ENDIAN__ + 0 != 1234)
|
||||||
|
#error "unexpected __ORDER_BIG_ENDIAN__"
|
||||||
|
#endif
|
||||||
|
#if (__BYTE_ORDER__ != __ORDER_BIG_ENDIAN__) && (__BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__)
|
||||||
|
#error "unexpected __BYTE_ORDER__"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// ACC and C system headers
|
// ACC and C system headers
|
||||||
#ifndef ACC_CFG_USE_NEW_STYLE_CASTS
|
#ifndef ACC_CFG_USE_NEW_STYLE_CASTS
|
||||||
#define ACC_CFG_USE_NEW_STYLE_CASTS 1
|
#define ACC_CFG_USE_NEW_STYLE_CASTS 1
|
||||||
@@ -146,7 +169,7 @@ static_assert(sizeof(void *) == 8);
|
|||||||
|
|
||||||
#ifdef WANT_WINDOWS_LEAN_H
|
#ifdef WANT_WINDOWS_LEAN_H
|
||||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||||
#include "util/windows_lean.h"
|
#include "windows_lean.h"
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+4
-3
@@ -25,17 +25,17 @@
|
|||||||
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
<markus@oberhumer.com> <ezerotven+github@gmail.com>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "../headers.h"
|
#include "system_headers.h"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#define ACC_WANT_ACC_INCI_H 1
|
#define ACC_WANT_ACC_INCI_H 1
|
||||||
#include "../miniacc.h"
|
#include "miniacc.h"
|
||||||
#define ACC_WANT_ACCLIB_GETOPT 1
|
#define ACC_WANT_ACCLIB_GETOPT 1
|
||||||
#define ACC_WANT_ACCLIB_HSREAD 1
|
#define ACC_WANT_ACCLIB_HSREAD 1
|
||||||
#define ACC_WANT_ACCLIB_MISC 1
|
#define ACC_WANT_ACCLIB_MISC 1
|
||||||
#define ACC_WANT_ACCLIB_VGET 1
|
#define ACC_WANT_ACCLIB_VGET 1
|
||||||
#define ACC_WANT_ACCLIB_WILDARGV 1
|
#define ACC_WANT_ACCLIB_WILDARGV 1
|
||||||
#undef HAVE_MKDIR
|
#undef HAVE_MKDIR
|
||||||
#include "../miniacc.h"
|
#include "miniacc.h"
|
||||||
#include "../conf.h"
|
#include "../conf.h"
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
@@ -152,6 +152,7 @@ void uintptr_check_no_overlap(upx_uintptr_t a, size_t a_size, upx_uintptr_t b, s
|
|||||||
upx_uintptr_t b_end = b + mem_size(1, b_size);
|
upx_uintptr_t b_end = b + mem_size(1, b_size);
|
||||||
if very_unlikely (a_end < a || b_end < b) // wrap-around
|
if very_unlikely (a_end < a || b_end < b) // wrap-around
|
||||||
throwCantPack("ptr_check_no_overlap-overflow");
|
throwCantPack("ptr_check_no_overlap-overflow");
|
||||||
|
// simple, but a little bit mind bending:
|
||||||
// same as (!(a >= b_end || b >= a_end))
|
// same as (!(a >= b_end || b >= a_end))
|
||||||
// same as (!(a_end <= b || b_end <= a))
|
// same as (!(a_end <= b || b_end <= a))
|
||||||
if very_unlikely (a < b_end && b < a_end)
|
if very_unlikely (a < b_end && b < a_end)
|
||||||
|
|||||||
+1
-1
@@ -31,7 +31,7 @@
|
|||||||
// And see p_com.cpp for a simple executable format.
|
// And see p_com.cpp for a simple executable format.
|
||||||
|
|
||||||
#define WANT_WINDOWS_LEAN_H 1 // _get_osfhandle, GetFileTime, SetFileTime
|
#define WANT_WINDOWS_LEAN_H 1 // _get_osfhandle, GetFileTime, SetFileTime
|
||||||
#include "headers.h"
|
#include "util/system_headers.h"
|
||||||
#if USE_UTIMENSAT
|
#if USE_UTIMENSAT
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user