File tree 7 files changed +2462
-3
lines changed
7 files changed +2462
-3
lines changed Original file line number Diff line number Diff line change 1
1
//! libc - Raw FFI bindings to platforms' system libraries
2
2
#![ crate_name = "libc" ]
3
3
#![ crate_type = "rlib" ]
4
+ #![ feature( c_variadic) ]
5
+ #![ feature( concat_idents) ]
4
6
#![ allow(
5
7
renamed_and_removed_lints, // Keep this order.
6
8
unknown_lints, // Keep this order.
Original file line number Diff line number Diff line change @@ -291,7 +291,8 @@ cfg_if! {
291
291
target_arch = "riscv64" ,
292
292
target_arch = "aarch64" ,
293
293
target_arch = "s390x" ,
294
- target_arch = "loongarch64"
294
+ target_arch = "loongarch64" ,
295
+ target_arch = "wasm32"
295
296
) ) ] {
296
297
pub const FS_IOC_GETFLAGS : Ioctl = 0x80086601 ;
297
298
pub const FS_IOC_SETFLAGS : Ioctl = 0x40086602 ;
Original file line number Diff line number Diff line change @@ -6432,7 +6432,7 @@ extern "C" {
6432
6432
pub fn vhangup ( ) -> c_int ;
6433
6433
pub fn sync ( ) ;
6434
6434
pub fn syncfs ( fd : c_int ) -> c_int ;
6435
- pub fn syscall ( num : c_long , ... ) -> c_long ;
6435
+
6436
6436
pub fn sched_getaffinity (
6437
6437
pid : crate :: pid_t ,
6438
6438
cpusetsize : size_t ,
@@ -6839,6 +6839,23 @@ extern "C" {
6839
6839
pub fn ioctl ( fd : c_int , request : Ioctl , ...) -> c_int ;
6840
6840
}
6841
6841
6842
+ // Syscall libc stub for non-wasm32 (WALI) targets
6843
+ //
6844
+ // For wasm32, all syscalls are name-bound and typed.
6845
+ // The 'syscall' implementation from C library is avoided since
6846
+ // higher level libraries do not explicitly typecast arguments to
6847
+ // 64-bit register sizes, which is expected of C variadic arguments.
6848
+ // To overcome this, a wrapper 'syscall' method is implemented,
6849
+ // which binds the syscall types statically at compile time
6850
+ // and binds their numbers at runtime
6851
+ cfg_if ! (
6852
+ if #[ cfg( not( target_arch = "wasm32" ) ) ] {
6853
+ extern "C" {
6854
+ pub fn syscall( num: c_long, ...) -> c_long;
6855
+ }
6856
+ }
6857
+ ) ;
6858
+
6842
6859
// LFS64 extensions
6843
6860
//
6844
6861
// * 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 @@ -109,6 +109,9 @@ cfg_if! {
109
109
} else if #[ cfg( any( target_arch = "loongarch64" ) ) ] {
110
110
mod loongarch64;
111
111
pub use self :: loongarch64:: * ;
112
+ } else if #[ cfg( any( target_arch = "wasm32" ) ) ] {
113
+ mod wasm32;
114
+ pub use self :: wasm32:: * ;
112
115
} else {
113
116
// Unknown target_arch
114
117
}
You can’t perform that action at this time.
0 commit comments