From 0d035ef8ee66ab0809d492c09b5baa6ad96ed094 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Mon, 12 Feb 2024 10:07:11 -0800 Subject: [PATCH] Don't define JS versions of abort or __assert_fail in standalone mode In STANDALONE_WASM mode these functions are defined in libstandalonewasm and not in JS. The JS definitions meant they were not able to be added to EXPORTED_FUNCTIONS. Fixes: #21312 --- src/library.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/library.js b/src/library.js index 3275d29c6bf9d..b30e852d66009 100644 --- a/src/library.js +++ b/src/library.js @@ -374,6 +374,7 @@ addToLibrary({ // stdlib.h // ========================================================================== +#if !STANDALONE_WASM // TODO: There are currently two abort() functions that get imported to asm // module scope: the built-in runtime function abort(), and this library // function _abort(). Remove one of these, importing two functions for the @@ -385,6 +386,7 @@ addToLibrary({ abort(''); #endif }, +#endif // This object can be modified by the user during startup, which affects // the initial values of the environment accessible by getenv. @@ -426,9 +428,11 @@ addToLibrary({ // assert.h // ========================================================================== +#if !STANDALONE_WASM __assert_fail: (condition, filename, line, func) => { abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']); }, +#endif // ========================================================================== // time.h