Skip to content

Commit 2bb5abe

Browse files
authored
Define an __errno_location function. (#347)
This function returns the address of `errno`, which makes it easier to access from non-C languages since `errno` is a thread-local variable which requires a special ABI.
1 parent a00bf32 commit 2bb5abe

3 files changed

Lines changed: 7 additions & 0 deletions

File tree

expected/wasm32-wasi/posix/defined-symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ __do_des
4848
__do_orphaned_stdio_locks
4949
__duplocale
5050
__env_rm_add
51+
__errno_location
5152
__exp2f_data
5253
__exp_data
5354
__expo2

expected/wasm32-wasi/single/defined-symbols.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ __des_setkey
3838
__do_des
3939
__duplocale
4040
__env_rm_add
41+
__errno_location
4142
__exp2f_data
4243
__exp_data
4344
__expo2
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#include <errno.h>
2+
3+
int *__errno_location(void) {
4+
return &errno;
5+
}

0 commit comments

Comments
 (0)