aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mueller <deso@posteo.net>2019-01-01 18:34:02 -0800
committerDaniel Mueller <deso@posteo.net>2019-01-01 18:34:02 -0800
commit282506f7d1ef1c14cb922d6fde4b2dd52e03affa (patch)
tree7c51b4715f010bd95ba64d87c0cd2cc81199a729
parent097ee0ae905f1c0c09b21b30eafb421392aaef75 (diff)
downloadnitrocli-282506f7d1ef1c14cb922d6fde4b2dd52e03affa.tar.gz
nitrocli-282506f7d1ef1c14cb922d6fde4b2dd52e03affa.tar.bz2
Update cc crate to 1.0.28
This change updates the cc crate to version 1.0.28. Import subrepo cc/:cc at 9490b5ecb43b8b926f96a7e484fa83e39620d8e5
-rw-r--r--cc/.travis.yml1
-rw-r--r--cc/Cargo.toml3
-rw-r--r--cc/src/lib.rs54
-rw-r--r--cc/src/windows_registry.rs81
-rw-r--r--cc/tests/test.rs14
-rw-r--r--nitrocli/CHANGELOG.md1
-rw-r--r--nitrocli/Cargo.lock10
-rw-r--r--nitrocli/Cargo.toml2
8 files changed, 125 insertions, 41 deletions
diff --git a/cc/.travis.yml b/cc/.travis.yml
index 70349e6..47bbfd8 100644
--- a/cc/.travis.yml
+++ b/cc/.travis.yml
@@ -49,7 +49,6 @@ script:
- cargo test --manifest-path cc-test/Cargo.toml --target $TARGET --release $NO_RUN
- cargo doc
- cargo clean && cargo build
- - rustdoc --test README.md -L target/debug -L target/debug/deps
env:
global:
diff --git a/cc/Cargo.toml b/cc/Cargo.toml
index f5004be..3966026 100644
--- a/cc/Cargo.toml
+++ b/cc/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "cc"
-version = "1.0.25"
+version = "1.0.28"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
repository = "https://github.com/alexcrichton/cc-rs"
@@ -14,6 +14,7 @@ code.
keywords = ["build-dependencies"]
readme = "README.md"
categories = ["development-tools"]
+exclude = ["/.travis.yml", "/appveyor.yml"]
[badges]
travis-ci = { repository = "alexcrichton/cc-rs" }
diff --git a/cc/src/lib.rs b/cc/src/lib.rs
index 7672cf4..5eebd07 100644
--- a/cc/src/lib.rs
+++ b/cc/src/lib.rs
@@ -55,6 +55,7 @@
#![doc(html_root_url = "https://docs.rs/cc/1.0")]
#![cfg_attr(test, deny(warnings))]
+#![allow(deprecated)]
#![deny(missing_docs)]
#[cfg(feature = "parallel")]
@@ -112,6 +113,7 @@ pub struct Build {
archiver: Option<PathBuf>,
cargo_metadata: bool,
pic: Option<bool>,
+ use_plt: Option<bool>,
static_crt: Option<bool>,
shared_flag: Option<bool>,
static_flag: Option<bool>,
@@ -319,6 +321,7 @@ impl Build {
archiver: None,
cargo_metadata: true,
pic: None,
+ use_plt: None,
static_crt: None,
warnings: None,
extra_warnings: None,
@@ -822,6 +825,21 @@ impl Build {
self
}
+ /// Configures whether the Procedure Linkage Table is used for indirect
+ /// calls into shared libraries.
+ ///
+ /// The PLT is used to provide features like lazy binding, but introduces
+ /// a small performance loss due to extra pointer indirection. Setting
+ /// `use_plt` to `false` can provide a small performance increase.
+ ///
+ /// Note that skipping the PLT requires a recent version of GCC/Clang.
+ ///
+ /// This only applies to ELF targets. It has no effect on other platforms.
+ pub fn use_plt(&mut self, use_plt: bool) -> &mut Build {
+ self.use_plt = Some(use_plt);
+ self
+ }
+
/// Configures whether the /MT flag or the /MD flag will be passed to msvc build tools.
///
/// This option defaults to `false`, and affect only msvc targets.
@@ -1123,6 +1141,11 @@ impl Build {
}
if self.pic.unwrap_or(!target.contains("windows-gnu")) {
cmd.push_cc_arg("-fPIC".into());
+ // PLT only applies if code is compiled with PIC support,
+ // and only for ELF targets.
+ if target.contains("linux") && !self.use_plt.unwrap_or(true) {
+ cmd.push_cc_arg("-fno-plt".into());
+ }
}
}
}
@@ -1159,6 +1182,19 @@ impl Build {
cmd.args.push("/ARCH:IA32".into());
}
}
+
+ // There is a check in corecrt.h that will generate a
+ // compilation error if
+ // _ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE is
+ // not defined to 1. The check was added in Windows
+ // 8 days because only store apps were allowed on ARM.
+ // This changed with the release of Windows 10 IoT Core.
+ // The check will be going away in future versions of
+ // the SDK, but for all released versions of the
+ // Windows SDK it is required.
+ if target.contains("arm") || target.contains("thumb") {
+ cmd.args.push("/D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1".into());
+ }
}
ToolFamily::Gnu => {
if target.contains("i686") || target.contains("i586") {
@@ -1214,6 +1250,11 @@ impl Build {
if target.starts_with("arm-unknown-linux-") {
cmd.args.push("-march=armv6".into());
cmd.args.push("-marm".into());
+ if target.ends_with("hf") {
+ cmd.args.push("-mfpu=vfp".into());
+ } else {
+ cmd.args.push("-mfloat-abi=soft".into());
+ }
}
// We can guarantee some settings for FRC
@@ -1264,6 +1305,16 @@ impl Build {
if target.starts_with("thumbv7m") {
cmd.args.push("-march=armv7-m".into());
}
+ if target.starts_with("thumbv8m.base") {
+ cmd.args.push("-march=armv8-m.base".into());
+ }
+ if target.starts_with("thumbv8m.main") {
+ cmd.args.push("-march=armv8-m.main".into());
+
+ if target.ends_with("eabihf") {
+ cmd.args.push("-mfpu=fpv5-sp-d16".into())
+ }
+ }
if target.starts_with("armebv7r") | target.starts_with("armv7r") {
if target.starts_with("armeb") {
cmd.args.push("-mbig-endian".into());
@@ -1718,6 +1769,9 @@ impl Build {
"thumbv7em-none-eabi" => Some("arm-none-eabi"),
"thumbv7em-none-eabihf" => Some("arm-none-eabi"),
"thumbv7m-none-eabi" => Some("arm-none-eabi"),
+ "thumbv8m.base-none-eabi" => Some("arm-none-eabi"),
+ "thumbv8m.main-none-eabi" => Some("arm-none-eabi"),
+ "thumbv8m.main-none-eabihf" => Some("arm-none-eabi"),
"x86_64-pc-windows-gnu" => Some("x86_64-w64-mingw32"),
"x86_64-rumprun-netbsd" => Some("x86_64-rumprun-netbsd"),
"x86_64-unknown-linux-musl" => Some("musl"),
diff --git a/cc/src/windows_registry.rs b/cc/src/windows_registry.rs
index bbcbb09..ca6b989 100644
--- a/cc/src/windows_registry.rs
+++ b/cc/src/windows_registry.rs
@@ -174,7 +174,7 @@ mod impl_ {
use std::io::Read;
use registry::{RegistryKey, LOCAL_MACHINE};
use com;
- use setup_config::{SetupConfiguration, SetupInstance};
+ use setup_config::{EnumSetupInstances, SetupConfiguration, SetupInstance};
use Tool;
@@ -217,11 +217,15 @@ mod impl_ {
// Note that much of this logic can be found [online] wrt paths, COM, etc.
//
// [online]: https://blogs.msdn.microsoft.com/vcblog/2017/03/06/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
- pub fn find_msvc_15(tool: &str, target: &str) -> Option<Tool> {
+ fn vs15_instances() -> Option<EnumSetupInstances> {
otry!(com::initialize().ok());
let config = otry!(SetupConfiguration::new().ok());
- let iter = otry!(config.enum_all_instances().ok());
+ config.enum_all_instances().ok()
+ }
+
+ pub fn find_msvc_15(tool: &str, target: &str) -> Option<Tool> {
+ let iter = otry!(vs15_instances());
for instance in iter {
let instance = otry!(instance.ok());
let tool = tool_from_vs15_instance(tool, target, &instance);
@@ -233,6 +237,44 @@ mod impl_ {
None
}
+ // While the paths to Visual Studio 2017's devenv and MSBuild could
+ // potentially be retrieved from the registry, finding them via
+ // SetupConfiguration has shown to be [more reliable], and is preferred
+ // according to Microsoft. To help head off potential regressions though,
+ // we keep the registry method as a fallback option.
+ //
+ // [more reliable]: https://github.com/alexcrichton/cc-rs/pull/331
+ fn find_tool_in_vs15_path(tool: &str, target: &str) -> Option<Tool> {
+ let mut path = match vs15_instances() {
+ Some(instances) => instances
+ .filter_map(|instance| {
+ instance
+ .ok()
+ .and_then(|instance| instance.installation_path().ok())
+ }).map(|path| PathBuf::from(path).join(tool))
+ .find(|ref path| path.is_file()),
+ None => None,
+ };
+
+ if path.is_none() {
+ let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
+ path = LOCAL_MACHINE
+ .open(key.as_ref())
+ .ok()
+ .and_then(|key| key.query_str("15.0").ok())
+ .map(|path| PathBuf::from(path).join(tool))
+ .filter(|ref path| path.is_file());
+ }
+
+ path.map(|path| {
+ let mut tool = Tool::new(path);
+ if target.contains("x86_64") {
+ tool.env.push(("Platform".into(), "X64".into()));
+ }
+ tool
+ })
+ }
+
fn tool_from_vs15_instance(tool: &str, target: &str, instance: &SetupInstance) -> Option<Tool> {
let (bin_path, host_dylib_path, lib_path, include_path) =
otry!(vs15_vc_paths(target, instance));
@@ -595,7 +637,7 @@ mod impl_ {
for subkey in key.iter().filter_map(|k| k.ok()) {
let val = subkey
.to_str()
- .and_then(|s| s.trim_left_matches("v").replace(".", "").parse().ok());
+ .and_then(|s| s.trim_start_matches("v").replace(".", "").parse().ok());
let val = match val {
Some(s) => s,
None => continue,
@@ -631,19 +673,7 @@ mod impl_ {
}
fn find_devenv_vs15(target: &str) -> Option<Tool> {
- let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
- LOCAL_MACHINE
- .open(key.as_ref())
- .ok()
- .and_then(|key| key.query_str("15.0").ok())
- .map(|path| {
- let path = PathBuf::from(path).join(r"Common7\IDE\devenv.exe");
- let mut tool = Tool::new(path);
- if target.contains("x86_64") {
- tool.env.push(("Platform".into(), "X64".into()));
- }
- tool
- })
+ find_tool_in_vs15_path(r"Common7\IDE\devenv.exe", target)
}
// see http://stackoverflow.com/questions/328017/path-to-msbuild
@@ -657,22 +687,7 @@ mod impl_ {
}
fn find_msbuild_vs15(target: &str) -> Option<Tool> {
- // Seems like this could also go through SetupConfiguration,
- // or that find_msvc_15 could just use this registry key
- // instead of the COM interface.
- let key = r"SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7";
- LOCAL_MACHINE
- .open(key.as_ref())
- .ok()
- .and_then(|key| key.query_str("15.0").ok())
- .map(|path| {
- let path = PathBuf::from(path).join(r"MSBuild\15.0\Bin\MSBuild.exe");
- let mut tool = Tool::new(path);
- if target.contains("x86_64") {
- tool.env.push(("Platform".into(), "X64".into()));
- }
- tool
- })
+ find_tool_in_vs15_path(r"MSBuild\15.0\Bin\MSBuild.exe", target)
}
fn find_old_msbuild(target: &str) -> Option<Tool> {
diff --git a/cc/tests/test.rs b/cc/tests/test.rs
index 820072f..573a99a 100644
--- a/cc/tests/test.rs
+++ b/cc/tests/test.rs
@@ -198,6 +198,20 @@ fn gnu_i686_pic() {
}
#[test]
+fn gnu_x86_64_no_plt() {
+ let target = "x86_64-unknown-linux-gnu";
+ let test = Test::gnu();
+ test.gcc()
+ .pic(true)
+ .use_plt(false)
+ .target(&target)
+ .host(&target)
+ .file("foo.c")
+ .compile("foo");
+ test.cmd(0).must_have("-fno-plt");
+}
+
+#[test]
fn gnu_set_stdlib() {
let test = Test::gnu();
test.gcc()
diff --git a/nitrocli/CHANGELOG.md b/nitrocli/CHANGELOG.md
index 09ac0eb..da08209 100644
--- a/nitrocli/CHANGELOG.md
+++ b/nitrocli/CHANGELOG.md
@@ -3,6 +3,7 @@ Unreleased
- Added the `pws` command for accessing the password safe
- Added the `lock` command for locking the Nitrokey device
- Adjusted release build compile options to optimize binary for size
+- Bumped `cc` dependency to `1.0.28`
0.2.0
diff --git a/nitrocli/Cargo.lock b/nitrocli/Cargo.lock
index c663754..09775f8 100644
--- a/nitrocli/Cargo.lock
+++ b/nitrocli/Cargo.lock
@@ -9,13 +9,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "cc"
-version = "1.0.25"
+version = "1.0.28"
[[package]]
name = "cc"
-version = "1.0.25"
+version = "1.0.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
-replace = "cc 1.0.25"
+replace = "cc 1.0.28"
[[package]]
name = "fuchsia-zircon"
@@ -62,7 +62,7 @@ dependencies = [
name = "nitrokey-sys"
version = "3.4.1"
dependencies = [
- "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -107,7 +107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[metadata]
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
-"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
+"checksum cc 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a8b715cb4597106ea87c7c84b2f1d452c7492033765df7f32651e66fcf749"
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum libc 0.2.45 (registry+https://github.com/rust-lang/crates.io-index)" = "2d2857ec59fadc0773853c664d2d18e7198e83883e7060b63c924cb077bd5c74"
diff --git a/nitrocli/Cargo.toml b/nitrocli/Cargo.toml
index 9a692e4..fc97e20 100644
--- a/nitrocli/Cargo.toml
+++ b/nitrocli/Cargo.toml
@@ -51,7 +51,7 @@ path = "../nitrokey"
[replace]
-"cc:1.0.25" = { path = "../cc" }
+"cc:1.0.28" = { path = "../cc" }
"libc:0.2.45" = { path = "../libc" }
"nitrokey-sys:3.4.1" = { path = "../nitrokey-sys" }
"rand:0.4.3" = { path = "../rand" }