diff --git a/CMakeLists.txt b/CMakeLists.txt index 730bde73..1320b822 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,7 @@ endif() # support functions and some utility include("${CMAKE_CURRENT_SOURCE_DIR}/misc/cmake/functions.cmake") +upx_print_var(CMAKE_VERSION UPX_CONFIG_CMAKE_MINIMUM_REQUIRED_VERSION CMAKE_GENERATOR) #*********************************************************************** # options @@ -154,9 +155,20 @@ include(CheckFunctionExists) include(CheckIncludeFile) include(CheckStructHasMember) include(CheckSymbolExists) +include(CheckTypeSize) upx_cmake_include_hook(3_common_compilation_flags) +# assert sane type sizes +check_type_size("size_t" C_SIZEOF_SIZE_T LANGUAGE C) +check_type_size("size_t" CXX_SIZEOF_SIZE_T LANGUAGE CXX) +if(NOT "${C_SIZEOF_SIZE_T}" MATCHES "^(4|8|16)$") + message(FATAL_ERROR "ERROR: unexpected C_SIZEOF_SIZE_T '${C_SIZEOF_SIZE_T}'") +endif() +if(NOT ",${C_SIZEOF_SIZE_T}," STREQUAL ",${CXX_SIZEOF_SIZE_T},") + message(FATAL_ERROR "FATAL ERROR: '${C_SIZEOF_SIZE_T}' '${CXX_SIZEOF_SIZE_T}' mismatch") +endif() + if(NOT DEFINED HAVE_UNISTD_H) check_include_file("unistd.h" HAVE_UNISTD_H) endif() diff --git a/NEWS b/NEWS index f68e377e..8205dd92 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,7 @@ User visible changes for UPX Changes in 4.3.0 (XX XXX XXXX): * bug fixes - see https://github.com/upx/upx/milestone/18 - * ELF: PT_MIPS_ABIFLAGS is now fowarded into the compressed output; + * ELF: PT_MIPS_ABIFLAGS is now forwarded into the compressed output; qemu-mips can choose the right floating-point emulation * ELF: --unmap-all-pages completely avoids /proc/self/exe diff --git a/misc/cmake/print_info.cmake b/misc/cmake/print_info.cmake index cf3c709a..08907b9c 100644 --- a/misc/cmake/print_info.cmake +++ b/misc/cmake/print_info.cmake @@ -10,6 +10,8 @@ # generator upx_print_var(CMAKE_GENERATOR_TOOLSET CMAKE_GENERATOR_PLATFORM) +get_property(PROPERTY_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) +upx_print_var(PROPERTY_GENERATOR_IS_MULTI_CONFIG) # directories if(NOT ",${CMAKE_BINARY_DIR}," STREQUAL ",${CMAKE_CURRENT_BINARY_DIR}," OR NOT ",${CMAKE_SOURCE_DIR}," STREQUAL ",${CMAKE_CURRENT_SOURCE_DIR},") @@ -21,6 +23,7 @@ upx_print_var(CMAKE_HOST_SYSTEM_NAME CMAKE_HOST_SYSTEM_VERSION CMAKE_HOST_SYSTEM upx_print_var(CMAKE_SYSTEM_NAME CMAKE_SYSTEM_VERSION CMAKE_SYSTEM_PROCESSOR) upx_print_var(CMAKE_ANDROID_NDK CMAKE_ANDROID_NDK_VERSION CMAKE_ANDROID_STANDALONE_TOOLCHAIN) upx_print_var(CMAKE_APPLE_SILICON_PROCESSOR CMAKE_OSX_DEPLOYMENT_TARGET CMAKE_OSX_SYSROOT) +upx_print_var(CMAKE_VS_PLATFORM_TOOLSET CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE CMAKE_VS_PLATFORM_TOOLSET_VERSION) upx_print_var(CMAKE_CROSSCOMPILING CMAKE_CROSSCOMPILING_EMULATOR) # binutils @@ -41,6 +44,8 @@ endforeach() # misc upx_print_var(CMAKE_INTERPROCEDURAL_OPTIMIZATION CMAKE_POSITION_INDEPENDENT_CODE) +get_property(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS) +upx_print_var(PROPERTY_TARGET_SUPPORTS_SHARED_LIBS) # shortcuts upx_print_var(APPLE CLANG CYGWIN GNU_FRONTEND GNUC MINGW MSVC MSVC_FRONTEND MSVC_IDE MSVC_TOOLSET_VERSION MSVC_VERSION MSYS UNIX WIN32 WIN64) diff --git a/misc/make/Makefile-extra.mk b/misc/make/Makefile-extra.mk index 2de824d3..a41e7e17 100644 --- a/misc/make/Makefile-extra.mk +++ b/misc/make/Makefile-extra.mk @@ -94,7 +94,7 @@ build/extra/clang-std-cxx20/%: export UPX_CONFIG_DISABLE_CXX_STANDARD=ON # force building with clang/clang++ C++23 (and C23) build/extra/clang-std-cxx23/debug: PHONY; $(call run_config_and_build,$@,Debug) build/extra/clang-std-cxx23/release: PHONY; $(call run_config_and_build,$@,Release) -build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x +build/extra/clang-std-cxx23/%: export CC = clang -std=gnu2x -Wno-constant-logical-operand build/extra/clang-std-cxx23/%: export CXX = clang++ -std=gnu++2b build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_C_STANDARD=ON build/extra/clang-std-cxx23/%: export UPX_CONFIG_DISABLE_CXX_STANDARD=ON diff --git a/src/check/dt_check.cpp b/src/check/dt_check.cpp index 4025a50b..95de06eb 100644 --- a/src/check/dt_check.cpp +++ b/src/check/dt_check.cpp @@ -25,7 +25,7 @@ */ // doctest checks, and various tests to catch toolchain/qemu/sanitizer/valgrind/wine/etc -// problems; grown historically +// problems; grown historically; modern compilers will optimize away much of this code #include "../util/system_headers.h" #include // std::isinf std::isnan @@ -320,7 +320,6 @@ static_assert((wchar_t) -1 > 0); /************************************************************************* // upx_compiler_sanity_check() // assert a sane architecture and compiler -// (modern compilers will optimize away most of this code) **************************************************************************/ namespace { @@ -983,7 +982,7 @@ void upx_compiler_sanity_check(void) noexcept { CheckIntegral::check(); #endif #if (__SIZEOF_INT128__ == 16) -#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet +#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet #else CheckIntegral::check(); CheckIntegral::check(); @@ -1012,7 +1011,7 @@ void upx_compiler_sanity_check(void) noexcept { CheckSignedness::check(); CheckSignedness::check(); #if (__SIZEOF_INT128__ == 16) -#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet +#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet #else CheckSignedness::check(); CheckSignedness::check(); @@ -1040,7 +1039,7 @@ void upx_compiler_sanity_check(void) noexcept { CHECK_TYPE_PAIR(upx_int32_t, upx_uint32_t); CHECK_TYPE_PAIR(upx_int64_t, upx_uint64_t); #if (__SIZEOF_INT128__ == 16) -#if defined(_CPP_VER) // int128 is not supported by MSVC libstdc++ yet +#if defined(_CPP_VER) || defined(_WIN32) // int128 is not fully supported by MSVC libstdc++ yet #else CHECK_TYPE_PAIR(upx_int128_t, upx_uint128_t); #endif