Skip to content

Commit

Permalink
Fix source binds for wasm32-linux-musl
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunr2 committed Jul 25, 2024
1 parent 7e10829 commit 996e362
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/arch/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ cfg_if! {
target_arch = "aarch64",
target_arch = "s390x",
target_arch = "loongarch64",
all(target_arch = "wasm32", target_vendor = "wali64")))] {
target_arch = "wasm32"))] {
pub const FS_IOC_GETFLAGS: ::Ioctl = 0x80086601;
pub const FS_IOC_SETFLAGS: ::Ioctl = 0x40086602;
pub const FS_IOC_GETVERSION: ::Ioctl = 0x80087601;
Expand Down
10 changes: 5 additions & 5 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5624,15 +5624,15 @@ extern "C" {


// Syscall libc stub for non Wasm32-WALI targets
// In Wasm32-WALI, all syscalls are name-bound and typed.
// In wasm32-linux, all syscalls are name-bound and typed.
// The 'syscall' implementation from C library is avoided since
// higher level libraries do not explicitly typecast arguments to
// 64-bit register sizes, which is expected of C variadic arguments.
// To overcome this, a wrapper 'syscall' method is implemented in the
// WALI specific module, which binds the syscall types statically
// at compile time and binds their numbers at runtime
// To overcome this, a wrapper 'syscall' method is implemented,
// which binds the syscall types statically at compile time
// and binds their numbers at runtime
cfg_if!(
if #[cfg(not(all(target_arch = "wasm32", target_vendor = "wali64")))] {
if #[cfg(not(target_arch = "wasm32"))] {
extern "C" {
pub fn syscall(num: ::c_long, ...) -> ::c_long;
}
Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/musl/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ cfg_if! {
} else if #[cfg(any(target_arch = "loongarch64"))] {
mod loongarch64;
pub use self::loongarch64::*;
} else if #[cfg(all(target_arch = "wasm32", target_vendor = "wali64"))] {
} else if #[cfg(any(target_arch = "wasm32"))] {
mod wasm32;
pub use self::wasm32::*;
} else {
Expand Down
14 changes: 5 additions & 9 deletions src/unix/linux_like/linux/musl/b64/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -912,13 +912,9 @@ pub const TOSTOP: ::tcflag_t = 0x00000100;
pub const FLUSHO: ::tcflag_t = 0x00001000;


cfg_if! {
if #[cfg(target_vendor = "wali64")] {
/* Aliases to syscall constants */
pub const SYS_fadvise: ::c_long = SYS_fadvise64;

mod syscalls_wali;
pub use self::syscalls_wali::*;
}
}
/* Aliases to syscall constants */
pub const SYS_fadvise: ::c_long = SYS_fadvise64;

/* WebAssembly Linux Interface (WALI) syscall specification */
mod syscalls_wali;
pub use self::syscalls_wali::*;
3 changes: 2 additions & 1 deletion src/unix/linux_like/linux/musl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,8 @@ cfg_if! {
target_arch = "s390x",
target_arch = "riscv64",
target_arch = "loongarch64",
all(target_arch = "wasm32", target_vendor = "wali64")))] {
// wasm32-linux uses the WALI specification with 64-bit struct layout
target_arch = "wasm32"))] {
mod b64;
pub use self::b64::*;
} else if #[cfg(any(target_arch = "x86",
Expand Down

0 comments on commit 996e362

Please sign in to comment.