Skip to content

Commit 551f284

Browse files
committed
Initialize environment variables before running the static constructors.
1 parent 1176e2f commit 551f284

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

libc-bottom-half/crt/crt1.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,6 @@ static __wasi_errno_t populate_environ() {
6565
}
6666

6767
void _start(void) {
68-
/* The linker synthesizes this to call constructors. */
69-
__wasm_call_ctors();
70-
7168
/* Fill in the environment from WASI syscalls. */
7269
if (populate_environ() != __WASI_ESUCCESS) {
7370
_Exit(EX_OSERR);
@@ -80,6 +77,9 @@ void _start(void) {
8077
_Exit(EX_OSERR);
8178
}
8279

80+
/* The linker synthesizes this to call constructors. */
81+
__wasm_call_ctors();
82+
8383
/* Call main with the arguments. */
8484
int r = main(argc, argv);
8585

0 commit comments

Comments
 (0)