You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

cc

Package Overview
Dependencies
Maintainers
0
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cc - cargo Package Compare versions

Comparing version
1.2.10
to
1.2.11
+1
-1
.cargo_vcs_info.json
{
"git": {
"sha1": "48416a2d3fd6a4cc29e2dd04787e480de26788d2"
"sha1": "81929fa24da905e6a9064779b42a98e56904da5a"
},
"path_in_vcs": ""
}

@@ -13,3 +13,3 @@ # This file is automatically @generated by Cargo.

name = "cc"
version = "1.2.10"
version = "1.2.11"
dependencies = [

@@ -46,5 +46,5 @@ "jobserver",

name = "getrandom"
version = "0.2.15"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7"
checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8"
dependencies = [

@@ -54,2 +54,3 @@ "cfg-if",

"wasi",
"windows-targets",
]

@@ -86,5 +87,5 @@

name = "rustix"
version = "0.38.43"
version = "0.38.44"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6"
checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154"
dependencies = [

@@ -106,5 +107,5 @@ "bitflags",

name = "tempfile"
version = "3.15.0"
version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704"
checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91"
dependencies = [

@@ -121,5 +122,8 @@ "cfg-if",

name = "wasi"
version = "0.11.0+wasi-snapshot-preview1"
version = "0.13.3+wasi-0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2"
dependencies = [
"wit-bindgen-rt",
]

@@ -198,1 +202,10 @@ [[package]]

checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
[[package]]
name = "wit-bindgen-rt"
version = "0.33.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c"
dependencies = [
"bitflags",
]

@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "cc"
version = "1.2.10"
version = "1.2.11"
authors = ["Alex Crichton <alex@alexcrichton.com>"]

@@ -19,0 +19,0 @@ build = false

@@ -9,2 +9,12 @@ # Changelog

## [1.2.11](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.10...cc-v1.2.11) - 2025-01-31
### Other
- Fix more flag inheritance ([#1380](https://github.com/rust-lang/cc-rs/pull/1380))
- Include wrapper args. in `stdout` family heuristics to restore classifying `clang --driver-mode=cl` as `Msvc { clang_cl: true }` ([#1378](https://github.com/rust-lang/cc-rs/pull/1378))
- Constrain `-Clto` and `-Cembed-bitcode` flag inheritance to be `clang`-only ([#1379](https://github.com/rust-lang/cc-rs/pull/1379))
- Pass deployment target with `-m*-version-min=` ([#1339](https://github.com/rust-lang/cc-rs/pull/1339))
- Regenerate target info ([#1376](https://github.com/rust-lang/cc-rs/pull/1376))
## [1.2.10](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.9...cc-v1.2.10) - 2025-01-17

@@ -11,0 +21,0 @@

@@ -19,3 +19,2 @@ use crate::target::TargetInfo;

force_frame_pointers: Option<bool>,
link_dead_code: Option<bool>,
no_redzone: Option<bool>,

@@ -142,4 +141,2 @@ soft_float: Option<bool>,

}
// https://doc.rust-lang.org/rustc/codegen-options/index.html#link-dead-code
"-Clink-dead-code" => self.link_dead_code = value.map_or(Some(true), arg_to_bool),
// https://doc.rust-lang.org/rustc/codegen-options/index.html#no-redzone

@@ -185,2 +182,5 @@ "-Cno-redzone" => self.no_redzone = value.map_or(Some(true), arg_to_bool),

// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mbranch-protection
// https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html#index-mbranch-protection (Aarch64)
// https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mbranch-protection-1 (ARM)
// https://developer.arm.com/documentation/101754/0619/armclang-Reference/armclang-Command-line-Options/-mbranch-protection
if let Some(value) = self.branch_protection {

@@ -192,2 +192,4 @@ push_if_supported(

// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mcmodel
// https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html (several archs, search for `-mcmodel=`).
// FIXME(madsmtm): Parse the model, to make sure we pass the correct value (depending on arch).
if let Some(value) = self.code_model {

@@ -197,2 +199,3 @@ push_if_supported(format!("-mcmodel={value}").into());

// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-vectorize
// https://gcc.gnu.org/onlinedocs/gnat_ugn/Vectorization-of-loops.html
if self.no_vectorize_loops {

@@ -202,35 +205,16 @@ push_if_supported("-fno-vectorize".into());

// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-slp-vectorize
// https://gcc.gnu.org/onlinedocs/gnat_ugn/Vectorization-of-loops.html
if self.no_vectorize_slp {
push_if_supported("-fno-slp-vectorize".into());
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mguard
if let Some(value) = self.control_flow_guard {
let cc_val = match value {
"y" | "yes" | "on" | "true" | "checks" => Some("cf"),
"nochecks" => Some("cf-nochecks"),
"n" | "no" | "off" | "false" => Some("none"),
_ => None,
};
if let Some(cc_val) = cc_val {
push_if_supported(format!("-mguard={cc_val}").into());
}
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
if let Some(value) = self.lto {
let cc_val = match value {
"y" | "yes" | "on" | "true" | "fat" => Some("full"),
"thin" => Some("thin"),
_ => None,
};
if let Some(cc_val) = cc_val {
push_if_supported(format!("-flto={cc_val}").into());
}
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIC
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIE
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mdynamic-no-pic
if let Some(value) = self.relocation_model {
let cc_flag = match value {
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIC
// https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fPIC
"pic" => Some("-fPIC"),
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fPIE
// https://gcc.gnu.org/onlinedocs/gcc/Code-Gen-Options.html#index-fPIE
"pie" => Some("-fPIE"),
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mdynamic-no-pic
// https://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html#index-mdynamic-no-pic
"dynamic-no-pic" => Some("-mdynamic-no-pic"),

@@ -243,9 +227,5 @@ _ => None,

}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fembed-bitcode
if let Some(value) = self.embed_bitcode {
let cc_val = if value { "all" } else { "off" };
push_if_supported(format!("-fembed-bitcode={cc_val}").into());
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-omit-frame-pointer
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fomit-frame-pointer
// https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fomit-frame-pointer
if let Some(value) = self.force_frame_pointers {

@@ -259,8 +239,6 @@ let cc_flag = if value {

}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-dead_strip
if let Some(false) = self.link_dead_code {
push_if_supported("-dead_strip".into());
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mno-red-zone
// https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mno-red-zone
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mred-zone
// https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-mred-zone
if let Some(value) = self.no_redzone {

@@ -271,3 +249,5 @@ let cc_flag = if value { "-mno-red-zone" } else { "-mred-zone" };

// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-msoft-float
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mno-soft-float
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mhard-float
// https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html (several archs, search for `-msoft-float`).
// https://gcc.gnu.org/onlinedocs/gcc/Option-Summary.html (several archs, search for `-mhard-float`).
if let Some(value) = self.soft_float {

@@ -277,3 +257,4 @@ let cc_flag = if value {

} else {
"-mno-soft-float"
// Do not use -mno-soft-float, that's basically just an alias for -mno-implicit-float.
"-mhard-float"
};

@@ -298,2 +279,32 @@ push_if_supported(cc_flag.into());

}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fembed-bitcode
if let Some(value) = self.embed_bitcode {
let cc_val = if value { "all" } else { "off" };
push_if_supported(format!("-fembed-bitcode={cc_val}").into());
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-flto
if let Some(value) = self.lto {
let cc_val = match value {
"y" | "yes" | "on" | "true" | "fat" => Some("full"),
"thin" => Some("thin"),
_ => None,
};
if let Some(cc_val) = cc_val {
push_if_supported(format!("-flto={cc_val}").into());
}
}
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mguard
if let Some(value) = self.control_flow_guard {
let cc_val = match value {
"y" | "yes" | "on" | "true" | "checks" => Some("cf"),
"nochecks" => Some("cf-nochecks"),
"n" | "no" | "off" | "false" => Some("none"),
_ => None,
};
if let Some(cc_val) = cc_val {
push_if_supported(format!("-mguard={cc_val}").into());
}
}
}

@@ -490,3 +501,2 @@ ToolFamily::Gnu { .. } => {}

force_frame_pointers: Some(true),
link_dead_code: Some(true),
lto: Some("false"),

@@ -493,0 +503,0 @@ no_redzone: Some(true),

@@ -47,3 +47,6 @@ //! Very basic parsing of `rustc` target triples.

/// The unversioned LLVM/Clang target triple.
unversioned_llvm_target: &'a str,
///
/// NOTE: You should never need to match on this explicitly, use the other
/// fields on [`TargetInfo`] instead.
pub llvm_target: &'a str,
}

@@ -50,0 +53,0 @@

@@ -21,2 +21,14 @@ use super::TargetInfo;

pub(crate) fn apple_version_flag(&self, min_version: &str) -> String {
// There are many aliases for these, and `-mtargetos=` is preferred on Clang nowadays, but
// for compatibility with older Clang, we use the earliest supported name here.
//
// NOTE: GCC does not support `-miphoneos-version-min=` etc. (because it does not support
// iOS in general), but we specify them anyhow in case we actually have a Clang-like
// compiler disguised as a GNU-like compiler, or in case GCC adds support for these in the
// future.
//
// See also:
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mmacos-version-min
// https://clang.llvm.org/docs/AttributeReference.html#availability
// https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#index-mmacosx-version-min
match (self.os, self.abi) {

@@ -23,0 +35,0 @@ ("macos", "") => format!("-mmacosx-version-min={min_version}"),

@@ -1,30 +0,1 @@

use std::borrow::Cow;
use super::TargetInfo;
impl<'a> TargetInfo<'a> {
/// The versioned LLVM/Clang target triple.
pub(crate) fn versioned_llvm_target(&self, version: Option<&str>) -> Cow<'a, str> {
if let Some(version) = version {
// Only support versioned Apple targets for now.
assert_eq!(self.vendor, "apple");
let mut components = self.unversioned_llvm_target.split("-");
let arch = components.next().expect("llvm_target should have arch");
let vendor = components.next().expect("llvm_target should have vendor");
let os = components.next().expect("LLVM target should have os");
let environment = components.next();
assert_eq!(components.next(), None, "too many LLVM target components");
Cow::Owned(if let Some(env) = environment {
format!("{arch}-{vendor}-{os}{version}-{env}")
} else {
format!("{arch}-{vendor}-{os}{version}")
})
} else {
Cow::Borrowed(self.unversioned_llvm_target)
}
}
}
/// Rust and Clang don't really agree on naming, so do a best-effort

@@ -31,0 +2,0 @@ /// conversion to support out-of-tree / custom target-spec targets.

@@ -17,3 +17,3 @@ use std::{env, str::FromStr};

abi: Box<str>,
unversioned_llvm_target: Box<str>,
llvm_target: Box<str>,
}

@@ -84,4 +84,4 @@

// Prefer `rustc`'s LLVM target triple information.
let unversioned_llvm_target = match fallback_target {
Some(ft) => ft.unversioned_llvm_target.to_string(),
let llvm_target = match fallback_target {
Some(ft) => ft.llvm_target.to_string(),
None => llvm::guess_llvm_target_triple(full_arch, &vendor, &os, &env, &abi),

@@ -97,3 +97,3 @@ };

abi,
unversioned_llvm_target: unversioned_llvm_target.into_boxed_str(),
llvm_target: llvm_target.into_boxed_str(),
})

@@ -120,3 +120,3 @@ }

abi,
unversioned_llvm_target,
llvm_target,
}) => Ok(TargetInfo {

@@ -129,3 +129,3 @@ full_arch,

abi,
unversioned_llvm_target,
llvm_target,
}),

@@ -132,0 +132,0 @@ Err(e) => Err(e.clone()),

@@ -19,2 +19,4 @@ use std::{

pub(crate) type CompilerFamilyLookupCache = HashMap<Box<[Box<OsStr>]>, ToolFamily>;
/// Configuration used to represent an invocation of a C compiler.

@@ -44,3 +46,3 @@ ///

path: PathBuf,
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
cargo_output: &CargoOutput,

@@ -51,3 +53,3 @@ out_dir: Option<&Path>,

path,
None,
vec![],
false,

@@ -60,6 +62,6 @@ cached_compiler_family,

pub(crate) fn with_clang_driver(
pub(crate) fn with_args(
path: PathBuf,
clang_driver: Option<&str>,
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
args: Vec<String>,
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
cargo_output: &CargoOutput,

@@ -70,3 +72,3 @@ out_dir: Option<&Path>,

path,
clang_driver,
args,
false,

@@ -96,5 +98,5 @@ cached_compiler_family,

path: PathBuf,
clang_driver: Option<&str>,
args: Vec<String>,
cuda: bool,
cached_compiler_family: &RwLock<HashMap<Box<Path>, ToolFamily>>,
cached_compiler_family: &RwLock<CompilerFamilyLookupCache>,
cargo_output: &CargoOutput,

@@ -123,2 +125,3 @@ out_dir: Option<&Path>,

path: &Path,
args: &[String],
cargo_output: &CargoOutput,

@@ -130,4 +133,6 @@ ) -> Result<ToolFamily, Error> {

// stdin is set to null to ensure that the help output is never paginated.
let accepts_cl_style_flags =
run(Command::new(path).arg("-?").stdin(Stdio::null()), path, &{
let accepts_cl_style_flags = run(
Command::new(path).args(args).arg("-?").stdin(Stdio::null()),
path,
&{
// the errors are not errors!

@@ -138,4 +143,5 @@ let mut cargo_output = cargo_output.clone();

cargo_output
})
.is_ok();
},
)
.is_ok();

@@ -165,2 +171,3 @@ let clang = stdout.contains(r#""clang""#);

path: &Path,
args: &[String],
cargo_output: &CargoOutput,

@@ -220,21 +227,27 @@ out_dir: Option<&Path>,

let stdout = String::from_utf8_lossy(&stdout);
guess_family_from_stdout(&stdout, path, cargo_output)
guess_family_from_stdout(&stdout, path, args, cargo_output)
} else {
guess_family_from_stdout(&stdout, path, cargo_output)
guess_family_from_stdout(&stdout, path, args, cargo_output)
}
}
let detect_family = |path: &Path| -> Result<ToolFamily, Error> {
if let Some(family) = cached_compiler_family.read().unwrap().get(path) {
let detect_family = |path: &Path, args: &[String]| -> Result<ToolFamily, Error> {
let cache_key = [path.as_os_str()]
.iter()
.cloned()
.chain(args.iter().map(OsStr::new))
.map(Into::into)
.collect();
if let Some(family) = cached_compiler_family.read().unwrap().get(&cache_key) {
return Ok(*family);
}
let family = detect_family_inner(path, cargo_output, out_dir)?;
let family = detect_family_inner(path, args, cargo_output, out_dir)?;
cached_compiler_family
.write()
.unwrap()
.insert(path.into(), family);
.insert(cache_key, family);
Ok(family)
};
let family = detect_family(&path).unwrap_or_else(|e| {
let family = detect_family(&path, &args).unwrap_or_else(|e| {
cargo_output.print_warning(&format_args!(

@@ -249,8 +262,14 @@ "Compiler family detection failed due to error: {}",

}
Some(fname) if fname.contains("clang") => match clang_driver {
Some("cl") => ToolFamily::Msvc { clang_cl: true },
_ => ToolFamily::Clang {
zig_cc: is_zig_cc(&path, cargo_output),
},
},
Some(fname) if fname.contains("clang") => {
let is_clang_cl = args
.iter()
.any(|a| a.strip_prefix("--driver-mode=") == Some("cl"));
if is_clang_cl {
ToolFamily::Msvc { clang_cl: true }
} else {
ToolFamily::Clang {
zig_cc: is_zig_cc(&path, cargo_output),
}
}
}
Some(fname) if fname.contains("zig") => ToolFamily::Clang { zig_cc: true },

@@ -257,0 +276,0 @@ _ => ToolFamily::Gnu,

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display