Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion expected/wasm32-wasi/defined-symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ __polevll
__posix_getopt
__pow_log_data
__powf_log2_data
__prepare_for_exit
__progname
__progname_full
__putenv
Expand Down Expand Up @@ -263,6 +262,7 @@ __wasilibc_register_preopened_fd
__wasilibc_rmdirat
__wasilibc_tell
__wasilibc_unlinkat
__wasm_call_dtors
__wcscoll_l
__wcsftime_l
__wcsxfrm_l
Expand Down
4 changes: 2 additions & 2 deletions libc-bottom-half/crt/crt1.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <wasi/api.h>
extern void __wasm_call_ctors(void);
extern int __original_main(void);
extern void __prepare_for_exit(void);
extern void __wasm_call_dtors(void);

__attribute__((export_name("_start")))
void _start(void) {
Expand All @@ -14,7 +14,7 @@ void _start(void) {
int r = __original_main();

// Call atexit functions, destructors, stdio cleanup, etc.
__prepare_for_exit();
__wasm_call_dtors();

// If main exited successfully, just return, otherwise call
// `__wasi_proc_exit`.
Expand Down
4 changes: 2 additions & 2 deletions libc-top-half/musl/src/exit/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ _Noreturn void exit(int code)
// Split out the cleanup functions so that we can call them without calling
// _Exit if we don't need to. This allows _start to just return if main
// returns 0.
void __prepare_for_exit(void)
void __wasm_call_dtors(void)
{
__funcs_on_exit();
__stdio_exit();
}

_Noreturn void exit(int code)
{
__prepare_for_exit();
__wasm_call_dtors();
_Exit(code);
}
#endif