Browse Source

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.
pull/349/head
Dan Gohman 2 years ago
committed by GitHub
parent
commit
2bb5abedbd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      expected/wasm32-wasi/posix/defined-symbols.txt
  2. 1
      expected/wasm32-wasi/single/defined-symbols.txt
  3. 5
      libc-bottom-half/sources/__errno_location.c

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

@ -48,6 +48,7 @@ __do_des
__do_orphaned_stdio_locks __do_orphaned_stdio_locks
__duplocale __duplocale
__env_rm_add __env_rm_add
__errno_location
__exp2f_data __exp2f_data
__exp_data __exp_data
__expo2 __expo2

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

@ -38,6 +38,7 @@ __des_setkey
__do_des __do_des
__duplocale __duplocale
__env_rm_add __env_rm_add
__errno_location
__exp2f_data __exp2f_data
__exp_data __exp_data
__expo2 __expo2

5
libc-bottom-half/sources/__errno_location.c

@ -0,0 +1,5 @@
#include <errno.h>
int *__errno_location(void) {
return &errno;
}
Loading…
Cancel
Save