Upgrade to target-lexicon 0.11

This allows downstream library users to use `CDataModel` without having
to install two different versions of target-lexicon.
This commit is contained in:
Joshua Nelson
2020-09-15 13:24:50 -04:00
committed by Dan Gohman
parent 379aed8092
commit d28abad441
23 changed files with 35 additions and 28 deletions

View File

@@ -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 }

View File

@@ -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 }

View File

@@ -119,8 +119,10 @@ macro_rules! isa_builder {
/// Return a builder that can create a corresponding `TargetIsa`.
pub fn lookup(triple: Triple) -> Result<Builder, LookupError> {
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 {

View File

@@ -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"

View File

@@ -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" }

View File

@@ -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"

View File

@@ -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]

View File

@@ -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,

View File

@@ -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]

View File

@@ -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]

View File

@@ -127,10 +127,10 @@ cfg_if! {
fn get_disassembler(isa: &dyn TargetIsa) -> Result<Capstone> {
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()?,

View File

@@ -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"] }