From 89d741f8aece93feed7ed169c9358eb1e59c23be Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Wed, 4 Sep 2019 12:25:58 -0700 Subject: [PATCH] upgrade to target-lexicon 0.8.0 * the target-lexicon crate no longer has or needs the std feature in cargo, so we can delete all default-features=false, any mentions of its std feature, and the nostd configs in many lib.rs files * the representation of arm architectures has changed, so some case statements needed refactoring --- cranelift/Cargo.toml | 2 +- cranelift/bforest/src/lib.rs | 1 - cranelift/codegen/Cargo.toml | 3 +-- cranelift/codegen/src/isa/arm32/mod.rs | 13 ++++++------- cranelift/codegen/src/isa/call_conv.rs | 1 + cranelift/codegen/src/isa/mod.rs | 11 ++--------- cranelift/codegen/src/lib.rs | 1 - cranelift/entity/src/lib.rs | 1 - cranelift/faerie/Cargo.toml | 2 +- cranelift/frontend/Cargo.toml | 2 +- cranelift/frontend/src/lib.rs | 1 - cranelift/fuzz/Cargo.toml | 2 +- cranelift/module/src/lib.rs | 1 - cranelift/native/Cargo.toml | 4 ++-- cranelift/preopt/src/lib.rs | 1 - cranelift/reader/Cargo.toml | 2 +- cranelift/simplejit/Cargo.toml | 2 +- cranelift/src/disasm.rs | 24 ++++++++++++++---------- cranelift/wasm/Cargo.toml | 2 +- cranelift/wasm/src/lib.rs | 1 - 20 files changed, 33 insertions(+), 44 deletions(-) diff --git a/cranelift/Cargo.toml b/cranelift/Cargo.toml index b59837f27f..d714b67ad1 100644 --- a/cranelift/Cargo.toml +++ b/cranelift/Cargo.toml @@ -38,7 +38,7 @@ serde = "1.0.8" term = "0.6.1" capstone = { version = "0.6.0", optional = true } wabt = { version = "0.9.1", optional = true } -target-lexicon = "0.4.0" +target-lexicon = "0.8.0" pretty_env_logger = "0.3.0" file-per-thread-logger = "0.1.2" indicatif = "0.11.0" diff --git a/cranelift/bforest/src/lib.rs b/cranelift/bforest/src/lib.rs index 7b6beb2599..5d33068b7a 100644 --- a/cranelift/bforest/src/lib.rs +++ b/cranelift/bforest/src/lib.rs @@ -32,7 +32,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(test)] #[cfg(not(feature = "std"))] diff --git a/cranelift/codegen/Cargo.toml b/cranelift/codegen/Cargo.toml index 19351b363c..bd25b25ce3 100644 --- a/cranelift/codegen/Cargo.toml +++ b/cranelift/codegen/Cargo.toml @@ -18,7 +18,7 @@ cranelift-bforest = { path = "../cranelift-bforest", version = "0.41.0", default failure = { version = "0.1.1", default-features = false, features = ["derive"] } failure_derive = { version = "0.1.1", default-features = false } hashmap_core = { version = "0.1.9", optional = true } -target-lexicon = { version = "0.4.0", default-features = false } +target-lexicon = "0.8.0" log = { version = "0.4.6", default-features = false } serde = { version = "1.0.94", features = ["derive"], optional = true } # It is a goal of the cranelift-codegen crate to have minimal external dependencies. @@ -38,7 +38,6 @@ default = ["std"] std = [ "cranelift-entity/std", "cranelift-bforest/std", - "target-lexicon/std", "cranelift-codegen-meta/std" ] diff --git a/cranelift/codegen/src/isa/arm32/mod.rs b/cranelift/codegen/src/isa/arm32/mod.rs index fde3339700..ced1b88767 100644 --- a/cranelift/codegen/src/isa/arm32/mod.rs +++ b/cranelift/codegen/src/isa/arm32/mod.rs @@ -42,14 +42,13 @@ fn isa_constructor( builder: shared_settings::Builder, ) -> Box { let level1 = match triple.architecture { - Architecture::Thumbv6m | Architecture::Thumbv7em | Architecture::Thumbv7m => { - &enc_tables::LEVEL1_T32[..] + Architecture::Arm(arm) => { + if arm.is_thumb() { + &enc_tables::LEVEL1_T32[..] + } else { + &enc_tables::LEVEL1_A32[..] + } } - Architecture::Arm - | Architecture::Armv4t - | Architecture::Armv5te - | Architecture::Armv7 - | Architecture::Armv7s => &enc_tables::LEVEL1_A32[..], _ => panic!(), }; Box::new(Isa { diff --git a/cranelift/codegen/src/isa/call_conv.rs b/cranelift/codegen/src/isa/call_conv.rs index dddd4bbd8a..e834ad2515 100644 --- a/cranelift/codegen/src/isa/call_conv.rs +++ b/cranelift/codegen/src/isa/call_conv.rs @@ -31,6 +31,7 @@ impl CallConv { // uses System V. Ok(CallingConvention::SystemV) | Err(()) => CallConv::SystemV, Ok(CallingConvention::WindowsFastcall) => CallConv::WindowsFastcall, + Ok(unimp) => unimplemented!("calling convention: {:?}", unimp), } } diff --git a/cranelift/codegen/src/isa/mod.rs b/cranelift/codegen/src/isa/mod.rs index 407afc5f39..816e185f81 100644 --- a/cranelift/codegen/src/isa/mod.rs +++ b/cranelift/codegen/src/isa/mod.rs @@ -111,15 +111,8 @@ pub fn lookup(triple: Triple) -> Result { Architecture::I386 | Architecture::I586 | Architecture::I686 | Architecture::X86_64 => { isa_builder!(x86, "x86")(triple) } - Architecture::Thumbv6m - | Architecture::Thumbv7em - | Architecture::Thumbv7m - | Architecture::Arm - | Architecture::Armv4t - | Architecture::Armv5te - | Architecture::Armv7 - | Architecture::Armv7s => isa_builder!(arm32, "arm32")(triple), - Architecture::Aarch64 => isa_builder!(arm64, "arm64")(triple), + Architecture::Arm { .. } => isa_builder!(arm32, "arm32")(triple), + Architecture::Aarch64 { .. } => isa_builder!(arm64, "arm64")(triple), _ => Err(LookupError::Unsupported), } } diff --git a/cranelift/codegen/src/lib.rs b/cranelift/codegen/src/lib.rs index b682ea3867..1e97dfd6e0 100644 --- a/cranelift/codegen/src/lib.rs +++ b/cranelift/codegen/src/lib.rs @@ -41,7 +41,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/entity/src/lib.rs b/cranelift/entity/src/lib.rs index 57287d6c79..aa10264ab8 100644 --- a/cranelift/entity/src/lib.rs +++ b/cranelift/entity/src/lib.rs @@ -51,7 +51,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/faerie/Cargo.toml b/cranelift/faerie/Cargo.toml index ef90f9d45a..15493d7345 100644 --- a/cranelift/faerie/Cargo.toml +++ b/cranelift/faerie/Cargo.toml @@ -15,7 +15,7 @@ cranelift-module = { path = "../cranelift-module", version = "0.41.0" } faerie = "0.10.0" goblin = "0.0.24" failure = "0.1.2" -target-lexicon = "0.4.0" +target-lexicon = "0.8.0" [badges] maintenance = { status = "experimental" } diff --git a/cranelift/frontend/Cargo.toml b/cranelift/frontend/Cargo.toml index 5f9d8dceca..32348e6311 100644 --- a/cranelift/frontend/Cargo.toml +++ b/cranelift/frontend/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../cranelift-codegen", version = "0.41.0", default-features = false } -target-lexicon = { version = "0.4.0", default-features = false } +target-lexicon = "0.8.0" log = { version = "0.4.6", default-features = false } hashmap_core = { version = "0.1.9", optional = true } diff --git a/cranelift/frontend/src/lib.rs b/cranelift/frontend/src/lib.rs index 4cfb49939a..5b426d608f 100644 --- a/cranelift/frontend/src/lib.rs +++ b/cranelift/frontend/src/lib.rs @@ -175,7 +175,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/fuzz/Cargo.toml b/cranelift/fuzz/Cargo.toml index fb46b96311..adde8dce3a 100644 --- a/cranelift/fuzz/Cargo.toml +++ b/cranelift/fuzz/Cargo.toml @@ -15,7 +15,7 @@ libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } cranelift-codegen = { path = "../cranelift-codegen" } cranelift-wasm = { path = "../cranelift-wasm" } cranelift-reader = { path = "../cranelift-reader" } -target-lexicon = "0.4.0" +target-lexicon = "0.8.0" # Prevent this from interfering with workspaces [workspace] diff --git a/cranelift/module/src/lib.rs b/cranelift/module/src/lib.rs index 33d12d96c2..7cb9c10f22 100644 --- a/cranelift/module/src/lib.rs +++ b/cranelift/module/src/lib.rs @@ -19,7 +19,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/native/Cargo.toml b/cranelift/native/Cargo.toml index 0e7028b451..5023efaf5d 100644 --- a/cranelift/native/Cargo.toml +++ b/cranelift/native/Cargo.toml @@ -11,14 +11,14 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../cranelift-codegen", version = "0.41.0", default-features = false } -target-lexicon = { version = "0.4.0", default-features = false } +target-lexicon = "0.8.0" [target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies] raw-cpuid = "6.0.0" [features] default = ["std"] -std = ["cranelift-codegen/std", "target-lexicon/std"] +std = ["cranelift-codegen/std"] # when compiling with the "core" feature, nightly must be enabled # enabling the "nightly" feature for raw-cpuid allows avoiding # linking in a c-library. diff --git a/cranelift/preopt/src/lib.rs b/cranelift/preopt/src/lib.rs index e8cf7be321..c35eea14a2 100644 --- a/cranelift/preopt/src/lib.rs +++ b/cranelift/preopt/src/lib.rs @@ -19,7 +19,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use] diff --git a/cranelift/reader/Cargo.toml b/cranelift/reader/Cargo.toml index 0a86a8af35..2678a91395 100644 --- a/cranelift/reader/Cargo.toml +++ b/cranelift/reader/Cargo.toml @@ -11,7 +11,7 @@ edition = "2018" [dependencies] cranelift-codegen = { path = "../cranelift-codegen", version = "0.41.0" } -target-lexicon = "0.4.0" +target-lexicon = "0.8.0" [badges] maintenance = { status = "experimental" } diff --git a/cranelift/simplejit/Cargo.toml b/cranelift/simplejit/Cargo.toml index ecea5d58fb..3210717c7d 100644 --- a/cranelift/simplejit/Cargo.toml +++ b/cranelift/simplejit/Cargo.toml @@ -16,7 +16,7 @@ cranelift-native = { path = "../cranelift-native", version = "0.41.0" } region = "2.0.0" libc = { version = "0.2.42" } errno = "0.2.4" -target-lexicon = { version = "0.4.0" } +target-lexicon = "0.8.0" 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 7a98e02b0b..9cd6851de7 100644 --- a/cranelift/src/disasm.rs +++ b/cranelift/src/disasm.rs @@ -136,16 +136,20 @@ cfg_if! { .x86() .mode(arch::x86::ArchMode::Mode64) .build(), - Architecture::Arm - | Architecture::Armv4t - | Architecture::Armv5te - | Architecture::Armv7 - | Architecture::Armv7s => Capstone::new().arm().mode(arch::arm::ArchMode::Arm).build(), - Architecture::Thumbv6m | Architecture::Thumbv7em | Architecture::Thumbv7m => Capstone::new( - ).arm() - .mode(arch::arm::ArchMode::Thumb) - .build(), - Architecture::Aarch64 => Capstone::new() + Architecture::Arm(arm) => { + if arm.is_thumb() { + Capstone::new() + .arm() + .mode(arch::arm::ArchMode::Thumb) + .build() + } else { + Capstone::new() + .arm() + .mode(arch::arm::ArchMode::Arm) + .build() + } + } + Architecture::Aarch64 {..} => Capstone::new() .arm64() .mode(arch::arm64::ArchMode::Arm) .build(), diff --git a/cranelift/wasm/Cargo.toml b/cranelift/wasm/Cargo.toml index 8f2346d6a7..18f9b6f4a6 100644 --- a/cranelift/wasm/Cargo.toml +++ b/cranelift/wasm/Cargo.toml @@ -23,7 +23,7 @@ serde = { version = "1.0.94", features = ["derive"], optional = true } [dev-dependencies] wabt = "0.9.1" -target-lexicon = "0.4.0" +target-lexicon = "0.8.0" [features] default = ["std"] diff --git a/cranelift/wasm/src/lib.rs b/cranelift/wasm/src/lib.rs index c4770a68ea..3c1065228b 100644 --- a/cranelift/wasm/src/lib.rs +++ b/cranelift/wasm/src/lib.rs @@ -28,7 +28,6 @@ ) )] #![no_std] -#![cfg_attr(not(feature = "std"), feature(alloc))] #[cfg(not(feature = "std"))] #[macro_use]