From d28abad44119fdac9cb3fa0bc086630b5ea49d7d Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 15 Sep 2020 13:24:50 -0400 Subject: [PATCH] Upgrade to target-lexicon 0.11 This allows downstream library users to use `CDataModel` without having to install two different versions of target-lexicon. --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- cranelift/Cargo.toml | 2 +- cranelift/codegen/Cargo.toml | 2 +- cranelift/codegen/src/isa/mod.rs | 6 ++++-- cranelift/filetests/Cargo.toml | 2 +- cranelift/frontend/Cargo.toml | 2 +- cranelift/native/Cargo.toml | 2 +- cranelift/object/Cargo.toml | 2 +- cranelift/object/src/backend.rs | 10 +++++++--- cranelift/reader/Cargo.toml | 2 +- cranelift/simplejit/Cargo.toml | 2 +- cranelift/src/disasm.rs | 4 ++-- cranelift/wasm/Cargo.toml | 2 +- crates/debug/Cargo.toml | 2 +- crates/jit/Cargo.toml | 2 +- crates/obj/Cargo.toml | 2 +- crates/obj/src/builder.rs | 3 ++- crates/profiling/Cargo.toml | 2 +- crates/profiling/src/jitdump_linux.rs | 2 +- crates/test-programs/Cargo.toml | 2 +- crates/wasmtime/Cargo.toml | 2 +- fuzz/Cargo.toml | 2 +- 23 files changed, 35 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 506e5e58e0..f9a5fe067b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2018,9 +2018,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" +checksum = "fe2635952a442a01fd4cb53d98858b5e4bb461b02c0d111f22f31772e3e7a8b2" [[package]] name = "tempfile" diff --git a/Cargo.toml b/Cargo.toml index 610a4bad6c..115398eb70 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ wasi-common = { path = "crates/wasi-common", version = "0.19.0" } structopt = { version = "0.3.5", features = ["color", "suggestions"] } object = { version = "0.21.1", default-features = false, features = ["write"] } anyhow = "1.0.19" -target-lexicon = { version = "0.10.0", default-features = false } +target-lexicon = { version = "0.11.0", default-features = false } pretty_env_logger = "0.4.0" file-per-thread-logger = "0.1.1" wat = "1.0.23" diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml index 74a3155801..209ff9e22e 100644 --- a/cranelift/Cargo.toml +++ b/cranelift/Cargo.toml @@ -34,7 +34,7 @@ log = "0.4.8" term = "0.6.1" capstone = { version = "0.6.0", optional = true } wat = { version = "1.0.18", optional = true } -target-lexicon = { version = "0.10", features = ["std"] } +target-lexicon = { version = "0.11", features = ["std"] } peepmatic-souper = { path = "./peepmatic/crates/souper", version = "0.66.0", optional = true } pretty_env_logger = "0.4.0" rayon = { version = "1", optional = true } diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index d0b7120ee1..351e0dce12 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -17,7 +17,7 @@ cranelift-codegen-shared = { path = "./shared", version = "0.66.0" } cranelift-entity = { path = "../entity", version = "0.66.0" } cranelift-bforest = { path = "../bforest", version = "0.66.0" } hashbrown = { version = "0.7", optional = true } -target-lexicon = "0.10" +target-lexicon = "0.11" log = { version = "0.4.6", default-features = false } serde = { version = "1.0.94", features = ["derive"], optional = true } bincode = { version = "1.2.1", optional = true } diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index 4ac40c06a4..3e16ad471e 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -119,8 +119,10 @@ macro_rules! isa_builder { /// Return a builder that can create a corresponding `TargetIsa`. pub fn lookup(triple: Triple) -> Result { match triple.architecture { - Architecture::Riscv32 | Architecture::Riscv64 => isa_builder!(riscv, "riscv", triple), - Architecture::I386 | Architecture::I586 | Architecture::I686 | Architecture::X86_64 => { + Architecture::Riscv32 { .. } | Architecture::Riscv64 { .. } => { + isa_builder!(riscv, "riscv", triple) + } + Architecture::X86_32 { .. } | Architecture::X86_64 => { if cfg!(feature = "x64") { isa_builder!(x64, "x64", triple) } else { diff --git a/cranelift/filetests/Cargo.toml b/cranelift/filetests/Cargo.toml index b4a3afbd08..2d9ee35894 100644 --- a/cranelift/filetests/Cargo.toml +++ b/cranelift/filetests/Cargo.toml @@ -23,7 +23,7 @@ gimli = { version = "0.21.0", default-features = false, features = ["read"] } log = "0.4.6" memmap = "0.7.0" num_cpus = "1.8.0" -target-lexicon = "0.10" +target-lexicon = "0.11" thiserror = "1.0.15" anyhow = "1.0.32" diff --git a/cranelift/frontend/Cargo.toml b/cranelift/frontend/Cargo.toml index 847b8bae10..e2b94aec7b 100644 --- a/cranelift/frontend/Cargo.toml +++ b/cranelift/frontend/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../codegen", version = "0.66.0", default-features = false } -target-lexicon = "0.10" +target-lexicon = "0.11" log = { version = "0.4.6", default-features = false } hashbrown = { version = "0.7", optional = true } smallvec = { version = "1.0.0" } diff --git a/cranelift/native/Cargo.toml b/cranelift/native/Cargo.toml index 2f1bcf6178..085b07070c 100644 --- a/cranelift/native/Cargo.toml +++ b/cranelift/native/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../codegen", version = "0.66.0", default-features = false } -target-lexicon = "0.10" +target-lexicon = "0.11" [target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies] raw-cpuid = "7.0.3" diff --git a/cranelift/object/Cargo.toml b/cranelift/object/Cargo.toml index f8dd7adce4..1ce571dc53 100644 --- a/cranelift/object/Cargo.toml +++ b/cranelift/object/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" cranelift-module = { path = "../module", version = "0.66.0" } cranelift-codegen = { path = "../codegen", version = "0.66.0", default-features = false, features = ["std"] } object = { version = "0.21.1", default-features = false, features = ["write"] } -target-lexicon = "0.10" +target-lexicon = "0.11" anyhow = "1.0" [badges] diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index 59014b77f4..6521dd0c30 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -57,11 +57,15 @@ impl ObjectBuilder { target_lexicon::BinaryFormat::Unknown => { return Err(ModuleError::Backend(anyhow!("binary format is unknown"))) } + other => { + return Err(ModuleError::Backend(anyhow!( + "binary format {} not recognized", + other + ))) + } }; let architecture = match isa.triple().architecture { - target_lexicon::Architecture::I386 - | target_lexicon::Architecture::I586 - | target_lexicon::Architecture::I686 => object::Architecture::I386, + target_lexicon::Architecture::X86_32(_) => object::Architecture::I386, target_lexicon::Architecture::X86_64 => object::Architecture::X86_64, target_lexicon::Architecture::Arm(_) => object::Architecture::Arm, target_lexicon::Architecture::Aarch64(_) => object::Architecture::Aarch64, diff --git a/cranelift/reader/Cargo.toml b/cranelift/reader/Cargo.toml index 201ec8cc0b..f17581cb51 100644 --- a/cranelift/reader/Cargo.toml +++ b/cranelift/reader/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../codegen", version = "0.66.0" } smallvec = "1.0.0" -target-lexicon = "0.10" +target-lexicon = "0.11" thiserror = "1.0.15" [badges] diff --git a/cranelift/simplejit/Cargo.toml b/cranelift/simplejit/Cargo.toml index 1ed42473c5..999bf9036f 100644 --- a/cranelift/simplejit/Cargo.toml +++ b/cranelift/simplejit/Cargo.toml @@ -16,7 +16,7 @@ cranelift-codegen = { path = "../codegen", version = "0.66.0", default-features region = "2.2.0" libc = { version = "0.2.42" } errno = "0.2.4" -target-lexicon = "0.10" +target-lexicon = "0.11" memmap = { version = "0.7.0", optional = true } [target.'cfg(target_os = "windows")'.dependencies] diff --git a/cranelift/src/disasm.rs b/cranelift/src/disasm.rs index c94beab672..413bafcd39 100644 --- a/cranelift/src/disasm.rs +++ b/cranelift/src/disasm.rs @@ -127,10 +127,10 @@ cfg_if! { fn get_disassembler(isa: &dyn TargetIsa) -> Result { let cs = match isa.triple().architecture { - Architecture::Riscv32 | Architecture::Riscv64 => { + Architecture::Riscv32(_) | Architecture::Riscv64(_) => { anyhow::bail!("No disassembler for RiscV"); } - Architecture::I386 | Architecture::I586 | Architecture::I686 => Capstone::new() + Architecture::X86_32(_) => Capstone::new() .x86() .mode(arch::x86::ArchMode::Mode32) .build()?, diff --git a/cranelift/wasm/Cargo.toml b/cranelift/wasm/Cargo.toml index 5c1b1b4f4e..c5dfb0ade0 100644 --- a/cranelift/wasm/Cargo.toml +++ b/cranelift/wasm/Cargo.toml @@ -23,7 +23,7 @@ thiserror = "1.0.4" [dev-dependencies] wat = "1.0.23" -target-lexicon = "0.10" +target-lexicon = "0.11" # Enable the riscv feature for cranelift-codegen, as some tests require it cranelift-codegen = { path = "../codegen", version = "0.66.0", default-features = false, features = ["riscv"] } diff --git a/crates/debug/Cargo.toml b/crates/debug/Cargo.toml index ffabb62f5a..9a82369ee4 100644 --- a/crates/debug/Cargo.toml +++ b/crates/debug/Cargo.toml @@ -16,7 +16,7 @@ gimli = "0.21.0" wasmparser = "0.59.0" object = { version = "0.21.1", default-features = false, features = ["read", "write"] } wasmtime-environ = { path = "../environ", version = "0.19.0" } -target-lexicon = { version = "0.10.0", default-features = false } +target-lexicon = { version = "0.11.0", default-features = false } anyhow = "1.0" thiserror = "1.0.4" more-asserts = "0.2.1" diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml index 71bb031d3b..5dc1c07ab5 100644 --- a/crates/jit/Cargo.toml +++ b/crates/jit/Cargo.toml @@ -27,7 +27,7 @@ wasmtime-obj = { path = "../obj", version = "0.19.0" } rayon = { version = "1.0", optional = true } region = "2.1.0" thiserror = "1.0.4" -target-lexicon = { version = "0.10.0", default-features = false } +target-lexicon = { version = "0.11.0", default-features = false } wasmparser = "0.59.0" more-asserts = "0.2.1" anyhow = "1.0" diff --git a/crates/obj/Cargo.toml b/crates/obj/Cargo.toml index d29a880333..2b21c13d66 100644 --- a/crates/obj/Cargo.toml +++ b/crates/obj/Cargo.toml @@ -15,7 +15,7 @@ anyhow = "1.0" wasmtime-environ = { path = "../environ", version = "0.19.0" } object = { version = "0.21.1", default-features = false, features = ["write"] } more-asserts = "0.2.1" -target-lexicon = { version = "0.10.0", default-features = false } +target-lexicon = { version = "0.11.0", default-features = false } wasmtime-debug = { path = "../debug", version = "0.19.0" } [badges] diff --git a/crates/obj/src/builder.rs b/crates/obj/src/builder.rs index e9f823b00c..ac83cde67e 100644 --- a/crates/obj/src/builder.rs +++ b/crates/obj/src/builder.rs @@ -98,7 +98,7 @@ fn to_object_architecture( ) -> Result { use target_lexicon::Architecture::*; Ok(match arch { - I386 | I586 | I686 => Architecture::I386, + X86_32(_) => Architecture::I386, X86_64 => Architecture::X86_64, Arm(_) => Architecture::Arm, Aarch64(_) => Architecture::Aarch64, @@ -238,6 +238,7 @@ impl ObjectBuilderTarget { target_lexicon::BinaryFormat::Unknown => { bail!("binary format is unknown"); } + other => bail!("binary format {} is unsupported", other), }; let architecture = to_object_architecture(triple.architecture)?; let endianness = match triple.endianness().unwrap() { diff --git a/crates/profiling/Cargo.toml b/crates/profiling/Cargo.toml index 9bc2f37a70..e9daca5e73 100644 --- a/crates/profiling/Cargo.toml +++ b/crates/profiling/Cargo.toml @@ -18,7 +18,7 @@ lazy_static = "1.4" libc = { version = "0.2.60", default-features = false } scroll = { version = "0.10.1", features = ["derive"], optional = true } serde = { version = "1.0.99", features = ["derive"] } -target-lexicon = "0.10.0" +target-lexicon = "0.11.0" wasmtime-environ = { path = "../environ", version = "0.19.0" } wasmtime-runtime = { path = "../runtime", version = "0.19.0" } ittapi-rs = { version = "0.1.5", optional = true } diff --git a/crates/profiling/src/jitdump_linux.rs b/crates/profiling/src/jitdump_linux.rs index 1c9d82a79f..e16978843f 100644 --- a/crates/profiling/src/jitdump_linux.rs +++ b/crates/profiling/src/jitdump_linux.rs @@ -238,7 +238,7 @@ impl State { fn get_e_machine(&self) -> u32 { match target_lexicon::HOST.architecture { Architecture::X86_64 => elf::EM_X86_64 as u32, - Architecture::I686 => elf::EM_386 as u32, + Architecture::X86_32(_) => elf::EM_386 as u32, Architecture::Arm(_) => elf::EM_ARM as u32, Architecture::Aarch64(_) => elf::EM_AARCH64 as u32, _ => unimplemented!("unrecognized architecture"), diff --git a/crates/test-programs/Cargo.toml b/crates/test-programs/Cargo.toml index 2a528246a8..2eefa94cda 100644 --- a/crates/test-programs/Cargo.toml +++ b/crates/test-programs/Cargo.toml @@ -13,7 +13,7 @@ cfg-if = "0.1.9" wasi-common = { path = "../wasi-common", version = "0.19.0" } wasmtime-wasi = { path = "../wasi", version = "0.19.0" } wasmtime = { path = "../wasmtime", version = "0.19.0" } -target-lexicon = "0.10.0" +target-lexicon = "0.11.0" pretty_env_logger = "0.4.0" tempfile = "3.1.0" os_pipe = "0.9" diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index 83efbb8e12..dc08810d0c 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -16,7 +16,7 @@ wasmtime-jit = { path = "../jit", version = "0.19.0" } wasmtime-cache = { path = "../cache", version = "0.19.0", optional = true } wasmtime-profiling = { path = "../profiling", version = "0.19.0" } wasmparser = "0.59.0" -target-lexicon = { version = "0.10.0", default-features = false } +target-lexicon = { version = "0.11.0", default-features = false } anyhow = "1.0.19" region = "2.2.0" libc = "0.2" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index b192afe70e..62c322e69a 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -13,7 +13,7 @@ cranelift-codegen = { path = "../cranelift/codegen" } cranelift-reader = { path = "../cranelift/reader" } cranelift-wasm = { path = "../cranelift/wasm" } libfuzzer-sys = "0.3.3" -target-lexicon = "0.10" +target-lexicon = "0.11" peepmatic-fuzzing = { path = "../cranelift/peepmatic/crates/fuzzing", optional = true } wasmtime = { path = "../crates/wasmtime" } wasmtime-fuzzing = { path = "../crates/fuzzing" }