Update object to 0.18 (#1381)

This commit is contained in:
bjorn3
2020-03-23 14:56:51 +01:00
committed by GitHub
parent 139536828a
commit d54611dac8
5 changed files with 20 additions and 41 deletions

23
Cargo.lock generated
View File

@@ -528,7 +528,6 @@ version = "0.60.0"
dependencies = [ dependencies = [
"cranelift-codegen", "cranelift-codegen",
"cranelift-module", "cranelift-module",
"goblin",
"object", "object",
"target-lexicon", "target-lexicon",
] ]
@@ -1369,18 +1368,15 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a"
[[package]] [[package]]
name = "object" name = "object"
version = "0.17.0" version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea44a4fd660ab0f38434934ca0212e90fbeaaee54126ef20a3451c30c95bafae" checksum = "e5666bbb90bc4d1e5bdcb26c0afda1822d25928341e9384ab187a9b37ab69e36"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"flate2", "flate2",
"goblin",
"indexmap", "indexmap",
"parity-wasm",
"scroll",
"target-lexicon", "target-lexicon",
"uuid", "wasmparser",
] ]
[[package]] [[package]]
@@ -1408,12 +1404,6 @@ dependencies = [
"stable_deref_trait", "stable_deref_trait",
] ]
[[package]]
name = "parity-wasm"
version = "0.41.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865"
[[package]] [[package]]
name = "paste" name = "paste"
version = "0.1.7" version = "0.1.7"
@@ -2293,12 +2283,6 @@ dependencies = [
"traitobject", "traitobject",
] ]
[[package]]
name = "uuid"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11"
[[package]] [[package]]
name = "vec_map" name = "vec_map"
version = "0.8.1" version = "0.8.1"
@@ -2563,7 +2547,6 @@ dependencies = [
"anyhow", "anyhow",
"cfg-if", "cfg-if",
"gimli", "gimli",
"goblin",
"lazy_static", "lazy_static",
"libc", "libc",
"object", "object",

View File

@@ -11,9 +11,8 @@ edition = "2018"
[dependencies] [dependencies]
cranelift-module = { path = "../module", version = "0.60.0" } cranelift-module = { path = "../module", version = "0.60.0" }
object = { version = "0.17", default-features = false, features = ["write"] } object = { version = "0.18", default-features = false, features = ["write"] }
target-lexicon = "0.10" target-lexicon = "0.10"
goblin = "0.1.0"
[dependencies.cranelift-codegen] [dependencies.cranelift-codegen]
path = "../codegen" path = "../codegen"

View File

@@ -515,7 +515,7 @@ impl ObjectProduct {
/// Write the object bytes in memory. /// Write the object bytes in memory.
#[inline] #[inline]
pub fn emit(self) -> Result<Vec<u8>, String> { pub fn emit(self) -> Result<Vec<u8>, object::write::Error> {
self.object.write() self.object.write()
} }
} }
@@ -584,7 +584,7 @@ impl RelocSink for ObjectRelocSink {
"ElfX86_64TlsGd is not supported for this file format" "ElfX86_64TlsGd is not supported for this file format"
); );
( (
RelocationKind::Elf(goblin::elf64::reloc::R_X86_64_TLSGD), RelocationKind::Elf(object::elf::R_X86_64_TLSGD),
RelocationEncoding::Generic, RelocationEncoding::Generic,
32, 32,
) )
@@ -598,7 +598,7 @@ impl RelocSink for ObjectRelocSink {
addend += 4; // X86_64_RELOC_TLV has an implicit addend of -4 addend += 4; // X86_64_RELOC_TLV has an implicit addend of -4
( (
RelocationKind::MachO { RelocationKind::MachO {
value: goblin::mach::relocation::X86_64_RELOC_TLV, value: object::macho::X86_64_RELOC_TLV,
relative: true, relative: true,
}, },
RelocationEncoding::Generic, RelocationEncoding::Generic,

View File

@@ -14,10 +14,9 @@ edition = "2018"
anyhow = "1.0" anyhow = "1.0"
cfg-if = "0.1" cfg-if = "0.1"
gimli = { version = "0.20.0", optional = true } gimli = { version = "0.20.0", optional = true }
goblin = { version = "0.1.3", optional = true }
lazy_static = "1.4" lazy_static = "1.4"
libc = { version = "0.2.60", default-features = false } libc = { version = "0.2.60", default-features = false }
object = { version = "0.17.0", optional = true } object = { version = "0.18.0", optional = true }
scroll = { version = "0.10.1", optional = true } scroll = { version = "0.10.1", optional = true }
serde = { version = "1.0.99", features = ["derive"] } serde = { version = "1.0.99", features = ["derive"] }
target-lexicon = "0.10.0" target-lexicon = "0.10.0"
@@ -28,4 +27,4 @@ wasmtime-runtime = { path = "../runtime", version = "0.12.0" }
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }
[features] [features]
jitdump = ['goblin', 'object', 'scroll', 'gimli'] jitdump = ['object', 'scroll', 'gimli']

View File

@@ -13,7 +13,7 @@
use crate::ProfilingAgent; use crate::ProfilingAgent;
use anyhow::Result; use anyhow::Result;
use object::Object; use object::{Object, ObjectSection};
use scroll::{IOwrite, SizeWith, NATIVE}; use scroll::{IOwrite, SizeWith, NATIVE};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fmt::Debug; use std::fmt::Debug;
@@ -30,11 +30,7 @@ use wasmtime_environ::wasm::DefinedFuncIndex;
use wasmtime_environ::Module; use wasmtime_environ::Module;
use wasmtime_runtime::VMFunctionBody; use wasmtime_runtime::VMFunctionBody;
#[cfg(target_pointer_width = "64")] use object::elf;
use goblin::elf64 as elf;
#[cfg(target_pointer_width = "32")]
use goblin::elf32 as elf;
/// Defines jitdump record types /// Defines jitdump record types
#[repr(u32)] #[repr(u32)]
@@ -241,10 +237,10 @@ impl State {
/// Returns the ELF machine architecture. /// Returns the ELF machine architecture.
fn get_e_machine(&self) -> u32 { fn get_e_machine(&self) -> u32 {
match target_lexicon::HOST.architecture { match target_lexicon::HOST.architecture {
Architecture::X86_64 => elf::header::EM_X86_64 as u32, Architecture::X86_64 => elf::EM_X86_64 as u32,
Architecture::I686 => elf::header::EM_386 as u32, Architecture::I686 => elf::EM_386 as u32,
Architecture::Arm(_) => elf::header::EM_ARM as u32, Architecture::Arm(_) => elf::EM_ARM as u32,
Architecture::Aarch64(_) => elf::header::EM_AARCH64 as u32, Architecture::Aarch64(_) => elf::EM_AARCH64 as u32,
_ => unimplemented!("unrecognized architecture"), _ => unimplemented!("unrecognized architecture"),
} }
} }
@@ -386,9 +382,11 @@ impl State {
}; };
let load_section = |id: gimli::SectionId| -> Result<borrow::Cow<[u8]>> { let load_section = |id: gimli::SectionId| -> Result<borrow::Cow<[u8]>> {
Ok(file if let Some(section) = file.section_by_name(id.name()) {
.section_data_by_name(id.name()) Ok(section.data()?.into())
.unwrap_or(borrow::Cow::Borrowed(&[][..]))) } else {
Ok((&[] as &[u8]).into())
}
}; };
let load_section_sup = |_| Ok(borrow::Cow::Borrowed(&[][..])); let load_section_sup = |_| Ok(borrow::Cow::Borrowed(&[][..]));