diff --git a/src/apis/emscripten/env.rs b/src/apis/emscripten/env.rs index 4db47ed99..9ae2d9de5 100644 --- a/src/apis/emscripten/env.rs +++ b/src/apis/emscripten/env.rs @@ -1,6 +1,6 @@ use super::super::host; /// NOTE: These syscalls only support wasm_32 for now because they take u32 offset -use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t}; +use libc::{c_int}; use std::ffi::CStr; use std::os::raw::c_char; diff --git a/src/apis/emscripten/memory.rs b/src/apis/emscripten/memory.rs index e9a39f96d..e568108b3 100644 --- a/src/apis/emscripten/memory.rs +++ b/src/apis/emscripten/memory.rs @@ -25,7 +25,7 @@ pub extern "C" fn get_total_memory(instance: &mut Instance) -> u32 { } /// emscripten: enlargeMemory -pub extern "C" fn enlarge_memory(instance: &mut Instance) { +pub extern "C" fn enlarge_memory(_instance: &mut Instance) { debug!("emscripten::enlarge_memory"); // instance.memories[0].grow(100); } diff --git a/src/apis/emscripten/mod.rs b/src/apis/emscripten/mod.rs index 121ff9504..54c8a0a24 100644 --- a/src/apis/emscripten/mod.rs +++ b/src/apis/emscripten/mod.rs @@ -10,7 +10,6 @@ mod utils; // SYSCALLS pub use self::utils::is_emscripten_module; -use super::host; pub fn generate_emscripten_env<'a, 'b>() -> ImportObject<&'a str, &'b str> { let mut import_object = ImportObject::new(); diff --git a/src/apis/emscripten/syscalls.rs b/src/apis/emscripten/syscalls.rs index 59c27b794..62c40bf6a 100644 --- a/src/apis/emscripten/syscalls.rs +++ b/src/apis/emscripten/syscalls.rs @@ -1,10 +1,6 @@ /// NOTE: These syscalls only support wasm_32 for now because they take u32 offset /// Syscall list: https://www.cs.utexas.edu/~bismith/test/syscalls/syscalls32.html -use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t, write}; -use std::{mem, ptr}; - -use std::ffi::CStr; -use std::os::raw::c_char; +use libc::{c_int, c_void, ssize_t, write}; use crate::webassembly::Instance; @@ -12,22 +8,22 @@ use crate::webassembly::Instance; macro_rules! vararg { ($name:ident, $type:ident, $instance:ident, $varargs:ident) => ( let ($name, $varargs) = unsafe { + use std::ptr; let ptr = $instance.memory_offset_addr(0, $varargs as usize); let ret = ptr::read(ptr as *const $type); (ret, $varargs + 4) - } + }; ) } /// sys_read -pub extern "C" fn ___syscall3(which: c_int, varargs: c_int, instance: &mut Instance) -> ssize_t { +pub extern "C" fn ___syscall3(_which: c_int, _varargs: c_int, _instance: &mut Instance) -> ssize_t { debug!("emscripten::___syscall3"); 0 } /// sys_write -#[no_mangle] -pub extern "C" fn ___syscall4(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { +pub extern "C" fn ___syscall4(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { debug!("emscripten::___syscall4"); vararg!(fd, i32, instance, varargs); vararg!(buf_ptr, u32, instance, varargs); @@ -38,7 +34,7 @@ pub extern "C" fn ___syscall4(which: c_int, varargs: c_int, instance: &mut Insta } /// sys_open -pub extern "C" fn ___syscall5(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { +pub extern "C" fn ___syscall5(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { debug!("emscripten::___syscall5"); vararg!(pathname, u32, instance, varargs); vararg!(flags, u32, instance, varargs); @@ -48,8 +44,7 @@ pub extern "C" fn ___syscall5(which: c_int, varargs: c_int, instance: &mut Insta } // sys_ioctl -#[no_mangle] -pub extern "C" fn ___syscall54(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { +pub extern "C" fn ___syscall54(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { debug!("emscripten::___syscall54"); vararg!(stream, u32, instance, varargs); vararg!(op, u32, instance, varargs); @@ -58,8 +53,7 @@ pub extern "C" fn ___syscall54(which: c_int, varargs: c_int, instance: &mut Inst } // sys_newuname -#[no_mangle] -pub extern "C" fn ___syscall122(which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { +pub extern "C" fn ___syscall122(_which: c_int, varargs: c_int, instance: &mut Instance) -> c_int { debug!("emscripten::___syscall122"); vararg!(buf, u32, instance, varargs); debug!("buf: {}", buf); diff --git a/src/apis/emscripten/utils.rs b/src/apis/emscripten/utils.rs index e28ab26e2..bbc659a0c 100644 --- a/src/apis/emscripten/utils.rs +++ b/src/apis/emscripten/utils.rs @@ -2,7 +2,7 @@ use crate::webassembly::module::Module; /// We check if a provided module is an Emscripten generated one pub fn is_emscripten_module(module: &Module) -> bool { - for (module, field) in &module.info.imported_funcs { + for (module, _field) in &module.info.imported_funcs { if module == "env" { return true; } diff --git a/src/apis/gcc/.gitignore b/src/apis/gcc/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/apis/host/posix/env.rs b/src/apis/host/posix/env.rs index 00830a796..b0fff8174 100644 --- a/src/apis/host/posix/env.rs +++ b/src/apis/host/posix/env.rs @@ -1,12 +1,7 @@ -/// NOTE: These syscalls only support wasm_32 for now because they take u32 offset -use libc::{c_int, c_void, close, exit, open, read, size_t, ssize_t}; -use std::ffi::CStr; -use std::os::raw::c_char; - use crate::webassembly::Instance; use std::env; -pub extern "C" fn get_env(name: &str, instance: &mut Instance) -> Result { +pub extern "C" fn get_env(name: &str, _instance: &mut Instance) -> Result { debug!("host::get_env({:?})", name); env::var(name) } diff --git a/src/apis/llvm/.gitignore b/src/apis/llvm/.gitignore deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/webassembly/mod.rs b/src/webassembly/mod.rs index c985f1ff0..143eb1c66 100644 --- a/src/webassembly/mod.rs +++ b/src/webassembly/mod.rs @@ -7,7 +7,6 @@ pub mod module; pub mod relocation; pub mod utils; -use cranelift_codegen::isa::TargetIsa; use cranelift_codegen::{isa, settings}; use std::panic; use std::str::FromStr; diff --git a/src/webassembly/module.rs b/src/webassembly/module.rs index f3fc0ea55..6d217c82a 100644 --- a/src/webassembly/module.rs +++ b/src/webassembly/module.rs @@ -43,10 +43,10 @@ pub fn native_pointer_size() -> i32 { } /// Convert a TlsData offset into a `Offset32` for a global decl. -fn offset32(offset: usize) -> ir::immediates::Offset32 { - assert!(offset <= i32::max_value() as usize); - (offset as i32).into() -} +// fn offset32(offset: usize) -> ir::immediates::Offset32 { +// assert!(offset <= i32::max_value() as usize); +// (offset as i32).into() +// } /// Convert a usize offset into a `Imm64` for an iadd_imm. fn imm64(offset: usize) -> ir::immediates::Imm64 {