Skip to content

Commit

Permalink
Rename abort JS helper function
Browse files Browse the repository at this point in the history
Also, remove the comment which I believe is not longer relevant with
this change.
  • Loading branch information
sbc100 committed Apr 17, 2024
1 parent 3f15cfd commit a492876
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 1 addition & 5 deletions src/library.js
Expand Up @@ -398,11 +398,7 @@ addToLibrary({
// ==========================================================================

#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
// same purpose is wasteful.
abort: () => {
_abort_js: () => {
#if ASSERTIONS
abort('native code called abort()');
#else
Expand Down
8 changes: 8 additions & 0 deletions system/lib/libc/musl/src/exit/abort.c
Expand Up @@ -6,8 +6,15 @@
#include "lock.h"
#include "ksigaction.h"

#if __EMSCRIPTEN__
_Noreturn void _abort_js();
#endif

_Noreturn void abort(void)
{
#if __EMSCRIPTEN__
_abort_js();
#else
raise(SIGABRT);

/* If there was a SIGABRT handler installed and it returned, or if
Expand All @@ -27,4 +34,5 @@ _Noreturn void abort(void)
a_crash();
raise(SIGKILL);
_Exit(127);
#endif
}
2 changes: 1 addition & 1 deletion tools/system_libs.py
Expand Up @@ -1241,7 +1241,7 @@ def get_files(self):

libc_files += files_in_path(
path='system/lib/libc/musl/src/exit',
filenames=['_Exit.c', 'atexit.c', 'at_quick_exit.c', 'quick_exit.c'])
filenames=['abort.c', '_Exit.c', 'atexit.c', 'at_quick_exit.c', 'quick_exit.c'])

libc_files += files_in_path(
path='system/lib/libc/musl/src/ldso',
Expand Down

0 comments on commit a492876

Please sign in to comment.