diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 13:54:38 +0000 |
commit | 8c1ab65c0f548d20b7f177bdb736daaf603340e1 (patch) | |
tree | df55b7e75bf43f2bf500845b105afe3ac3a5157e /libc-top-half/musl/arch/wasm32 | |
parent | Initial commit. (diff) | |
download | wasi-libc-upstream/0.0_git20221206.8b7148f.tar.xz wasi-libc-upstream/0.0_git20221206.8b7148f.zip |
Adding upstream version 0.0~git20221206.8b7148f.upstream/0.0_git20221206.8b7148f
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libc-top-half/musl/arch/wasm32')
-rw-r--r-- | libc-top-half/musl/arch/wasm32/atomic_arch.h | 7 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/alltypes.h.in | 58 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/dirent.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/fcntl.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/float.h | 16 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/ioctl.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/limits.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/posix.h | 2 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/reg.h | 2 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/signal.h | 40 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/stat.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/bits/stdint.h | 20 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/fp_arch.h | 25 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/pthread_arch.h | 5 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/reloc.h | 1 | ||||
-rw-r--r-- | libc-top-half/musl/arch/wasm32/syscall_arch.h | 0 |
16 files changed, 181 insertions, 0 deletions
diff --git a/libc-top-half/musl/arch/wasm32/atomic_arch.h b/libc-top-half/musl/arch/wasm32/atomic_arch.h new file mode 100644 index 0000000..dd9428c --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/atomic_arch.h @@ -0,0 +1,7 @@ +#define a_barrier() (__sync_synchronize()) +#define a_cas(p, t, s) (__sync_val_compare_and_swap((p), (t), (s))) +#define a_crash() (__builtin_trap()) +#define a_clz_32 __builtin_clz +#define a_clz_64 __builtin_clzll +#define a_ctz_32 __builtin_ctz +#define a_ctz_64 __builtin_ctzll diff --git a/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in b/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in new file mode 100644 index 0000000..5dcfc9a --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/alltypes.h.in @@ -0,0 +1,58 @@ +#define _Addr long +#define _Int64 long long +#define _Reg long long + +#define __BYTE_ORDER __BYTE_ORDER__ + +#define __LONG_MAX __LONG_MAX__ + +/* + * Rather than define everything ourselves here in the musl layer, for + * WASI, reference the definitions in the lower layers. + */ + +#if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) +#define __need_wchar_t +#include <stddef.h> +#define __DEFINED_wchar_t +#endif + +#if defined(__NEED_wint_t) && !defined(__DEFINED_wint_t) +#define __need_wint_t +#include <stddef.h> +#define __DEFINED_wint_t +#endif + +TYPEDEF float float_t; +TYPEDEF double double_t; + +#if defined(__NEED_max_align_t) && !defined(__DEFINED_max_align_t) +#define __need_max_align_t +#include <stddef.h> +#define __DEFINED_max_align_t +#endif + +#if defined(__NEED_time_t) && !defined(__DEFINED_time_t) +#include <__typedef_time_t.h> +#define __DEFINED_time_t +#endif + +#if defined(__NEED_suseconds_t) && !defined(__DEFINED_suseconds_t) +#include <__typedef_suseconds_t.h> +#define __DEFINED_suseconds_t +#endif + +#if defined(__NEED_clockid_t) && !defined(__DEFINED_clockid_t) +#include <__typedef_clockid_t.h> +#define __DEFINED_clockid_t +#endif + +#if defined(__NEED_sigset_t) && !defined(__DEFINED_sigset_t) +#include <__typedef_sigset_t.h> +#define __DEFINED_sigset_t +#endif + +#if defined(__NEED_clock_t) && !defined(__DEFINED_clock_t) +#include <__typedef_clock_t.h> +#define __DEFINED_clock_t +#endif diff --git a/libc-top-half/musl/arch/wasm32/bits/dirent.h b/libc-top-half/musl/arch/wasm32/bits/dirent.h new file mode 100644 index 0000000..55f2bc9 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/dirent.h @@ -0,0 +1 @@ +#include <__struct_dirent.h> diff --git a/libc-top-half/musl/arch/wasm32/bits/fcntl.h b/libc-top-half/musl/arch/wasm32/bits/fcntl.h new file mode 100644 index 0000000..a2f3341 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/fcntl.h @@ -0,0 +1 @@ +/* Use the WASI libc fcntl implementation bits. */ diff --git a/libc-top-half/musl/arch/wasm32/bits/float.h b/libc-top-half/musl/arch/wasm32/bits/float.h new file mode 100644 index 0000000..719c790 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/float.h @@ -0,0 +1,16 @@ +#define FLT_EVAL_METHOD 0 + +#define LDBL_TRUE_MIN 6.47517511943802511092443895822764655e-4966L +#define LDBL_MIN 3.36210314311209350626267781732175260e-4932L +#define LDBL_MAX 1.18973149535723176508575932662800702e+4932L +#define LDBL_EPSILON 1.92592994438723585305597794258492732e-34L + +#define LDBL_MANT_DIG 113 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MAX_EXP 16384 + +#define LDBL_DIG 33 +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_10_EXP 4932 + +#define DECIMAL_DIG 36 diff --git a/libc-top-half/musl/arch/wasm32/bits/ioctl.h b/libc-top-half/musl/arch/wasm32/bits/ioctl.h new file mode 100644 index 0000000..b4bf7c7 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/ioctl.h @@ -0,0 +1 @@ +/* Use the WASI libc ioctl implementation bits. */ diff --git a/libc-top-half/musl/arch/wasm32/bits/limits.h b/libc-top-half/musl/arch/wasm32/bits/limits.h new file mode 100644 index 0000000..801bc48 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/limits.h @@ -0,0 +1 @@ +#include <__macro_PAGESIZE.h> diff --git a/libc-top-half/musl/arch/wasm32/bits/posix.h b/libc-top-half/musl/arch/wasm32/bits/posix.h new file mode 100644 index 0000000..387a3e4 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/posix.h @@ -0,0 +1,2 @@ +#define _POSIX_V6_ILP32_OFFBIG (1) +#define _POSIX_V7_ILP32_OFFBIG (1) diff --git a/libc-top-half/musl/arch/wasm32/bits/reg.h b/libc-top-half/musl/arch/wasm32/bits/reg.h new file mode 100644 index 0000000..2633f39 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/reg.h @@ -0,0 +1,2 @@ +#undef __WORDSIZE +#define __WORDSIZE 64 diff --git a/libc-top-half/musl/arch/wasm32/bits/signal.h b/libc-top-half/musl/arch/wasm32/bits/signal.h new file mode 100644 index 0000000..77e8d8c --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/signal.h @@ -0,0 +1,40 @@ +#ifdef _WASI_EMULATED_SIGNAL + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGQUIT 3 +#define SIGILL 4 +#define SIGTRAP 5 +#define SIGABRT 6 +#define SIGIOT SIGABRT +#define SIGBUS 7 +#define SIGFPE 8 +#define SIGKILL 9 +#define SIGUSR1 10 +#define SIGSEGV 11 +#define SIGUSR2 12 +#define SIGPIPE 13 +#define SIGALRM 14 +#define SIGTERM 15 +#define SIGSTKFLT 16 +#define SIGCHLD 17 +#define SIGCONT 18 +#define SIGSTOP 19 +#define SIGTSTP 20 +#define SIGTTIN 21 +#define SIGTTOU 22 +#define SIGURG 23 +#define SIGXCPU 24 +#define SIGXFSZ 25 +#define SIGVTALRM 26 +#define SIGPROF 27 +#define SIGWINCH 28 +#define SIGIO 29 +#define SIGPOLL 29 +#define SIGPWR 30 +#define SIGSYS 31 +#define SIGUNUSED SIGSYS + +#define _NSIG 65 + +#endif diff --git a/libc-top-half/musl/arch/wasm32/bits/stat.h b/libc-top-half/musl/arch/wasm32/bits/stat.h new file mode 100644 index 0000000..67a0e72 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/stat.h @@ -0,0 +1 @@ +#include <__struct_stat.h> diff --git a/libc-top-half/musl/arch/wasm32/bits/stdint.h b/libc-top-half/musl/arch/wasm32/bits/stdint.h new file mode 100644 index 0000000..6e7c770 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/bits/stdint.h @@ -0,0 +1,20 @@ +typedef int16_t int_fast16_t; +typedef int32_t int_fast32_t; +typedef uint16_t uint_fast16_t; +typedef uint32_t uint_fast32_t; + +#define INT_FAST16_MIN INT16_MIN +#define INT_FAST32_MIN INT32_MIN + +#define INT_FAST16_MAX INT16_MAX +#define INT_FAST32_MAX INT32_MAX + +#define UINT_FAST16_MAX UINT16_MAX +#define UINT_FAST32_MAX UINT32_MAX + +#define INTPTR_MIN INT32_MIN +#define INTPTR_MAX INT32_MAX +#define UINTPTR_MAX UINT32_MAX +#define PTRDIFF_MIN INT32_MIN +#define PTRDIFF_MAX INT32_MAX +#define SIZE_MAX UINT32_MAX diff --git a/libc-top-half/musl/arch/wasm32/fp_arch.h b/libc-top-half/musl/arch/wasm32/fp_arch.h new file mode 100644 index 0000000..707d512 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/fp_arch.h @@ -0,0 +1,25 @@ +// WebAssembly has no floating-point exceptions or alternate rounding modes, +// so there's no need to prevent expressions from moving or force their +// evaluation. + +#define fp_barrierf fp_barrierf +static inline float fp_barrierf(float x) +{ + return x; +} + +#define fp_barrier fp_barrier +static inline double fp_barrier(double x) +{ + return x; +} + +#define fp_force_evalf fp_force_evalf +static inline void fp_force_evalf(float x) +{ +} + +#define fp_force_eval fp_force_eval +static inline void fp_force_eval(double x) +{ +} diff --git a/libc-top-half/musl/arch/wasm32/pthread_arch.h b/libc-top-half/musl/arch/wasm32/pthread_arch.h new file mode 100644 index 0000000..58e76ab --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/pthread_arch.h @@ -0,0 +1,5 @@ +extern _Thread_local struct __pthread __wasilibc_pthread_self; + +static inline uintptr_t __get_tp() { + return (uintptr_t)&__wasilibc_pthread_self; +} diff --git a/libc-top-half/musl/arch/wasm32/reloc.h b/libc-top-half/musl/arch/wasm32/reloc.h new file mode 100644 index 0000000..91b4840 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/reloc.h @@ -0,0 +1 @@ +#define LDSO_ARCH "wasm32" diff --git a/libc-top-half/musl/arch/wasm32/syscall_arch.h b/libc-top-half/musl/arch/wasm32/syscall_arch.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libc-top-half/musl/arch/wasm32/syscall_arch.h |