From ef603d46c30fd0c29510f693243125bf8e5f7fe2 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Thu, 16 Jan 2025 05:17:33 +0100 Subject: [PATCH 1/3] System: use nacl_minidump and nacl_exception headers from libs/, Saigo doesn't ship them unlike PNaCl --- CMakeLists.txt | 8 +++----- src/common/System.cpp | 8 ++------ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91d0a5d0b0..29033efd27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -514,11 +514,9 @@ endif() if (WIN32) set(LIBS_BASE ${LIBS_BASE} winmm ws2_32) elseif (NACL) - if (NOT USE_NACL_SAIGO) - find_library(NACL_EXCEPTION nacl_exception) - find_library(NACL_MINIDUMP minidump_generator) - set(LIBS_BASE ${LIBS_BASE} ${NACL_MINIDUMP} ${NACL_EXCEPTION}) - endif() + find_library(NACL_EXCEPTION nacl_exception) + find_library(NACL_MINIDUMP minidump_generator) + set(LIBS_BASE ${LIBS_BASE} ${NACL_MINIDUMP} ${NACL_EXCEPTION}) else() find_library(LIBM m) if (LIBM) diff --git a/src/common/System.cpp b/src/common/System.cpp index 6e598f2ff0..c1f011adc8 100644 --- a/src/common/System.cpp +++ b/src/common/System.cpp @@ -39,10 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #endif #ifdef __native_client__ -#if !defined(__saigo__) -#include -#include -#endif +#include +#include #include #else #include @@ -337,10 +335,8 @@ static void CrashHandler(const void* data, size_t n) void SetupCrashHandler() { -#if !defined(__saigo__) nacl_minidump_register_crash_handler(); nacl_minidump_set_callback(CrashHandler); -#endif } #else NORETURN static void CrashHandler(int sig) From 530b479ab09b068b207a02217d9eb2d2da31e00a Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Thu, 16 Jan 2025 05:22:58 +0100 Subject: [PATCH 2/3] System: we don't need the nacl_exception header, only the library as a dependency of nacl_minidump --- src/common/System.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/common/System.cpp b/src/common/System.cpp index c1f011adc8..8a368c8f49 100644 --- a/src/common/System.cpp +++ b/src/common/System.cpp @@ -39,7 +39,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #endif #ifdef __native_client__ -#include #include #include #else From b0d70fa23e0ed36177b4b2c3a797bb3a1fe7d37c Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Fri, 17 Jan 2025 04:12:47 +0100 Subject: [PATCH 3/3] cmake: workaround minidump libraries finding for i686 nexe --- CMakeLists.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 29033efd27..26ac402d44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -516,6 +516,17 @@ if (WIN32) elseif (NACL) find_library(NACL_EXCEPTION nacl_exception) find_library(NACL_MINIDUMP minidump_generator) + + # HACK: To be removed when Saigo is repackaged properly. + if (NOT NACL_MINIDUMP + # NACL_TARGET is specific to Saigo, PNaCl target is le32 and doesn't set NACL_TARGET. + AND "${NACL_TARGET}" STREQUAL "i686" + # x86_64-nacl/lib32 is specific to Google build, other builds may provide i686-nacl/lib instead. + AND EXISTS "${DEPS_DIR}/saigo_newlib/x86_64-nacl/lib32") + set(NACL_EXCEPTION "${DEPS_DIR}/saigo_newlib/x86_64-nacl/lib32/libnacl_exception.a") + set(NACL_MINIDUMP "${DEPS_DIR}/saigo_newlib/x86_64-nacl/lib32/libminidump_generator.a") + endif() + set(LIBS_BASE ${LIBS_BASE} ${NACL_MINIDUMP} ${NACL_EXCEPTION}) else() find_library(LIBM m)