File tree Expand file tree Collapse file tree 7 files changed +2319
-3
lines changed Expand file tree Collapse file tree 7 files changed +2319
-3
lines changed Original file line number Diff line number Diff line change 11//! libc - Raw FFI bindings to platforms' system libraries
22#![ crate_name = "libc" ]
33#![ crate_type = "rlib" ]
4+ #![ feature( c_variadic) ]
5+ #![ feature( concat_idents) ]
46#![ allow(
57 renamed_and_removed_lints, // Keep this order.
68 unknown_lints, // Keep this order.
Original file line number Diff line number Diff line change @@ -231,7 +231,8 @@ cfg_if! {
231231 target_arch = "riscv64" ,
232232 target_arch = "aarch64" ,
233233 target_arch = "s390x" ,
234- target_arch = "loongarch64" ) ) ] {
234+ target_arch = "loongarch64" ,
235+ target_arch = "wasm32" ) ) ] {
235236 pub const FS_IOC_GETFLAGS : :: Ioctl = 0x80086601 ;
236237 pub const FS_IOC_SETFLAGS : :: Ioctl = 0x40086602 ;
237238 pub const FS_IOC_GETVERSION : :: Ioctl = 0x80087601 ;
Original file line number Diff line number Diff line change @@ -5201,7 +5201,7 @@ extern "C" {
52015201 pub fn vhangup ( ) -> :: c_int ;
52025202 pub fn sync ( ) ;
52035203 pub fn syncfs ( fd : :: c_int ) -> :: c_int ;
5204- pub fn syscall ( num : :: c_long , ... ) -> :: c_long ;
5204+
52055205 pub fn sched_getaffinity ( pid : :: pid_t , cpusetsize : :: size_t , cpuset : * mut cpu_set_t )
52065206 -> :: c_int ;
52075207 pub fn sched_setaffinity (
@@ -5622,6 +5622,24 @@ extern "C" {
56225622 ) -> :: ssize_t ;
56235623}
56245624
5625+
5626+ // Syscall libc stub for non Wasm32-WALI targets
5627+ // In wasm32-linux, all syscalls are name-bound and typed.
5628+ // The 'syscall' implementation from C library is avoided since
5629+ // higher level libraries do not explicitly typecast arguments to
5630+ // 64-bit register sizes, which is expected of C variadic arguments.
5631+ // To overcome this, a wrapper 'syscall' method is implemented,
5632+ // which binds the syscall types statically at compile time
5633+ // and binds their numbers at runtime
5634+ cfg_if ! (
5635+ if #[ cfg( not( target_arch = "wasm32" ) ) ] {
5636+ extern "C" {
5637+ pub fn syscall( num: :: c_long, ...) -> :: c_long;
5638+ }
5639+ }
5640+ ) ;
5641+
5642+
56255643// LFS64 extensions
56265644//
56275645// * musl has 64-bit versions only so aliases the LFS64 symbols to the standard ones
Original file line number Diff line number Diff line change @@ -160,6 +160,9 @@ cfg_if! {
160160 } else if #[ cfg( any( target_arch = "loongarch64" ) ) ] {
161161 mod loongarch64;
162162 pub use self :: loongarch64:: * ;
163+ } else if #[ cfg( any( target_arch = "wasm32" ) ) ] {
164+ mod wasm32;
165+ pub use self :: wasm32:: * ;
163166 } else {
164167 // Unknown target_arch
165168 }
You can’t perform that action at this time.
0 commit comments