| { | ||
| "git": { | ||
| "sha1": "a8c9dc0187367bcecd9a59585153ff71859dd8ed" | ||
| "sha1": "966183eb651b4ea473cdb32a91120e374f42ba4a" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
+1
-1
@@ -13,3 +13,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "cc" | ||
| version = "1.2.8" | ||
| version = "1.2.9" | ||
| dependencies = [ | ||
@@ -16,0 +16,0 @@ "jobserver", |
+1
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "cc" | ||
| version = "1.2.8" | ||
| version = "1.2.9" | ||
| authors = ["Alex Crichton <alex@alexcrichton.com>"] | ||
@@ -19,0 +19,0 @@ build = false |
+8
-0
@@ -9,2 +9,10 @@ # Changelog | ||
| ## [1.2.9](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.8...cc-v1.2.9) - 2025-01-12 | ||
| ### Other | ||
| - Don't pass inherited PGO flags to GNU compilers (#1363) | ||
| - Adjusted zig cc judgment and avoided zigbuild errors([#1360](https://github.com/rust-lang/cc-rs/pull/1360)) ([#1361](https://github.com/rust-lang/cc-rs/pull/1361)) | ||
| - Fix compilation on macOS using clang and fix compilation using zig-cc ([#1364](https://github.com/rust-lang/cc-rs/pull/1364)) | ||
| ## [1.2.8](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.7...cc-v1.2.8) - 2025-01-11 | ||
@@ -11,0 +19,0 @@ |
+101
-89
@@ -177,22 +177,105 @@ use crate::target::TargetInfo; | ||
| match family { | ||
| ToolFamily::Clang { .. } | ToolFamily::Gnu => { | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mbranch-protection | ||
| if let Some(value) = self.branch_protection { | ||
| push_if_supported( | ||
| format!("-mbranch-protection={}", value.replace(",", "+")).into(), | ||
| ); | ||
| let clang_or_gnu = | ||
| matches!(family, ToolFamily::Clang { .. }) || matches!(family, ToolFamily::Gnu { .. }); | ||
| // Flags shared between clang and gnu | ||
| if clang_or_gnu { | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mbranch-protection | ||
| if let Some(value) = self.branch_protection { | ||
| push_if_supported( | ||
| format!("-mbranch-protection={}", value.replace(",", "+")).into(), | ||
| ); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mcmodel | ||
| if let Some(value) = self.code_model { | ||
| push_if_supported(format!("-mcmodel={value}").into()); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-vectorize | ||
| if self.no_vectorize_loops { | ||
| push_if_supported("-fno-vectorize".into()); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-slp-vectorize | ||
| 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-mcmodel | ||
| if let Some(value) = self.code_model { | ||
| push_if_supported(format!("-mcmodel={value}").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-fno-vectorize | ||
| if self.no_vectorize_loops { | ||
| push_if_supported("-fno-vectorize".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 { | ||
| "pic" => Some("-fPIC"), | ||
| "pie" => Some("-fPIE"), | ||
| "dynamic-no-pic" => Some("-mdynamic-no-pic"), | ||
| _ => None, | ||
| }; | ||
| if let Some(cc_flag) = cc_flag { | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fno-slp-vectorize | ||
| if self.no_vectorize_slp { | ||
| push_if_supported("-fno-slp-vectorize".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-fno-omit-frame-pointer | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fomit-frame-pointer | ||
| if let Some(value) = self.force_frame_pointers { | ||
| let cc_flag = if value { | ||
| "-fno-omit-frame-pointer" | ||
| } else { | ||
| "-fomit-frame-pointer" | ||
| }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| // 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://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mred-zone | ||
| if let Some(value) = self.no_redzone { | ||
| let cc_flag = if value { "-mno-red-zone" } else { "-mred-zone" }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-msoft-float | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mno-soft-float | ||
| if let Some(value) = self.soft_float { | ||
| let cc_flag = if value { | ||
| "-msoft-float" | ||
| } else { | ||
| "-mno-soft-float" | ||
| }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| } | ||
| // Compiler-exclusive flags | ||
| match family { | ||
| ToolFamily::Clang { .. } => { | ||
| // GNU and Clang compilers both support the same PGO flags, but they use different libraries and | ||
| // different formats for the profile files which are not compatible. | ||
| // clang and rustc both internally use llvm, so we want to inherit the PGO flags only for clang. | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fprofile-generate | ||
@@ -206,75 +289,4 @@ if let Some(value) = self.profile_generate { | ||
| } | ||
| // 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 { | ||
| "pic" => Some("-fPIC"), | ||
| "pie" => Some("-fPIE"), | ||
| "dynamic-no-pic" => Some("-mdynamic-no-pic"), | ||
| _ => None, | ||
| }; | ||
| if let Some(cc_flag) = cc_flag { | ||
| 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-fno-omit-frame-pointer | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-fomit-frame-pointer | ||
| if let Some(value) = self.force_frame_pointers { | ||
| let cc_flag = if value { | ||
| "-fno-omit-frame-pointer" | ||
| } else { | ||
| "-fomit-frame-pointer" | ||
| }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| // 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://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mred-zone | ||
| if let Some(value) = self.no_redzone { | ||
| let cc_flag = if value { "-mno-red-zone" } else { "-mred-zone" }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-msoft-float | ||
| // https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-mno-soft-float | ||
| if let Some(value) = self.soft_float { | ||
| let cc_flag = if value { | ||
| "-msoft-float" | ||
| } else { | ||
| "-mno-soft-float" | ||
| }; | ||
| push_if_supported(cc_flag.into()); | ||
| } | ||
| } | ||
| ToolFamily::Gnu { .. } => {} | ||
| ToolFamily::Msvc { .. } => { | ||
@@ -281,0 +293,0 @@ // https://learn.microsoft.com/en-us/cpp/build/reference/guard-enable-control-flow-guard |
+8
-4
@@ -106,2 +106,8 @@ use std::{ | ||
| .unwrap_or_default() | ||
| || { | ||
| match path.file_name().map(OsStr::to_string_lossy) { | ||
| Some(fname) => fname.contains("zig"), | ||
| _ => false, | ||
| } | ||
| } | ||
| } | ||
@@ -432,6 +438,4 @@ | ||
| pub(crate) fn supports_path_delimiter(&self) -> bool { | ||
| matches!( | ||
| self.family, | ||
| ToolFamily::Clang { .. } | ToolFamily::Msvc { clang_cl: true } | ||
| ) && !self.cuda | ||
| // homebrew clang and zig-cc does not support this while stock version does | ||
| matches!(self.family, ToolFamily::Msvc { clang_cl: true }) && !self.cuda | ||
| } | ||
@@ -438,0 +442,0 @@ } |
Sorry, the diff of this file is not supported yet