diff --git a/Cargo.lock b/Cargo.lock index 39312b8c57..b5a81b0377 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -528,7 +528,6 @@ version = "0.60.0" dependencies = [ "cranelift-codegen", "cranelift-module", - "goblin", "object", "target-lexicon", ] @@ -1369,18 +1368,15 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "object" -version = "0.17.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea44a4fd660ab0f38434934ca0212e90fbeaaee54126ef20a3451c30c95bafae" +checksum = "e5666bbb90bc4d1e5bdcb26c0afda1822d25928341e9384ab187a9b37ab69e36" dependencies = [ "crc32fast", "flate2", - "goblin", "indexmap", - "parity-wasm", - "scroll", "target-lexicon", - "uuid", + "wasmparser", ] [[package]] @@ -1408,12 +1404,6 @@ dependencies = [ "stable_deref_trait", ] -[[package]] -name = "parity-wasm" -version = "0.41.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc878dac00da22f8f61e7af3157988424567ab01d9920b962ef7dcbd7cd865" - [[package]] name = "paste" version = "0.1.7" @@ -2293,12 +2283,6 @@ dependencies = [ "traitobject", ] -[[package]] -name = "uuid" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" - [[package]] name = "vec_map" version = "0.8.1" @@ -2563,7 +2547,6 @@ dependencies = [ "anyhow", "cfg-if", "gimli", - "goblin", "lazy_static", "libc", "object", diff --git a/cranelift/object/Cargo.toml b/cranelift/object/Cargo.toml index 2bd68f5714..0634d02c53 100644 --- a/cranelift/object/Cargo.toml +++ b/cranelift/object/Cargo.toml @@ -11,9 +11,8 @@ edition = "2018" [dependencies] 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" -goblin = "0.1.0" [dependencies.cranelift-codegen] path = "../codegen" diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index f17d5f1f2c..6191b27695 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -515,7 +515,7 @@ impl ObjectProduct { /// Write the object bytes in memory. #[inline] - pub fn emit(self) -> Result, String> { + pub fn emit(self) -> Result, object::write::Error> { self.object.write() } } @@ -584,7 +584,7 @@ impl RelocSink for ObjectRelocSink { "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, 32, ) @@ -598,7 +598,7 @@ impl RelocSink for ObjectRelocSink { addend += 4; // X86_64_RELOC_TLV has an implicit addend of -4 ( RelocationKind::MachO { - value: goblin::mach::relocation::X86_64_RELOC_TLV, + value: object::macho::X86_64_RELOC_TLV, relative: true, }, RelocationEncoding::Generic, diff --git a/crates/profiling/Cargo.toml b/crates/profiling/Cargo.toml index eca6a0ee03..beee0c867c 100644 --- a/crates/profiling/Cargo.toml +++ b/crates/profiling/Cargo.toml @@ -14,10 +14,9 @@ edition = "2018" anyhow = "1.0" cfg-if = "0.1" gimli = { version = "0.20.0", optional = true } -goblin = { version = "0.1.3", optional = true } lazy_static = "1.4" 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 } serde = { version = "1.0.99", features = ["derive"] } target-lexicon = "0.10.0" @@ -28,4 +27,4 @@ wasmtime-runtime = { path = "../runtime", version = "0.12.0" } maintenance = { status = "actively-developed" } [features] -jitdump = ['goblin', 'object', 'scroll', 'gimli'] +jitdump = ['object', 'scroll', 'gimli'] diff --git a/crates/profiling/src/jitdump_linux.rs b/crates/profiling/src/jitdump_linux.rs index 0b98b77f43..1c9d82a79f 100644 --- a/crates/profiling/src/jitdump_linux.rs +++ b/crates/profiling/src/jitdump_linux.rs @@ -13,7 +13,7 @@ use crate::ProfilingAgent; use anyhow::Result; -use object::Object; +use object::{Object, ObjectSection}; use scroll::{IOwrite, SizeWith, NATIVE}; use serde::{Deserialize, Serialize}; use std::fmt::Debug; @@ -30,11 +30,7 @@ use wasmtime_environ::wasm::DefinedFuncIndex; use wasmtime_environ::Module; use wasmtime_runtime::VMFunctionBody; -#[cfg(target_pointer_width = "64")] -use goblin::elf64 as elf; - -#[cfg(target_pointer_width = "32")] -use goblin::elf32 as elf; +use object::elf; /// Defines jitdump record types #[repr(u32)] @@ -241,10 +237,10 @@ impl State { /// Returns the ELF machine architecture. fn get_e_machine(&self) -> u32 { match target_lexicon::HOST.architecture { - Architecture::X86_64 => elf::header::EM_X86_64 as u32, - Architecture::I686 => elf::header::EM_386 as u32, - Architecture::Arm(_) => elf::header::EM_ARM as u32, - Architecture::Aarch64(_) => elf::header::EM_AARCH64 as u32, + Architecture::X86_64 => elf::EM_X86_64 as u32, + Architecture::I686 => elf::EM_386 as u32, + Architecture::Arm(_) => elf::EM_ARM as u32, + Architecture::Aarch64(_) => elf::EM_AARCH64 as u32, _ => unimplemented!("unrecognized architecture"), } } @@ -386,9 +382,11 @@ impl State { }; let load_section = |id: gimli::SectionId| -> Result> { - Ok(file - .section_data_by_name(id.name()) - .unwrap_or(borrow::Cow::Borrowed(&[][..]))) + if let Some(section) = file.section_by_name(id.name()) { + Ok(section.data()?.into()) + } else { + Ok((&[] as &[u8]).into()) + } }; let load_section_sup = |_| Ok(borrow::Cow::Borrowed(&[][..]));