diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 360ffffc..1edcb817 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ env: CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive UPX_CMAKE_BUILD_FLAGS: --verbose - # 2023-11-04 - ZIG_DIST_VERSION: 0.12.0-dev.1396+f6de3ec96 + # 2023-11-08 + ZIG_DIST_VERSION: 0.12.0-dev.1502+b3462b7ce jobs: job-rebuild-and-verify-stubs: diff --git a/.github/workflows/misc-spell-check.yml b/.github/workflows/misc-spell-check.yml index 0d76b8b9..e5fdd66c 100644 --- a/.github/workflows/misc-spell-check.yml +++ b/.github/workflows/misc-spell-check.yml @@ -17,5 +17,5 @@ jobs: uses: actions/checkout@v4 with: { submodules: false } - name: 'Spell check with crate-ci/typos' - uses: crate-ci/typos@0d04ce91a7a8436a6e3c589750514ac586632192 # v1.16.22 + uses: crate-ci/typos@c97d621b6b01d8b0258538ca15abeca5c5764601 # v1.16.23 with: { config: ./.github/typos_config.toml } diff --git a/.github/workflows/weekly-ci-cc-zigcc.yml b/.github/workflows/weekly-ci-cc-zigcc.yml index 5d5361d1..2e4f311d 100644 --- a/.github/workflows/weekly-ci-cc-zigcc.yml +++ b/.github/workflows/weekly-ci-cc-zigcc.yml @@ -11,8 +11,8 @@ env: CMAKE_REQUIRED_QUIET: "OFF" CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive - # 2023-11-04 - ZIG_DIST_VERSION: 0.12.0-dev.1396+f6de3ec96 + # 2023-11-08 + ZIG_DIST_VERSION: 0.12.0-dev.1502+b3462b7ce jobs: job-linux-zigcc: # uses cmake + make diff --git a/CMakeLists.txt b/CMakeLists.txt index 3823bc29..25b45d48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,13 @@ include(CheckIncludeFile) include(CheckStructHasMember) include(CheckSymbolExists) +# TODO later: use pledge() +# https://justine.lol/pledge/ +# https://github.com/jart/cosmopolitan +# https://news.ycombinator.com/item?id=32096801 +##find_package(PkgConfig QUIET) +##pkg_check_modules(PKG_libseccomp QUIET libseccomp) + if(NOT DEFINED HAVE_UNISTD_H) check_include_file("unistd.h" HAVE_UNISTD_H) endif() diff --git a/src/conf.h b/src/conf.h index 3802d206..0f1c960b 100644 --- a/src/conf.h +++ b/src/conf.h @@ -83,6 +83,12 @@ ACC_COMPILE_TIME_ASSERT_HEADER((char) (-1) == 255) #endif // UPX_CONFIG_DISABLE_WSTRICT // multithreading (UPX currently does not use multithreading) +#if (WITH_THREADS) && defined(_WIN32) && defined(__GLIBCXX__) +#if !defined(_GLIBCXX_HAS_GTHREADS) +#error "broken MinGW installation: missing _GLIBCXX_HAS_GTHREADS" +#undef WITH_THREADS +#endif +#endif #if (WITH_THREADS) #define upx_thread_local thread_local #define upx_std_atomic(Type) std::atomic diff --git a/src/headers.h b/src/headers.h index 1f2a8fc9..14b904c8 100644 --- a/src/headers.h +++ b/src/headers.h @@ -62,6 +62,21 @@ static_assert(sizeof(void *) == 8); #define _USE_MINGW_ANSI_STDIO 1 #endif #endif +#if defined(_WIN32) +// disable silly warnings about using "deprecated" POSIX functions like fopen() +#if !defined(_CRT_NONSTDC_NO_DEPRECATE) +#define _CRT_NONSTDC_NO_DEPRECATE 1 +#endif +#if !defined(_CRT_NONSTDC_NO_WARNINGS) +#define _CRT_NONSTDC_NO_WARNINGS 1 +#endif +#if !defined(_CRT_SECURE_NO_DEPRECATE) +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif +#if !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS 1 +#endif +#endif // _WIN32 // ACC and C system headers #ifndef ACC_CFG_USE_NEW_STYLE_CASTS diff --git a/src/help.cpp b/src/help.cpp index c6622f1c..6d0b6e5c 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -529,6 +529,16 @@ void show_sysinfo(const char *options_var) { #endif #if defined(__GLIBC_MINOR__) cf_print("__GLIBC_MINOR__", "%lld", __GLIBC_MINOR__ + 0); +#endif + // misc compilation options +#if defined(UPX_CONFIG_DISABLE_WSTRICT) + cf_print("UPX_CONFIG_DISABLE_WSTRICT", "%lld", UPX_CONFIG_DISABLE_WSTRICT + 0, 3); +#endif +#if defined(UPX_CONFIG_DISABLE_WERROR) + cf_print("UPX_CONFIG_DISABLE_WERROR", "%lld", UPX_CONFIG_DISABLE_WERROR + 0, 3); +#endif +#if defined(WITH_THREADS) + cf_print("WITH_THREADS", "%lld", WITH_THREADS + 0); #endif UNUSED(cf_count); UNUSED(cf_print);