Update the object crate to 0.27.0 (#3465)
Mostly just keeping us up to date with changes there since we somewhat heavily rely on it now.
This commit is contained in:
12
Cargo.lock
generated
12
Cargo.lock
generated
@@ -142,9 +142,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "backtrace"
|
name = "backtrace"
|
||||||
version = "0.3.61"
|
version = "0.3.62"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01"
|
checksum = "091bcdf2da9950f96aa522681ce805e6857f6ca8df73833d35736ab2dc78e152"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"addr2line",
|
"addr2line",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -1585,9 +1585,9 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.4.0"
|
version = "2.4.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
|
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memmap2"
|
name = "memmap2"
|
||||||
@@ -1774,9 +1774,9 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.26.0"
|
version = "0.27.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c55827317fb4c08822499848a14237d2874d6f139828893017237e7ab93eb386"
|
checksum = "c821014c18301591b89b843809ef953af9e3df0496c232d5c0611b0a52aac363"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ wasmtime-wasi = { path = "crates/wasi", version = "0.30.0" }
|
|||||||
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.30.0", optional = true }
|
wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.30.0", optional = true }
|
||||||
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.30.0", optional = true }
|
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.30.0", optional = true }
|
||||||
structopt = { version = "0.3.5", features = ["color", "suggestions"] }
|
structopt = { version = "0.3.5", features = ["color", "suggestions"] }
|
||||||
object = { version = "0.26.0", default-features = false, features = ["write"] }
|
object = { version = "0.27.0", default-features = false, features = ["write"] }
|
||||||
anyhow = "1.0.19"
|
anyhow = "1.0.19"
|
||||||
target-lexicon = { version = "0.12.0", default-features = false }
|
target-lexicon = { version = "0.12.0", default-features = false }
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
cranelift-module = { path = "../module", version = "0.77.0" }
|
cranelift-module = { path = "../module", version = "0.77.0" }
|
||||||
cranelift-codegen = { path = "../codegen", version = "0.77.0", default-features = false, features = ["std"] }
|
cranelift-codegen = { path = "../codegen", version = "0.77.0", default-features = false, features = ["std"] }
|
||||||
object = { version = "0.26.0", default-features = false, features = ["write"] }
|
object = { version = "0.27.0", default-features = false, features = ["write"] }
|
||||||
target-lexicon = "0.12"
|
target-lexicon = "0.12"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
log = { version = "0.4.6", default-features = false }
|
log = { version = "0.4.6", default-features = false }
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ impl ObjectBuilder {
|
|||||||
/// See the `ObjectBuilder` for a convenient way to construct `ObjectModule` instances.
|
/// See the `ObjectBuilder` for a convenient way to construct `ObjectModule` instances.
|
||||||
pub struct ObjectModule {
|
pub struct ObjectModule {
|
||||||
isa: Box<dyn TargetIsa>,
|
isa: Box<dyn TargetIsa>,
|
||||||
object: Object,
|
object: Object<'static>,
|
||||||
declarations: ModuleDeclarations,
|
declarations: ModuleDeclarations,
|
||||||
functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
|
functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
|
||||||
data_objects: SecondaryMap<DataId, Option<(SymbolId, bool)>>,
|
data_objects: SecondaryMap<DataId, Option<(SymbolId, bool)>>,
|
||||||
@@ -669,7 +669,7 @@ fn translate_linkage(linkage: Linkage) -> (SymbolScope, bool) {
|
|||||||
/// compilation.
|
/// compilation.
|
||||||
pub struct ObjectProduct {
|
pub struct ObjectProduct {
|
||||||
/// Object artifact with all functions and data from the module defined.
|
/// Object artifact with all functions and data from the module defined.
|
||||||
pub object: Object,
|
pub object: Object<'static>,
|
||||||
/// Symbol IDs for functions (both declared and defined).
|
/// Symbol IDs for functions (both declared and defined).
|
||||||
pub functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
|
pub functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
|
||||||
/// Symbol IDs for data objects (both declared and defined).
|
/// Symbol IDs for data objects (both declared and defined).
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ cranelift-native = { path = '../../cranelift/native', version = '0.77.0' }
|
|||||||
wasmparser = "0.81.0"
|
wasmparser = "0.81.0"
|
||||||
target-lexicon = "0.12"
|
target-lexicon = "0.12"
|
||||||
gimli = { version = "0.25.0", default-features = false, features = ['read', 'std'] }
|
gimli = { version = "0.25.0", default-features = false, features = ['read', 'std'] }
|
||||||
object = { version = "0.26.0", default-features = false, features = ['write'] }
|
object = { version = "0.27.0", default-features = false, features = ['write'] }
|
||||||
more-asserts = "0.2.1"
|
more-asserts = "0.2.1"
|
||||||
thiserror = "1.0.4"
|
thiserror = "1.0.4"
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ impl wasmtime_environ::Compiler for Compiler {
|
|||||||
types: &TypeTables,
|
types: &TypeTables,
|
||||||
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
|
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
|
||||||
emit_dwarf: bool,
|
emit_dwarf: bool,
|
||||||
obj: &mut Object,
|
obj: &mut Object<'static>,
|
||||||
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)> {
|
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)> {
|
||||||
let funcs: crate::CompiledFunctions = funcs
|
let funcs: crate::CompiledFunctions = funcs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
@@ -317,7 +317,7 @@ impl wasmtime_environ::Compiler for Compiler {
|
|||||||
&self,
|
&self,
|
||||||
ty: &WasmFuncType,
|
ty: &WasmFuncType,
|
||||||
host_fn: usize,
|
host_fn: usize,
|
||||||
obj: &mut Object,
|
obj: &mut Object<'static>,
|
||||||
) -> Result<(Trampoline, Trampoline)> {
|
) -> Result<(Trampoline, Trampoline)> {
|
||||||
let host_to_wasm = self.host_to_wasm_trampoline(ty)?;
|
let host_to_wasm = self.host_to_wasm_trampoline(ty)?;
|
||||||
let wasm_to_host = self.wasm_to_host_trampoline(ty, host_fn)?;
|
let wasm_to_host = self.wasm_to_host_trampoline(ty, host_fn)?;
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ pub struct ObjectBuilder<'a> {
|
|||||||
isa: &'a dyn TargetIsa,
|
isa: &'a dyn TargetIsa,
|
||||||
|
|
||||||
/// The object file that we're generating code into.
|
/// The object file that we're generating code into.
|
||||||
obj: &'a mut Object,
|
obj: &'a mut Object<'static>,
|
||||||
|
|
||||||
/// The WebAssembly module we're generating code for.
|
/// The WebAssembly module we're generating code for.
|
||||||
module: &'a Module,
|
module: &'a Module,
|
||||||
@@ -163,7 +163,7 @@ struct RUNTIME_FUNCTION {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ObjectBuilder<'a> {
|
impl<'a> ObjectBuilder<'a> {
|
||||||
pub fn new(obj: &'a mut Object, module: &'a Module, isa: &'a dyn TargetIsa) -> Self {
|
pub fn new(obj: &'a mut Object<'static>, module: &'a Module, isa: &'a dyn TargetIsa) -> Self {
|
||||||
// Entire code (functions and trampolines) will be placed
|
// Entire code (functions and trampolines) will be placed
|
||||||
// in the ".text" section.
|
// in the ".text" section.
|
||||||
let text_section = obj.add_section(
|
let text_section = obj.add_section(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ log = { version = "0.4.8", default-features = false }
|
|||||||
more-asserts = "0.2.1"
|
more-asserts = "0.2.1"
|
||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
gimli = { version = "0.25.0", default-features = false, features = ['read'] }
|
gimli = { version = "0.25.0", default-features = false, features = ['read'] }
|
||||||
object = { version = "0.26.0", default-features = false, features = ['read_core', 'write_core', 'elf'] }
|
object = { version = "0.27.0", default-features = false, features = ['read_core', 'write_core', 'elf'] }
|
||||||
target-lexicon = "0.12"
|
target-lexicon = "0.12"
|
||||||
|
|
||||||
[badges]
|
[badges]
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ pub trait Compiler: Send + Sync {
|
|||||||
types: &TypeTables,
|
types: &TypeTables,
|
||||||
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
|
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
|
||||||
emit_dwarf: bool,
|
emit_dwarf: bool,
|
||||||
obj: &mut Object,
|
obj: &mut Object<'static>,
|
||||||
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)>;
|
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)>;
|
||||||
|
|
||||||
/// Inserts two functions for host-to-wasm and wasm-to-host trampolines into
|
/// Inserts two functions for host-to-wasm and wasm-to-host trampolines into
|
||||||
@@ -186,7 +186,7 @@ pub trait Compiler: Send + Sync {
|
|||||||
&self,
|
&self,
|
||||||
ty: &WasmFuncType,
|
ty: &WasmFuncType,
|
||||||
host_fn: usize,
|
host_fn: usize,
|
||||||
obj: &mut Object,
|
obj: &mut Object<'static>,
|
||||||
) -> Result<(Trampoline, Trampoline)>;
|
) -> Result<(Trampoline, Trampoline)>;
|
||||||
|
|
||||||
/// Creates a new `Object` file which is used to build the results of a
|
/// Creates a new `Object` file which is used to build the results of a
|
||||||
@@ -195,7 +195,7 @@ pub trait Compiler: Send + Sync {
|
|||||||
/// The returned object file will have an appropriate
|
/// The returned object file will have an appropriate
|
||||||
/// architecture/endianness for `self.triple()`, but at this time it is
|
/// architecture/endianness for `self.triple()`, but at this time it is
|
||||||
/// always an ELF file, regardless of target platform.
|
/// always an ELF file, regardless of target platform.
|
||||||
fn object(&self) -> Result<Object> {
|
fn object(&self) -> Result<Object<'static>> {
|
||||||
use target_lexicon::Architecture::*;
|
use target_lexicon::Architecture::*;
|
||||||
|
|
||||||
let triple = self.triple();
|
let triple = self.triple();
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ anyhow = "1.0"
|
|||||||
cfg-if = "1.0"
|
cfg-if = "1.0"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
gimli = { version = "0.25.0", default-features = false, features = ["std", "read"] }
|
gimli = { version = "0.25.0", default-features = false, features = ["std", "read"] }
|
||||||
object = { version = "0.26.0", default-features = false, features = ["std", "read_core", "elf"] }
|
object = { version = "0.27.0", default-features = false, features = ["std", "read_core", "elf"] }
|
||||||
serde = { version = "1.0.94", features = ["derive"] }
|
serde = { version = "1.0.94", features = ["derive"] }
|
||||||
addr2line = { version = "0.16.0", default-features = false }
|
addr2line = { version = "0.16.0", default-features = false }
|
||||||
ittapi-rs = { version = "0.1.5", optional = true }
|
ittapi-rs = { version = "0.1.5", optional = true }
|
||||||
|
|||||||
@@ -195,17 +195,13 @@ impl WritableBuffer for ObjectMmap {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn resize(&mut self, new_len: usize, value: u8) {
|
fn resize(&mut self, new_len: usize) {
|
||||||
|
// Resizing always appends 0 bytes and since new mmaps start out as 0
|
||||||
|
// bytes we don't actually need to do anything as part of this other
|
||||||
|
// than update our own length.
|
||||||
if new_len <= self.len {
|
if new_len <= self.len {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let mmap = self.mmap.as_mut().expect("write before reserve");
|
|
||||||
|
|
||||||
// new mmaps are automatically filled with zeros, so if we're asked to
|
|
||||||
// fill with zeros then we can skip the actual fill step.
|
|
||||||
if value != 0 {
|
|
||||||
mmap[self.len..][..new_len - self.len].fill(value);
|
|
||||||
}
|
|
||||||
self.len = new_len;
|
self.len = new_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ paste = "1.0.3"
|
|||||||
psm = "0.1.11"
|
psm = "0.1.11"
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
rayon = { version = "1.0", optional = true }
|
rayon = { version = "1.0", optional = true }
|
||||||
object = { version = "0.26", default-features = false, features = ['read_core', 'elf'] }
|
object = { version = "0.27", default-features = false, features = ['read_core', 'elf'] }
|
||||||
|
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
winapi = "0.3.7"
|
winapi = "0.3.7"
|
||||||
|
|||||||
Reference in New Issue
Block a user