Skip to content

Commit 52e5687

Browse files
authored
Don't define JS versions of abort or __assert_fail in standalone mode (#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
1 parent 1bde14c commit 52e5687

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/library.js

+4
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ addToLibrary({
374374
// stdlib.h
375375
// ==========================================================================
376376

377+
#if !STANDALONE_WASM
377378
// TODO: There are currently two abort() functions that get imported to asm
378379
// module scope: the built-in runtime function abort(), and this library
379380
// function _abort(). Remove one of these, importing two functions for the
@@ -385,6 +386,7 @@ addToLibrary({
385386
abort('');
386387
#endif
387388
},
389+
#endif
388390

389391
// This object can be modified by the user during startup, which affects
390392
// the initial values of the environment accessible by getenv.
@@ -426,9 +428,11 @@ addToLibrary({
426428
// assert.h
427429
// ==========================================================================
428430

431+
#if !STANDALONE_WASM
429432
__assert_fail: (condition, filename, line, func) => {
430433
abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : 'unknown filename', line, func ? UTF8ToString(func) : 'unknown function']);
431434
},
435+
#endif
432436

433437
// ==========================================================================
434438
// time.h

0 commit comments

Comments
 (0)