Skip to content

Commit

Permalink
Don't define JS versions of abort or __assert_fail in standalone mode (
Browse files Browse the repository at this point in the history
…#21317)

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
  • Loading branch information
sbc100 committed Feb 12, 2024
1 parent 1bde14c commit 52e5687
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 52e5687

Please sign in to comment.