From ad566d793aac120f47660ca48d45b5e4e0476abd Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 20 Jun 2024 10:49:09 +0200 Subject: [PATCH] CI updates --- .github/workflows/ci.yml | 12 ++++++++++++ src/help.cpp | 12 ++++++++++++ src/util/util.cpp | 11 ++++++++--- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index babb8317..26ceef7c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -110,6 +110,10 @@ jobs: with: { submodules: true } - name: Check out test suite run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite + - run: clang -E -x c -dM /dev/null # list predefined macros for C + - run: clang++ -E -x c++ -dM /dev/null # list predefined macros for C++ + - run: gcc -E -x c -dM /dev/null # list predefined macros for C + - run: g++ -E -x c++ -dM /dev/null # list predefined macros for C++ - run: make build/extra/gcc/all - run: make build/extra/clang/all - run: make build/extra/gcc-m32/all @@ -231,6 +235,12 @@ jobs: - name: Check out test suite if: ${{ matrix.testsuite }} run: git clone --depth=1 https://github.com/upx/upx-testsuite ../deps/upx-testsuite + - run: clang -E -x c -dM /dev/null # list predefined macros for C + - run: clang++ -E -x c++ -dM /dev/null # list predefined macros for C++ + - run: ${{ matrix.gcc }} -E -x c -dM /dev/null # list predefined macros for C + if: ${{ matrix.gcc }} + - run: ${{ matrix.gxx }} -E -x c++ -dM /dev/null # list predefined macros for C++ + if: ${{ matrix.gcc }} - run: make build/extra/clang/all - name: Build extra/gcc/all if: ${{ matrix.gcc }} @@ -536,6 +546,8 @@ jobs: if test "X$ZIG_PIC" = "X-fPIE"; then true; echo "ZIG_FLAGS=$ZIG_FLAGS --start-no-unused-arguments -pie --end-no-unused-arguments" >> $GITHUB_ENV fi + - run: zig-cc -E -x c -dM /dev/null # list predefined macros for C + - run: zig-cxx -E -x c++ -dM /dev/null # list predefined macros for C++ - name: ${{ format('Build Release with zig-cc -target {0} {1}', env.ZIG_TARGET, env.ZIG_PIC) }} run: | make UPX_XTARGET=zig/${ZIG_TARGET}${ZIG_PIC} xtarget/release \ diff --git a/src/help.cpp b/src/help.cpp index 49d6c8b2..e6aecce5 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -576,6 +576,15 @@ void show_sysinfo(const char *options_var) { #if defined(__mips_soft_float) cf_print("__mips_soft_float", "%lld", __mips_soft_float + 0); #endif +#if defined(__wasm__) + cf_print("__wasm__", "%lld", __wasm__ + 0); +#endif +#if defined(__wasm32__) + cf_print("__wasm32__", "%lld", __wasm32__ + 0); +#endif +#if defined(__wasm64__) + cf_print("__wasm64__", "%lld", __wasm64__ + 0); +#endif // OS and libc #if defined(WINVER) @@ -604,6 +613,9 @@ void show_sysinfo(const char *options_var) { #if defined(__GLIBC_MINOR__) cf_print("__GLIBC_MINOR__", "%lld", __GLIBC_MINOR__ + 0); #endif +#if defined(__wasi__) + cf_print("__wasi__", "%lld", __wasi__ + 0); +#endif // misc compilation options #if defined(UPX_CONFIG_DISABLE_WSTRICT) diff --git a/src/util/util.cpp b/src/util/util.cpp index c09464c5..2b709322 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -970,10 +970,15 @@ TEST_CASE("get_ratio") { // compat **************************************************************************/ -#if defined(__wasi__) // TODO later - wait for wasm/wasi exception handling proposal +#if defined(__wasi__) && 1 // TODO later - wait for wasm/wasi exception handling proposal extern "C" { -void __cxa_allocate_exception() throw() { std::terminate(); } -void __cxa_throw() { std::terminate(); } +void *__cxa_allocate_exception(std::size_t thrown_size) throw() { return ::malloc(thrown_size); } +void __cxa_throw(void *thrown_exception, /*std::type_info*/ void *tinfo, void (*dest)(void *)) { + UNUSED(thrown_exception); + UNUSED(tinfo); + UNUSED(dest); + std::terminate(); +} } // extern "C" #endif