diff --git a/ChangeLog.md b/ChangeLog.md index a43b714166d62..2e1d037f5970f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -22,7 +22,10 @@ See docs/process.md for more on how version tagging works. ---------------------- - The minimum version of node supported by the generated code was bumped from v12.22.0 to v18.3.0. (#26604) -- The DETERMINISIC settings was marked as deprecated () +- The DETERMINISIC settings was marked as deprecated (#26653) +- Some musl-internal headers are no longer installed into the sysroot include + directory. In particular, `syscall_arch.h` no longer exists, but can be + replaced with `emscripten/syscalls.h`. (#26658) 5.0.5 - 04/03/26 ---------------- diff --git a/system/include/emscripten/syscalls.h b/system/include/emscripten/syscalls.h new file mode 100644 index 0000000000000..218a8bad4281e --- /dev/null +++ b/system/include/emscripten/syscalls.h @@ -0,0 +1,120 @@ +/* + * Copyright 2026 The Emscripten Authors. All rights reserved. + * Emscripten is available under two separate licenses, the MIT license and the + * University of Illinois/NCSA Open Source License. Both these licenses can be + * found in the LICENSE file. + */ + +#pragma once + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int __syscall_chdir(intptr_t path); +int __syscall_mknod(intptr_t path, int mode, int dev); +int __syscall_chmod(intptr_t path, int mode); +int __syscall_getpid(void); +int __syscall_pause(void); +int __syscall_access(intptr_t path, int amode); +int __syscall_sync(void); +int __syscall_rmdir(intptr_t path); +int __syscall_dup(int fd); +int __syscall_acct(intptr_t filename); +int __syscall_ioctl(int fd, int request, ...); +int __syscall_setpgid(int pid, int gpid); +int __syscall_umask(int mask); +int __syscall_getppid(void); +int __syscall_getpgrp(void); +int __syscall_setsid(void); +int __syscall_getrusage(int who, intptr_t usage); +int __syscall_munmap(intptr_t addr, size_t len); +int __syscall_fchmod(int fd, int mode); +int __syscall_getpriority(int which, int who); +int __syscall_setpriority(int which, int who, int prio); +int __syscall_socketcall(int call, intptr_t args); +int __syscall_wait4(int pid, intptr_t wstatus, int options, int rusage); +int __syscall_setdomainname(intptr_t name, size_t size); +int __syscall_uname(intptr_t buf); +int __syscall_mprotect(size_t addr, size_t len, int prot); +int __syscall_getpgid(int pid); +int __syscall_fchdir(int fd); +int __syscall_msync(intptr_t addr, size_t len, int flags); +int __syscall_getsid(int pid); +int __syscall_fdatasync(int fd); +int __syscall_mlock(intptr_t addr, size_t len); +int __syscall_munlock(intptr_t addr, size_t len); +int __syscall_mlockall(int flags); +int __syscall_munlockall(void); +int __syscall_mremap(intptr_t old_addr, size_t old_size, size_t new_size, int flags, intptr_t new_addr); +int __syscall_poll(intptr_t fds, int nfds, int timeout); +int __syscall_getcwd(intptr_t buf, size_t size); +intptr_t __syscall_mmap2(intptr_t addr, size_t len, int prot, int flags, int fd, off_t offset); +int __syscall_truncate64(intptr_t path, off_t length); +int __syscall_ftruncate64(int fd, off_t length); +int __syscall_stat64(intptr_t path, intptr_t buf); +int __syscall_lstat64(intptr_t path, intptr_t buf); +int __syscall_fstat64(int fd, intptr_t buf); +int __syscall_getuid32(void); +int __syscall_getgid32(void); +int __syscall_geteuid32(void); +int __syscall_getegid32(void); +int __syscall_setreuid32(int ruid, int euid); +int __syscall_setregid32(int rgid, int egid); +int __syscall_getgroups32(int size, intptr_t list); +int __syscall_fchown32(int fd, int owner, int group); +int __syscall_setresuid32(int ruid, int euid, int suid); +int __syscall_getresuid32(intptr_t ruid, intptr_t euid, intptr_t suid); +int __syscall_setresgid32(int rgid, int egid, int sgid); +int __syscall_getresgid32(intptr_t rgid, intptr_t egid, intptr_t sgid); +int __syscall_setuid32(int uid); +int __syscall_setgid32(int uid); +int __syscall_mincore(intptr_t addr, size_t length, intptr_t vec); +int __syscall_madvise(intptr_t addr, size_t length, int advice); +int __syscall_getdents64(int fd, intptr_t dirp, size_t count); +int __syscall_fcntl64(int fd, int cmd, ...); +int __syscall_statfs64(intptr_t path, size_t size, intptr_t buf); +int __syscall_fstatfs64(int fd, size_t size, intptr_t buf); +int __syscall_fadvise64(int fd, off_t offset, off_t length, int advice); +int __syscall_openat(int dirfd, intptr_t path, int flags, ...); // mode is optional +int __syscall_mkdirat(int dirfd, intptr_t path, int mode); +int __syscall_mknodat(int dirfd, intptr_t path, int mode, int dev); +int __syscall_fchownat(int dirfd, intptr_t path, int owner, int group, int flags); +int __syscall_newfstatat(int dirfd, intptr_t path, intptr_t buf, int flags); +int __syscall_unlinkat(int dirfd, intptr_t path, int flags); +int __syscall_renameat(int olddirfd, intptr_t oldpath, int newdirfd, intptr_t newpath); +int __syscall_linkat(int olddirfd, intptr_t oldpath, int newdirfd, intptr_t newpath, int flags); +int __syscall_symlinkat(intptr_t target, int newdirfd, intptr_t linkpath); +int __syscall_readlinkat(int dirfd, intptr_t path, intptr_t buf, size_t bufsize); +int __syscall_fchmodat2(int dirfd, intptr_t path, int mode, int flags); +int __syscall_faccessat(int dirfd, intptr_t path, int amode, int flags); +int __syscall_utimensat(int dirfd, intptr_t path, intptr_t times, int flags); +int __syscall_fallocate(int fd, int mode, off_t offset, off_t len); +int __syscall_dup3(int fd, int suggestfd, int flags); +int __syscall_pipe2(intptr_t fds, int flags); +int __syscall_recvmmsg(int sockfd, intptr_t msgvec, size_t vlen, int flags, ...); +int __syscall_prlimit64(int pid, int resource, intptr_t new_limit, intptr_t old_limit); +int __syscall_sendmmsg(int sockfd, intptr_t msgvec, size_t vlen, int flags, ...); +int __syscall_socket(int domain, int type, int protocol, int dummy1, int dummy2, int dummy3); +int __syscall_socketpair(int domain, int type, int protocol, intptr_t fds, int dummy, int dummy2); +int __syscall_bind(int sockfd, intptr_t addr, size_t alen, int dummy, int dummy2, int dummy3); +int __syscall_connect(int sockfd, intptr_t addr, size_t len, int dummy, int dummy2, int dummy3); +int __syscall_listen(int sockfd, int backlog, int dummy1, int dummy2, int dummy3, int dummy4); +int __syscall_accept4(int sockfd, intptr_t addr, intptr_t addrlen, int flags, int dummy1, int dummy2); +int __syscall_getsockopt(int sockfd, int level, int optname, intptr_t optval, intptr_t optlen, int dummy); +int __syscall_setsockopt(int sockfd, int level, int optname, intptr_t optval, size_t optlen, int dummy); +int __syscall_getsockname(int sockfd, intptr_t addr, intptr_t len, int dummy, int dummy2, int dummy3); +int __syscall_getpeername(int sockfd, intptr_t addr, intptr_t len, int dummy, int dummy2, int dummy3); +int __syscall_sendto(int sockfd, intptr_t msg, size_t len, int flags, intptr_t addr, size_t alen); +int __syscall_sendmsg(int sockfd, intptr_t msg , int flags, intptr_t addr, size_t alen, int dummy); +int __syscall_recvfrom(int sockfd, intptr_t msg, size_t len, int flags, intptr_t addr, intptr_t alen); +int __syscall_recvmsg(int sockfd, intptr_t msg, int flags, int dummy, int dummy2, int dummy3); +int __syscall_shutdown(int sockfd, int how, int dummy, int dummy2, int dummy3, int dummy4); + +#ifdef __cplusplus +} +#endif diff --git a/system/lib/libc/emscripten_syscall_stubs.c b/system/lib/libc/emscripten_syscall_stubs.c index 9ba7e411733e1..8aed824b8c572 100644 --- a/system/lib/libc/emscripten_syscall_stubs.c +++ b/system/lib/libc/emscripten_syscall_stubs.c @@ -15,12 +15,12 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include #include diff --git a/system/lib/libc/musl/arch/emscripten/syscall_arch.h b/system/lib/libc/musl/arch/emscripten/syscall_arch.h index e2dd384acd78b..cf9ad1048dc64 100644 --- a/system/lib/libc/musl/arch/emscripten/syscall_arch.h +++ b/system/lib/libc/musl/arch/emscripten/syscall_arch.h @@ -1,117 +1,8 @@ -#include #include #include +#include -// Compile as if we can pass uint64 values directly to the -// host. Binaryen will take care of splitting any i64 params -// into a pair of i32 values if needed. +// Compile as if we can pass uint64 values directly to the host. Binaryen will +// take care of splitting any i64 params into a pair of i32 values if needed. #define __SYSCALL_LL_E(x) (x) #define __SYSCALL_LL_O(x) (x) - -#ifdef __cplusplus -extern "C" { -#endif - -int __syscall_chdir(intptr_t path); -int __syscall_mknod(intptr_t path, int mode, int dev); -int __syscall_chmod(intptr_t path, int mode); -int __syscall_getpid(void); -int __syscall_pause(void); -int __syscall_access(intptr_t path, int amode); -int __syscall_sync(void); -int __syscall_rmdir(intptr_t path); -int __syscall_dup(int fd); -int __syscall_acct(intptr_t filename); -int __syscall_ioctl(int fd, int request, ...); -int __syscall_setpgid(int pid, int gpid); -int __syscall_umask(int mask); -int __syscall_getppid(void); -int __syscall_getpgrp(void); -int __syscall_setsid(void); -int __syscall_getrusage(int who, intptr_t usage); -int __syscall_munmap(intptr_t addr, size_t len); -int __syscall_fchmod(int fd, int mode); -int __syscall_getpriority(int which, int who); -int __syscall_setpriority(int which, int who, int prio); -int __syscall_socketcall(int call, intptr_t args); -int __syscall_wait4(int pid, intptr_t wstatus, int options, int rusage); -int __syscall_setdomainname(intptr_t name, size_t size); -int __syscall_uname(intptr_t buf); -int __syscall_mprotect(size_t addr, size_t len, int prot); -int __syscall_getpgid(int pid); -int __syscall_fchdir(int fd); -int __syscall_msync(intptr_t addr, size_t len, int flags); -int __syscall_getsid(int pid); -int __syscall_fdatasync(int fd); -int __syscall_mlock(intptr_t addr, size_t len); -int __syscall_munlock(intptr_t addr, size_t len); -int __syscall_mlockall(int flags); -int __syscall_munlockall(void); -int __syscall_mremap(intptr_t old_addr, size_t old_size, size_t new_size, int flags, intptr_t new_addr); -int __syscall_poll(intptr_t fds, int nfds, int timeout); -int __syscall_getcwd(intptr_t buf, size_t size); -intptr_t __syscall_mmap2(intptr_t addr, size_t len, int prot, int flags, int fd, off_t offset); -int __syscall_truncate64(intptr_t path, off_t length); -int __syscall_ftruncate64(int fd, off_t length); -int __syscall_stat64(intptr_t path, intptr_t buf); -int __syscall_lstat64(intptr_t path, intptr_t buf); -int __syscall_fstat64(int fd, intptr_t buf); -int __syscall_getuid32(void); -int __syscall_getgid32(void); -int __syscall_geteuid32(void); -int __syscall_getegid32(void); -int __syscall_setreuid32(int ruid, int euid); -int __syscall_setregid32(int rgid, int egid); -int __syscall_getgroups32(int size, intptr_t list); -int __syscall_fchown32(int fd, int owner, int group); -int __syscall_setresuid32(int ruid, int euid, int suid); -int __syscall_getresuid32(intptr_t ruid, intptr_t euid, intptr_t suid); -int __syscall_setresgid32(int rgid, int egid, int sgid); -int __syscall_getresgid32(intptr_t rgid, intptr_t egid, intptr_t sgid); -int __syscall_setuid32(int uid); -int __syscall_setgid32(int uid); -int __syscall_mincore(intptr_t addr, size_t length, intptr_t vec); -int __syscall_madvise(intptr_t addr, size_t length, int advice); -int __syscall_getdents64(int fd, intptr_t dirp, size_t count); -int __syscall_fcntl64(int fd, int cmd, ...); -int __syscall_statfs64(intptr_t path, size_t size, intptr_t buf); -int __syscall_fstatfs64(int fd, size_t size, intptr_t buf); -int __syscall_fadvise64(int fd, off_t offset, off_t length, int advice); -int __syscall_openat(int dirfd, intptr_t path, int flags, ...); // mode is optional -int __syscall_mkdirat(int dirfd, intptr_t path, int mode); -int __syscall_mknodat(int dirfd, intptr_t path, int mode, int dev); -int __syscall_fchownat(int dirfd, intptr_t path, int owner, int group, int flags); -int __syscall_newfstatat(int dirfd, intptr_t path, intptr_t buf, int flags); -int __syscall_unlinkat(int dirfd, intptr_t path, int flags); -int __syscall_renameat(int olddirfd, intptr_t oldpath, int newdirfd, intptr_t newpath); -int __syscall_linkat(int olddirfd, intptr_t oldpath, int newdirfd, intptr_t newpath, int flags); -int __syscall_symlinkat(intptr_t target, int newdirfd, intptr_t linkpath); -int __syscall_readlinkat(int dirfd, intptr_t path, intptr_t buf, size_t bufsize); -int __syscall_fchmodat2(int dirfd, intptr_t path, int mode, int flags); -int __syscall_faccessat(int dirfd, intptr_t path, int amode, int flags); -int __syscall_utimensat(int dirfd, intptr_t path, intptr_t times, int flags); -int __syscall_fallocate(int fd, int mode, off_t offset, off_t len); -int __syscall_dup3(int fd, int suggestfd, int flags); -int __syscall_pipe2(intptr_t fds, int flags); -int __syscall_recvmmsg(int sockfd, intptr_t msgvec, size_t vlen, int flags, ...); -int __syscall_prlimit64(int pid, int resource, intptr_t new_limit, intptr_t old_limit); -int __syscall_sendmmsg(int sockfd, intptr_t msgvec, size_t vlen, int flags, ...); -int __syscall_socket(int domain, int type, int protocol, int dummy1, int dummy2, int dummy3); -int __syscall_socketpair(int domain, int type, int protocol, intptr_t fds, int dummy, int dummy2); -int __syscall_bind(int sockfd, intptr_t addr, size_t alen, int dummy, int dummy2, int dummy3); -int __syscall_connect(int sockfd, intptr_t addr, size_t len, int dummy, int dummy2, int dummy3); -int __syscall_listen(int sockfd, int backlog, int dummy1, int dummy2, int dummy3, int dummy4); -int __syscall_accept4(int sockfd, intptr_t addr, intptr_t addrlen, int flags, int dummy1, int dummy2); -int __syscall_getsockopt(int sockfd, int level, int optname, intptr_t optval, intptr_t optlen, int dummy); -int __syscall_setsockopt(int sockfd, int level, int optname, intptr_t optval, size_t optlen, int dummy); -int __syscall_getsockname(int sockfd, intptr_t addr, intptr_t len, int dummy, int dummy2, int dummy3); -int __syscall_getpeername(int sockfd, intptr_t addr, intptr_t len, int dummy, int dummy2, int dummy3); -int __syscall_sendto(int sockfd, intptr_t msg, size_t len, int flags, intptr_t addr, size_t alen); -int __syscall_sendmsg(int sockfd, intptr_t msg , int flags, intptr_t addr, size_t alen, int dummy); -int __syscall_recvfrom(int sockfd, intptr_t msg, size_t len, int flags, intptr_t addr, intptr_t alen); -int __syscall_recvmsg(int sockfd, intptr_t msg, int flags, int dummy, int dummy2, int dummy3); -int __syscall_shutdown(int sockfd, int how, int dummy, int dummy2, int dummy3, int dummy4); - -#ifdef __cplusplus -} -#endif diff --git a/system/lib/wasmfs/js_api.cpp b/system/lib/wasmfs/js_api.cpp index 48a241768242e..5330b66b4074a 100644 --- a/system/lib/wasmfs/js_api.cpp +++ b/system/lib/wasmfs/js_api.cpp @@ -4,9 +4,9 @@ // found in the LICENSE file. #include -#include #include #include +#include #include "backend.h" #include "file.h" diff --git a/system/lib/wasmfs/syscalls.cpp b/system/lib/wasmfs/syscalls.cpp index 53edc1fa95a8e..0b6acf681b16b 100644 --- a/system/lib/wasmfs/syscalls.cpp +++ b/system/lib/wasmfs/syscalls.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -20,7 +21,6 @@ #include #include #include -#include #include #include #include diff --git a/tools/gen_struct_info.py b/tools/gen_struct_info.py index 3f99e1a555302..35af3a10eb31b 100755 --- a/tools/gen_struct_info.py +++ b/tools/gen_struct_info.py @@ -78,6 +78,8 @@ ] INTERNAL_CFLAGS = [ + '-I' + utils.path_from_root('system/lib/libc/musl/arch/emscripten'), + '-I' + utils.path_from_root('system/lib/libc/musl/arch/generic'), '-I' + utils.path_from_root('system/lib/libc/musl/src/internal'), '-I' + utils.path_from_root('system/lib/libc/musl/src/include'), '-I' + utils.path_from_root('system/lib/pthread/'), diff --git a/tools/system_libs.py b/tools/system_libs.py index 50a22ecc62a26..f2debcd9db20e 100644 --- a/tools/system_libs.py +++ b/tools/system_libs.py @@ -905,6 +905,8 @@ def get_default_variation(cls, **kwargs): class MuslInternalLibrary(Library): includes = [ + 'system/lib/libc/musl/arch/emscripten', + 'system/lib/libc/musl/arch/generic', 'system/lib/libc/musl/src/internal', 'system/lib/libc/musl/src/include', 'system/lib/libc/musl/include', @@ -918,6 +920,7 @@ class MuslInternalLibrary(Library): '-Wno-unused-result', # system call results are often ignored in musl, and in wasi that warns '-Wno-bitwise-op-parentheses', '-Wno-shift-op-parentheses', + '-Wno-constant-conversion', ] @@ -2500,10 +2503,10 @@ def install_system_headers(stamp): 'system/lib/compiler-rt/include': '', 'system/lib/libunwind/include': '', # Copy the generic arch files first then - 'system/lib/libc/musl/arch/generic': '', + 'system/lib/libc/musl/arch/generic/bits': 'bits', # Then overlay the emscripten directory on top. # This mimics how musl itself installs its headers. - 'system/lib/libc/musl/arch/emscripten': '', + 'system/lib/libc/musl/arch/emscripten/bits': 'bits', 'system/lib/libc/musl/include': '', 'system/lib/libcxx/include': 'c++/v1', 'system/lib/libcxxabi/include': 'c++/v1',