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:
Alex Crichton
2021-10-20 10:52:06 -05:00
committed by GitHub
parent fe4b15c8b0
commit e2a724ce18
12 changed files with 25 additions and 29 deletions

12
Cargo.lock generated
View File

@@ -142,9 +142,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "backtrace"
version = "0.3.61"
version = "0.3.62"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01"
checksum = "091bcdf2da9950f96aa522681ce805e6857f6ca8df73833d35736ab2dc78e152"
dependencies = [
"addr2line",
"cc",
@@ -1585,9 +1585,9 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4"
[[package]]
name = "memchr"
version = "2.4.0"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memmap2"
@@ -1774,9 +1774,9 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"
[[package]]
name = "object"
version = "0.26.0"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c55827317fb4c08822499848a14237d2874d6f139828893017237e7ab93eb386"
checksum = "c821014c18301591b89b843809ef953af9e3df0496c232d5c0611b0a52aac363"
dependencies = [
"crc32fast",
"indexmap",

View File

@@ -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-nn = { path = "crates/wasi-nn", version = "0.30.0", optional = true }
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"
target-lexicon = { version = "0.12.0", default-features = false }
pretty_env_logger = "0.4.0"

View File

@@ -12,7 +12,7 @@ edition = "2018"
[dependencies]
cranelift-module = { path = "../module", version = "0.77.0" }
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"
anyhow = "1.0"
log = { version = "0.4.6", default-features = false }

View File

@@ -114,7 +114,7 @@ impl ObjectBuilder {
/// See the `ObjectBuilder` for a convenient way to construct `ObjectModule` instances.
pub struct ObjectModule {
isa: Box<dyn TargetIsa>,
object: Object,
object: Object<'static>,
declarations: ModuleDeclarations,
functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
data_objects: SecondaryMap<DataId, Option<(SymbolId, bool)>>,
@@ -669,7 +669,7 @@ fn translate_linkage(linkage: Linkage) -> (SymbolScope, bool) {
/// compilation.
pub struct ObjectProduct {
/// 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).
pub functions: SecondaryMap<FuncId, Option<(SymbolId, bool)>>,
/// Symbol IDs for data objects (both declared and defined).

View File

@@ -22,7 +22,7 @@ cranelift-native = { path = '../../cranelift/native', version = '0.77.0' }
wasmparser = "0.81.0"
target-lexicon = "0.12"
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"
thiserror = "1.0.4"

View File

@@ -222,7 +222,7 @@ impl wasmtime_environ::Compiler for Compiler {
types: &TypeTables,
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
emit_dwarf: bool,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)> {
let funcs: crate::CompiledFunctions = funcs
.into_iter()
@@ -317,7 +317,7 @@ impl wasmtime_environ::Compiler for Compiler {
&self,
ty: &WasmFuncType,
host_fn: usize,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(Trampoline, Trampoline)> {
let host_to_wasm = self.host_to_wasm_trampoline(ty)?;
let wasm_to_host = self.wasm_to_host_trampoline(ty, host_fn)?;

View File

@@ -105,7 +105,7 @@ pub struct ObjectBuilder<'a> {
isa: &'a dyn TargetIsa,
/// 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.
module: &'a Module,
@@ -163,7 +163,7 @@ struct RUNTIME_FUNCTION {
}
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
// in the ".text" section.
let text_section = obj.add_section(

View File

@@ -22,7 +22,7 @@ log = { version = "0.4.8", default-features = false }
more-asserts = "0.2.1"
cfg-if = "1.0"
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"
[badges]

View File

@@ -172,7 +172,7 @@ pub trait Compiler: Send + Sync {
types: &TypeTables,
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
emit_dwarf: bool,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)>;
/// Inserts two functions for host-to-wasm and wasm-to-host trampolines into
@@ -186,7 +186,7 @@ pub trait Compiler: Send + Sync {
&self,
ty: &WasmFuncType,
host_fn: usize,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(Trampoline, Trampoline)>;
/// 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
/// architecture/endianness for `self.triple()`, but at this time it is
/// always an ELF file, regardless of target platform.
fn object(&self) -> Result<Object> {
fn object(&self) -> Result<Object<'static>> {
use target_lexicon::Architecture::*;
let triple = self.triple();

View File

@@ -22,7 +22,7 @@ anyhow = "1.0"
cfg-if = "1.0"
log = "0.4"
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"] }
addr2line = { version = "0.16.0", default-features = false }
ittapi-rs = { version = "0.1.5", optional = true }

View File

@@ -195,17 +195,13 @@ impl WritableBuffer for ObjectMmap {
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 {
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;
}

View File

@@ -37,7 +37,7 @@ paste = "1.0.3"
psm = "0.1.11"
lazy_static = "1.4"
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]
winapi = "0.3.7"