Begin work on no_std support.
This adds no_std support to a bunch of things, but more work is needed.
This commit is contained in:
@@ -9,6 +9,8 @@ use cranelift_codegen::Context;
|
||||
use cranelift_entity::{EntityRef, PrimaryMap};
|
||||
use cranelift_wasm::{DefinedFuncIndex, FuncIndex, FuncTranslator};
|
||||
use environ::{get_func_name, ModuleTranslation};
|
||||
use std::string::{String, ToString};
|
||||
use std::vec::Vec;
|
||||
|
||||
/// The result of compiling a WebAssemby module's functions.
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -13,6 +13,8 @@ use cranelift_wasm::{
|
||||
};
|
||||
use module::{DataInitializer, Export, LazyContents, Module, TableElements};
|
||||
use std::mem;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
use vmcontext;
|
||||
|
||||
/// Compute a `ir::ExternalName` for a given wasm function index.
|
||||
|
||||
@@ -3,13 +3,9 @@
|
||||
//! the translation the base addresses of regions of memory that will hold the globals, tables and
|
||||
//! linear memories.
|
||||
|
||||
#![deny(
|
||||
missing_docs,
|
||||
trivial_numeric_casts,
|
||||
unused_extern_crates,
|
||||
unstable_features
|
||||
)]
|
||||
#![deny(missing_docs, trivial_numeric_casts, unused_extern_crates)]
|
||||
#![warn(unused_import_braces)]
|
||||
#![cfg_attr(feature = "std", deny(unstable_features))]
|
||||
#![cfg_attr(
|
||||
feature = "clippy",
|
||||
plugin(clippy(conf_file = "../../clippy.toml"))
|
||||
@@ -31,12 +27,17 @@
|
||||
use_self
|
||||
)
|
||||
)]
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
|
||||
extern crate cranelift_codegen;
|
||||
extern crate cranelift_entity;
|
||||
extern crate cranelift_wasm;
|
||||
#[macro_use]
|
||||
extern crate memoffset;
|
||||
#[cfg(not(feature = "std"))]
|
||||
#[macro_use]
|
||||
extern crate alloc;
|
||||
|
||||
mod compilation;
|
||||
mod environ;
|
||||
@@ -46,3 +47,10 @@ mod vmcontext;
|
||||
pub use compilation::{compile_module, Compilation, Relocation, RelocationTarget, Relocations};
|
||||
pub use environ::{ModuleEnvironment, ModuleTranslation};
|
||||
pub use module::{DataInitializer, Module, TableElements};
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
mod std {
|
||||
pub use alloc::{string, vec};
|
||||
pub use core::*;
|
||||
pub use core::{i32, str, u32};
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ use cranelift_wasm::{
|
||||
TableIndex,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
use std::string::String;
|
||||
use std::vec::Vec;
|
||||
|
||||
/// A WebAssembly table initializer.
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
Reference in New Issue
Block a user