From eb2dafbf4df14686a214c190410c41cca2597692 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 23 Jan 2026 13:46:50 -0800 Subject: [PATCH 1/3] Use _Exit instead of std::quick_exit to work around MacOS bug Older versions of MacOS are missing the libc symbol quick_exit, despite the fact that libc++ implements std::quick_exit on top of it. The result is that Binaryen will link but fail to load. Switch to _Exit instead. --- src/support/file.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/support/file.cpp b/src/support/file.cpp index be06980d591..23016e8112d 100644 --- a/src/support/file.cpp +++ b/src/support/file.cpp @@ -152,6 +152,12 @@ void wasm::flush_and_quick_exit(int code) { // things can run during shutdown normally. std::exit(code); #else - std::quick_exit(code); + // A "better" function to use here would be std::quick_exit, however on older + // version of MacOS (at least as new as 13.2 which currently runs on our CI) + // the C symbol _quick_exit (which is called by std::quick_exit) is missing. + // So instead use _Exit(); the only difference is that _Exit() does not call + // handlers registered by at_quick_exit(). Currently Binaryen does not have + // any of those. + _Exit(); #endif } From 5bb54a7db191431a414639da2f9b0302c2d6c45a Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 23 Jan 2026 13:52:00 -0800 Subject: [PATCH 2/3] macOS --- src/support/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/support/file.cpp b/src/support/file.cpp index 23016e8112d..9f3f785a7f8 100644 --- a/src/support/file.cpp +++ b/src/support/file.cpp @@ -153,7 +153,7 @@ void wasm::flush_and_quick_exit(int code) { std::exit(code); #else // A "better" function to use here would be std::quick_exit, however on older - // version of MacOS (at least as new as 13.2 which currently runs on our CI) + // version of macOS (at least as new as 13.2 which currently runs on our CI) // the C symbol _quick_exit (which is called by std::quick_exit) is missing. // So instead use _Exit(); the only difference is that _Exit() does not call // handlers registered by at_quick_exit(). Currently Binaryen does not have From d14ae923a530fe2cf106a070bc0cd513c458d5b6 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 23 Jan 2026 14:16:02 -0800 Subject: [PATCH 3/3] code --- src/support/file.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/support/file.cpp b/src/support/file.cpp index 9f3f785a7f8..bfc0597e0a1 100644 --- a/src/support/file.cpp +++ b/src/support/file.cpp @@ -158,6 +158,6 @@ void wasm::flush_and_quick_exit(int code) { // So instead use _Exit(); the only difference is that _Exit() does not call // handlers registered by at_quick_exit(). Currently Binaryen does not have // any of those. - _Exit(); + _Exit(code); #endif }