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:
Dan Gohman
2018-11-26 04:40:45 -08:00
parent 82c8ef95c4
commit e8201d0f93
10 changed files with 56 additions and 12 deletions

View File

@@ -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};
}