Backed out changeset 373bf4808bb7 (bug 1950584) for causing bustages at brush_blend.h. CLOSED TREE

This commit is contained in:
Butkovits Atila
2025-03-21 15:31:42 +02:00
parent 76a338b8c0
commit 1a7bbbb50e
15 changed files with 342 additions and 443 deletions

4
Cargo.lock generated
View File

@@ -721,9 +721,9 @@ dependencies = [
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.16" version = "1.2.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" checksum = "755717a7de9ec452bf7f3f1a3099085deabd7f2962b861dae91ecd7a365903d2"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",

View File

@@ -1107,11 +1107,6 @@ who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
delta = "1.2.11 -> 1.2.12" delta = "1.2.11 -> 1.2.12"
[[audits.cc]]
who = "Erich Gubler <erichdongubler@gmail.com>"
criteria = "safe-to-deploy"
delta = "1.2.12 -> 1.2.16"
[[audits.cfg_aliases]] [[audits.cfg_aliases]]
who = "Alex Franchuk <afranchuk@mozilla.com>" who = "Alex Franchuk <afranchuk@mozilla.com>"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"

View File

@@ -1 +1 @@
{"files":{"CHANGELOG.md":"4c53346482b299f9e98b32aa1960885303838972864ab46837b7a415c66574d5","Cargo.lock":"895efb923fbb0a6a6f5d60ebcb961dea438bd1c777611b58f67ba343c043a795","Cargo.toml":"eebce28751bcb8851a3883229d7008ee04f53289f94dc6300b18e39051cdfb87","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"f1ddbede208a5b78333a25dac0a7598e678e9b601a7d99a791069bddaf180dfe","clippy.toml":"aa7850db4350883c8f373bd0d6b4d19bf3b75f13c1c238e24368c109cb52fb1d","src/command_helpers.rs":"ab304fcd54992a6441222750152691b70e124de79d1ad60e3c7ac910b82d4ce9","src/detect_compiler_family.c":"97ca4b021495611e828becea6187add37414186a16dfedd26c2947cbce6e8b2f","src/flags.rs":"8abd8a8c76f871c0da74a95128ec199c796b0740cd235f22499e10174b543a3c","src/lib.rs":"2cd745fce4a53d4be2b6b75043c343f68afca25f1e82173b779fdd639af404d1","src/parallel/async_executor.rs":"4ce24435fff6b6555b43fee042c16bd65d4150d0346567f246b9190d85b45983","src/parallel/job_token.rs":"018a01cb00182270bbcb68e31e7a7c5c621a95f086e4c68cfa2bf557ac24e5f2","src/parallel/mod.rs":"bd9c1334d17d138c281961c690b8d8118a2d6295a7d6cd7296826255436fa063","src/parallel/stderr.rs":"74384d41198740a6fce0877f144262db09fb091225fa8fbfa771314bb11487c6","src/target.rs":"a85757d86dc4db6c0ebd2f7ce57fd3d062c3a98eaa97409f8be9609bd34bc56a","src/target/apple.rs":"8fb110d87c3c12f62d0b1cf61ff5656b96d651501bc7dc8b021057b675486398","src/target/generated.rs":"dec499e905fd87e4a04bbcd826f9b54ee65d61cf4805edd49aea7a6972ea8407","src/target/llvm.rs":"827fb74e3afbd4146bd5f02e6155dad26e68d745626d2c680fac27913743b23a","src/target/parser.rs":"c8bfc198abdd944c4292ecbe8bd7bc9d3dba16601325d776be836df852bf7bb3","src/tempfile.rs":"ebafb5b0e5d08b0706916ed911d4245240e60c3e2d0c9a1630c520842988a2b3","src/tool.rs":"86b24a91b0e2d818b860735daa1612fd6d6a8259539d0731e031a126783ba26d","src/utilities.rs":"52b30b24a1c31cdefb105309ee5220cfc9fca76eaf4e6d6509c3e19f431448fe","src/windows/com.rs":"a2800ddb81215fff2bf618336f5c4ff8e8bdb746dd18b795873c7304b3f2a5e3","src/windows/find_tools.rs":"90c831db5f502bfbdaa6d6d55cbdc7097aa819b0c3b41fdb007d18bdedc7a24e","src/windows/mod.rs":"6d8492c44c05e1abe6ea0b55178a7a98fec9722fdf684cd3813d8a6e82e4e10a","src/windows/registry.rs":"c521b72c825e8095843e73482ffa810ed066ad8bb9f86e6db0c5c143c171aba1","src/windows/setup_config.rs":"754439cbab492afd44c9755abcbec1a41c9b2c358131cee2df13c0e996dbbec8","src/windows/vs_instances.rs":"946527cf8fd32c3472f6a2884dcdec290763101097334c7478f9c24c3950db6b","src/windows/winapi.rs":"250d51c1826d1a2329e9889dd9f058cfce253dbf2a678b076147c6cdb5db046c","src/windows/windows_link.rs":"5b4648ebc22b028caca9f4b4bf8881fe2d094b7bec217264ba2e6e2c49d1ccee","src/windows/windows_sys.rs":"addaf0473cbc0cad58ece3eac5a6bd2e6fa1793db66ce7beaa32c607a39a57b8"},"package":"be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c"} {"files":{"CHANGELOG.md":"e66396b8cd8631cd459417aaa88e3fd8323ccf06ba0a7c6c2659ede4438ec6e6","Cargo.lock":"7fe14a44fd079561e01d523ebd182929e0c7108d8cd7d30c777aaa1369ec7c99","Cargo.toml":"f100a0af14af5584342423999efe5d3015ad9fc2dbaf6a32845eced57f015b86","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"f1ddbede208a5b78333a25dac0a7598e678e9b601a7d99a791069bddaf180dfe","clippy.toml":"aa7850db4350883c8f373bd0d6b4d19bf3b75f13c1c238e24368c109cb52fb1d","src/command_helpers.rs":"511429ff0130a7c5a5c1db29939a78af4f7fb84e6e4293e721c6deceffd28245","src/detect_compiler_family.c":"97ca4b021495611e828becea6187add37414186a16dfedd26c2947cbce6e8b2f","src/flags.rs":"52b1860a0836cfaf3acd57e5f1118430f2269630b54e6ce03de05d46518ce7d2","src/lib.rs":"8479d1b0791b8e284f57afc6043d79a933b6b8132b132e71d58c7ac7db011157","src/parallel/async_executor.rs":"4ce24435fff6b6555b43fee042c16bd65d4150d0346567f246b9190d85b45983","src/parallel/job_token.rs":"018a01cb00182270bbcb68e31e7a7c5c621a95f086e4c68cfa2bf557ac24e5f2","src/parallel/mod.rs":"bd9c1334d17d138c281961c690b8d8118a2d6295a7d6cd7296826255436fa063","src/parallel/stderr.rs":"74384d41198740a6fce0877f144262db09fb091225fa8fbfa771314bb11487c6","src/target.rs":"a85757d86dc4db6c0ebd2f7ce57fd3d062c3a98eaa97409f8be9609bd34bc56a","src/target/apple.rs":"8fb110d87c3c12f62d0b1cf61ff5656b96d651501bc7dc8b021057b675486398","src/target/generated.rs":"db71ef59fcaa55aca99e6df3f228ce05448c059a9c3c960fe41ffca765c7c1c5","src/target/llvm.rs":"e7f41b5f30394718c40f0822e9f87f9076c2b957e78a51857cb04f13c7cb4296","src/target/parser.rs":"c8bfc198abdd944c4292ecbe8bd7bc9d3dba16601325d776be836df852bf7bb3","src/tempfile.rs":"ebafb5b0e5d08b0706916ed911d4245240e60c3e2d0c9a1630c520842988a2b3","src/tool.rs":"bb0909bb7d1514b212b7bb030936cd228a4102680d7d4a0f4281597bb348d0c8","src/utilities.rs":"52b30b24a1c31cdefb105309ee5220cfc9fca76eaf4e6d6509c3e19f431448fe","src/windows/com.rs":"a2800ddb81215fff2bf618336f5c4ff8e8bdb746dd18b795873c7304b3f2a5e3","src/windows/find_tools.rs":"90c831db5f502bfbdaa6d6d55cbdc7097aa819b0c3b41fdb007d18bdedc7a24e","src/windows/mod.rs":"34cfa201cfbcac7ccaa3ea5295d3e4200439af3cc5c6433baf81502596040a89","src/windows/registry.rs":"c521b72c825e8095843e73482ffa810ed066ad8bb9f86e6db0c5c143c171aba1","src/windows/setup_config.rs":"754439cbab492afd44c9755abcbec1a41c9b2c358131cee2df13c0e996dbbec8","src/windows/vs_instances.rs":"946527cf8fd32c3472f6a2884dcdec290763101097334c7478f9c24c3950db6b","src/windows/winapi.rs":"250d51c1826d1a2329e9889dd9f058cfce253dbf2a678b076147c6cdb5db046c","src/windows/windows_sys.rs":"324a391634b956c0ce67b611998b677caf5a1a6e25e6ed749a7d8f7a185f14c9","src/windows/windows_targets.rs":"5b4648ebc22b028caca9f4b4bf8881fe2d094b7bec217264ba2e6e2c49d1ccee"},"package":"755717a7de9ec452bf7f3f1a3099085deabd7f2962b861dae91ecd7a365903d2"}

View File

@@ -6,43 +6,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## [1.2.16](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.15...cc-v1.2.16) - 2025-02-28
### Fixed
- force windows compiler to run in `out_dir` to prevent artifacts in cwd (#1415)
### Other
- use `/arch:SSE2` for `x86` target arch (#1425)
- Regenerate windows-sys binding ([#1422](https://github.com/rust-lang/cc-rs/pull/1422))
- Regenerate target info ([#1418](https://github.com/rust-lang/cc-rs/pull/1418))
- Add LIB var when compiling flag_check (#1417)
- Change flag ordering ([#1403](https://github.com/rust-lang/cc-rs/pull/1403))
- Fix archiver detection for musl cross compilation ([#1404](https://github.com/rust-lang/cc-rs/pull/1404))
## [1.2.15](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.14...cc-v1.2.15) - 2025-02-21
### Other
- Regenerate target info ([#1406](https://github.com/rust-lang/cc-rs/pull/1406))
- Always read from all `CFLAGS`-style flags ([#1401](https://github.com/rust-lang/cc-rs/pull/1401))
- Simplify the error output on failed `Command` invocation ([#1397](https://github.com/rust-lang/cc-rs/pull/1397))
## [1.2.14](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.13...cc-v1.2.14) - 2025-02-14
### Other
- Regenerate target info ([#1398](https://github.com/rust-lang/cc-rs/pull/1398))
- Add support for setting `-gdwarf-{version}` based on RUSTFLAGS ([#1395](https://github.com/rust-lang/cc-rs/pull/1395))
- Add support for alternative network stack io-sock on QNX 7.1 aarch64 and x86_64 ([#1312](https://github.com/rust-lang/cc-rs/pull/1312))
## [1.2.13](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.12...cc-v1.2.13) - 2025-02-08
### Other
- Fix cross-compiling for Apple platforms ([#1389](https://github.com/rust-lang/cc-rs/pull/1389))
## [1.2.12](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.11...cc-v1.2.12) - 2025-02-04 ## [1.2.12](https://github.com/rust-lang/cc-rs/compare/cc-v1.2.11...cc-v1.2.12) - 2025-02-04
### Other ### Other

14
third_party/rust/cc/Cargo.lock generated vendored
View File

@@ -10,7 +10,7 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.2.16" version = "1.2.12"
dependencies = [ dependencies = [
"jobserver", "jobserver",
"libc", "libc",
@@ -63,9 +63,9 @@ dependencies = [
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.170" version = "0.2.169"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
[[package]] [[package]]
name = "linux-raw-sys" name = "linux-raw-sys"
@@ -75,9 +75,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab"
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.20.3" version = "1.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "945462a4b81e43c4e3ba96bd7b49d834c6f61198356aa858733bc4acf3cbe62e" checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
[[package]] [[package]]
name = "rustix" name = "rustix"
@@ -100,9 +100,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.17.1" version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e5a0acb1f3f55f65cc4a866c361b2fb2a0ff6366785ae6fbb5f85df07ba230" checksum = "38c246215d7d24f48ae091a2902398798e05d978b24315d6efbc00ede9a8bb91"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand", "fastrand",

View File

@@ -13,7 +13,7 @@
edition = "2018" edition = "2018"
rust-version = "1.63" rust-version = "1.63"
name = "cc" name = "cc"
version = "1.2.16" version = "1.2.12"
authors = ["Alex Crichton <alex@alexcrichton.com>"] authors = ["Alex Crichton <alex@alexcrichton.com>"]
build = false build = false
exclude = [ exclude = [
@@ -39,13 +39,6 @@ categories = ["development-tools::build-utils"]
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/cc-rs" repository = "https://github.com/rust-lang/cc-rs"
[features]
jobserver = []
parallel = [
"dep:libc",
"dep:jobserver",
]
[lib] [lib]
name = "cc" name = "cc"
path = "src/lib.rs" path = "src/lib.rs"
@@ -61,6 +54,13 @@ version = "1.3.0"
[dev-dependencies.tempfile] [dev-dependencies.tempfile]
version = "3" version = "3"
[features]
jobserver = []
parallel = [
"dep:libc",
"dep:jobserver",
]
[target."cfg(unix)".dependencies.libc] [target."cfg(unix)".dependencies.libc]
version = "0.2.62" version = "0.2.62"
optional = true optional = true

View File

@@ -247,6 +247,7 @@ fn write_warning(line: &[u8]) {
fn wait_on_child( fn wait_on_child(
cmd: &Command, cmd: &Command,
program: &Path,
child: &mut Child, child: &mut Child,
cargo_output: &CargoOutput, cargo_output: &CargoOutput,
) -> Result<(), Error> { ) -> Result<(), Error> {
@@ -257,7 +258,12 @@ fn wait_on_child(
Err(e) => { Err(e) => {
return Err(Error::new( return Err(Error::new(
ErrorKind::ToolExecError, ErrorKind::ToolExecError,
format!("failed to wait on spawned child process `{cmd:?}`: {e}"), format!(
"Failed to wait on spawned child process, command {:?} with args {}: {}.",
cmd,
program.display(),
e
),
)); ));
} }
}; };
@@ -269,7 +275,12 @@ fn wait_on_child(
} else { } else {
Err(Error::new( Err(Error::new(
ErrorKind::ToolExecError, ErrorKind::ToolExecError,
format!("command did not execute successfully (status code {status}): {cmd:?}"), format!(
"Command {:?} with args {} did not execute successfully (status code {}).",
cmd,
program.display(),
status
),
)) ))
} }
} }
@@ -339,16 +350,28 @@ pub(crate) fn objects_from_files(files: &[Arc<Path>], dst: &Path) -> Result<Vec<
Ok(objects) Ok(objects)
} }
pub(crate) fn run(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<(), Error> { pub(crate) fn run(
let mut child = spawn(cmd, cargo_output)?; cmd: &mut Command,
wait_on_child(cmd, &mut child, cargo_output) program: impl AsRef<Path>,
cargo_output: &CargoOutput,
) -> Result<(), Error> {
let program = program.as_ref();
let mut child = spawn(cmd, program, cargo_output)?;
wait_on_child(cmd, program, &mut child, cargo_output)
} }
pub(crate) fn run_output(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<Vec<u8>, Error> { pub(crate) fn run_output(
cmd: &mut Command,
program: impl AsRef<Path>,
cargo_output: &CargoOutput,
) -> Result<Vec<u8>, Error> {
let program = program.as_ref();
// We specifically need the output to be captured, so override default // We specifically need the output to be captured, so override default
let mut captured_cargo_output = cargo_output.clone(); let mut captured_cargo_output = cargo_output.clone();
captured_cargo_output.output = OutputKind::Capture; captured_cargo_output.output = OutputKind::Capture;
let mut child = spawn(cmd, &captured_cargo_output)?; let mut child = spawn(cmd, program, &captured_cargo_output)?;
let mut stdout = vec![]; let mut stdout = vec![];
child child
@@ -359,12 +382,16 @@ pub(crate) fn run_output(cmd: &mut Command, cargo_output: &CargoOutput) -> Resul
.unwrap(); .unwrap();
// Don't care about this output, use the normal settings // Don't care about this output, use the normal settings
wait_on_child(cmd, &mut child, cargo_output)?; wait_on_child(cmd, program, &mut child, cargo_output)?;
Ok(stdout) Ok(stdout)
} }
pub(crate) fn spawn(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<Child, Error> { pub(crate) fn spawn(
cmd: &mut Command,
program: &Path,
cargo_output: &CargoOutput,
) -> Result<Child, Error> {
struct ResetStderr<'cmd>(&'cmd mut Command); struct ResetStderr<'cmd>(&'cmd mut Command);
impl Drop for ResetStderr<'_> { impl Drop for ResetStderr<'_> {
@@ -387,18 +414,28 @@ pub(crate) fn spawn(cmd: &mut Command, cargo_output: &CargoOutput) -> Result<Chi
Ok(child) => Ok(child), Ok(child) => Ok(child),
Err(ref e) if e.kind() == io::ErrorKind::NotFound => { Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
let extra = if cfg!(windows) { let extra = if cfg!(windows) {
" (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)" " (see https://docs.rs/cc/latest/cc/#compile-time-requirements \
for help)"
} else { } else {
"" ""
}; };
Err(Error::new( Err(Error::new(
ErrorKind::ToolNotFound, ErrorKind::ToolNotFound,
format!("failed to find tool {:?}: {e}{extra}", cmd.0.get_program()), format!(
"Failed to find tool. Is `{}` installed?{}",
program.display(),
extra
),
)) ))
} }
Err(e) => Err(Error::new( Err(e) => Err(Error::new(
ErrorKind::ToolExecError, ErrorKind::ToolExecError,
format!("command `{:?}` failed to start: {e}", cmd.0), format!(
"Command {:?} with args {} failed to start: {:?}",
cmd.0,
program.display(),
e
),
)), )),
} }
} }
@@ -428,6 +465,7 @@ pub(crate) fn command_add_output_file(cmd: &mut Command, dst: &Path, args: CmdAd
#[cfg(feature = "parallel")] #[cfg(feature = "parallel")]
pub(crate) fn try_wait_on_child( pub(crate) fn try_wait_on_child(
cmd: &Command, cmd: &Command,
program: &Path,
child: &mut Child, child: &mut Child,
stdout: &mut dyn io::Write, stdout: &mut dyn io::Write,
stderr_forwarder: &mut StderrForwarder, stderr_forwarder: &mut StderrForwarder,
@@ -445,7 +483,12 @@ pub(crate) fn try_wait_on_child(
} else { } else {
Err(Error::new( Err(Error::new(
ErrorKind::ToolExecError, ErrorKind::ToolExecError,
format!("command did not execute successfully (status code {status}): {cmd:?}"), format!(
"Command {:?} with args {} did not execute successfully (status code {}).",
cmd,
program.display(),
status
),
)) ))
} }
} }
@@ -454,7 +497,12 @@ pub(crate) fn try_wait_on_child(
stderr_forwarder.forward_all(); stderr_forwarder.forward_all();
Err(Error::new( Err(Error::new(
ErrorKind::ToolExecError, ErrorKind::ToolExecError,
format!("failed to wait on spawned child process `{cmd:?}`: {e}"), format!(
"Failed to wait on spawned child process, command {:?} with args {}: {}.",
cmd,
program.display(),
e
),
)) ))
} }
} }

View File

@@ -18,7 +18,6 @@ pub(crate) struct RustcCodegenFlags<'a> {
force_frame_pointers: Option<bool>, force_frame_pointers: Option<bool>,
no_redzone: Option<bool>, no_redzone: Option<bool>,
soft_float: Option<bool>, soft_float: Option<bool>,
dwarf_version: Option<u32>,
} }
impl<'this> RustcCodegenFlags<'this> { impl<'this> RustcCodegenFlags<'this> {
@@ -87,10 +86,6 @@ impl<'this> RustcCodegenFlags<'this> {
} }
} }
fn arg_to_u32(arg: impl AsRef<str>) -> Option<u32> {
arg.as_ref().parse().ok()
}
let (flag, value) = if let Some((flag, value)) = flag.split_once('=') { let (flag, value) = if let Some((flag, value)) = flag.split_once('=') {
(flag, Some(value)) (flag, Some(value))
} else { } else {
@@ -153,14 +148,6 @@ impl<'this> RustcCodegenFlags<'this> {
self.branch_protection = self.branch_protection =
Some(flag_ok_or(value, "-Zbranch-protection must have a value")?); Some(flag_ok_or(value, "-Zbranch-protection must have a value")?);
} }
// https://doc.rust-lang.org/beta/unstable-book/compiler-flags/dwarf-version.html
// FIXME: Drop the -Z variant and update the doc link once the option is stablized
"-Zdwarf-version" | "-Cdwarf-version" => {
self.dwarf_version = Some(value.and_then(arg_to_u32).ok_or(Error::new(
ErrorKind::InvalidFlag,
"-Zdwarf-version must have a value",
))?);
}
_ => {} _ => {}
} }
Ok(()) Ok(())
@@ -263,11 +250,6 @@ impl<'this> RustcCodegenFlags<'this> {
}; };
push_if_supported(cc_flag.into()); push_if_supported(cc_flag.into());
} }
// https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-gdwarf-2
// https://gcc.gnu.org/onlinedocs/gcc/Debugging-Options.html#index-gdwarf
if let Some(value) = self.dwarf_version {
push_if_supported(format!("-gdwarf-{value}").into());
}
} }
// Compiler-exclusive flags // Compiler-exclusive flags
@@ -408,7 +390,6 @@ mod tests {
"-Crelocation-model=pic", "-Crelocation-model=pic",
"-Csoft-float=yes", "-Csoft-float=yes",
"-Zbranch-protection=bti,pac-ret,leaf", "-Zbranch-protection=bti,pac-ret,leaf",
"-Zdwarf-version=5",
// Set flags we don't recognise but rustc supports next // Set flags we don't recognise but rustc supports next
// rustc flags // rustc flags
"--cfg", "--cfg",
@@ -515,7 +496,6 @@ mod tests {
relocation_model: Some("pic"), relocation_model: Some("pic"),
soft_float: Some(true), soft_float: Some(true),
branch_protection: Some("bti,pac-ret,leaf"), branch_protection: Some("bti,pac-ret,leaf"),
dwarf_version: Some(5),
}, },
); );
} }

View File

@@ -232,7 +232,7 @@ use std::io::{self, Write};
use std::path::{Component, Path, PathBuf}; use std::path::{Component, Path, PathBuf};
#[cfg(feature = "parallel")] #[cfg(feature = "parallel")]
use std::process::Child; use std::process::Child;
use std::process::{Command, Stdio}; use std::process::Command;
use std::sync::{ use std::sync::{
atomic::{AtomicU8, Ordering::Relaxed}, atomic::{AtomicU8, Ordering::Relaxed},
Arc, RwLock, Arc, RwLock,
@@ -653,12 +653,7 @@ impl Build {
/// ``` /// ```
/// ///
pub fn try_flags_from_environment(&mut self, environ_key: &str) -> Result<&mut Build, Error> { pub fn try_flags_from_environment(&mut self, environ_key: &str) -> Result<&mut Build, Error> {
let flags = self.envflags(environ_key)?.ok_or_else(|| { let flags = self.envflags(environ_key)?;
Error::new(
ErrorKind::EnvVarNotFound,
format!("could not find environment variable {environ_key}"),
)
})?;
self.flags.extend( self.flags.extend(
flags flags
.into_iter() .into_iter()
@@ -1337,6 +1332,8 @@ impl Build {
let mut cmd = compiler.to_command(); let mut cmd = compiler.to_command();
let is_arm = matches!(target.arch, "aarch64" | "arm"); let is_arm = matches!(target.arch, "aarch64" | "arm");
let clang = compiler.is_like_clang();
let gnu = compiler.family == ToolFamily::Gnu;
command_add_output_file( command_add_output_file(
&mut cmd, &mut cmd,
&obj, &obj,
@@ -1344,8 +1341,8 @@ impl Build {
cuda: self.cuda, cuda: self.cuda,
is_assembler_msvc: false, is_assembler_msvc: false,
msvc: compiler.is_like_msvc(), msvc: compiler.is_like_msvc(),
clang: compiler.is_like_clang(), clang,
gnu: compiler.is_like_gnu(), gnu,
is_asm: false, is_asm: false,
is_arm, is_arm,
}, },
@@ -1357,18 +1354,14 @@ impl Build {
cmd.arg(&src); cmd.arg(&src);
// On MSVC skip the CRT by setting the entry point to `main`.
// This way we don't need to add the default library paths.
if compiler.is_like_msvc() { if compiler.is_like_msvc() {
// On MSVC we need to make sure the LIB directory is included // Flags from _LINK_ are appended to the linker arguments.
// so the CRT can be found. cmd.env("_LINK_", "-entry:main");
for (key, value) in &tool.env {
if key == "LIB" {
cmd.env("LIB", value);
break;
}
}
} }
let output = cmd.current_dir(out_dir).output()?; let output = cmd.output()?;
let is_supported = output.status.success() && output.stderr.is_empty(); let is_supported = output.status.success() && output.stderr.is_empty();
self.build_cache self.build_cache
@@ -1601,8 +1594,8 @@ impl Build {
if objs.len() <= 1 { if objs.len() <= 1 {
for obj in objs { for obj in objs {
let mut cmd = self.create_compile_object_cmd(obj)?; let (mut cmd, name) = self.create_compile_object_cmd(obj)?;
run(&mut cmd, &self.cargo_output)?; run(&mut cmd, &name, &self.cargo_output)?;
} }
return Ok(()); return Ok(());
@@ -1630,8 +1623,12 @@ impl Build {
// acquire the appropriate tokens, Once all objects have been compiled // acquire the appropriate tokens, Once all objects have been compiled
// we wait on all the processes and propagate the results of compilation. // we wait on all the processes and propagate the results of compilation.
let pendings = let pendings = Cell::new(Vec::<(
Cell::new(Vec::<(Command, KillOnDrop, parallel::job_token::JobToken)>::new()); Command,
Cow<'static, Path>,
KillOnDrop,
parallel::job_token::JobToken,
)>::new());
let is_disconnected = Cell::new(false); let is_disconnected = Cell::new(false);
let has_made_progress = Cell::new(false); let has_made_progress = Cell::new(false);
@@ -1652,8 +1649,14 @@ impl Build {
cell_update(&pendings, |mut pendings| { cell_update(&pendings, |mut pendings| {
// Try waiting on them. // Try waiting on them.
pendings.retain_mut(|(cmd, child, _token)| { pendings.retain_mut(|(cmd, program, child, _token)| {
match try_wait_on_child(cmd, &mut child.0, &mut stdout, &mut child.1) { match try_wait_on_child(
cmd,
program,
&mut child.0,
&mut stdout,
&mut child.1,
) {
Ok(Some(())) => { Ok(Some(())) => {
// Task done, remove the entry // Task done, remove the entry
has_made_progress.set(true); has_made_progress.set(true);
@@ -1692,14 +1695,14 @@ impl Build {
}; };
let spawn_future = async { let spawn_future = async {
for obj in objs { for obj in objs {
let mut cmd = self.create_compile_object_cmd(obj)?; let (mut cmd, program) = self.create_compile_object_cmd(obj)?;
let token = tokens.acquire().await?; let token = tokens.acquire().await?;
let mut child = spawn(&mut cmd, &self.cargo_output)?; let mut child = spawn(&mut cmd, &program, &self.cargo_output)?;
let mut stderr_forwarder = StderrForwarder::new(&mut child); let mut stderr_forwarder = StderrForwarder::new(&mut child);
stderr_forwarder.set_non_blocking()?; stderr_forwarder.set_non_blocking()?;
cell_update(&pendings, |mut pendings| { cell_update(&pendings, |mut pendings| {
pendings.push((cmd, KillOnDrop(child, stderr_forwarder), token)); pendings.push((cmd, program, KillOnDrop(child, stderr_forwarder), token));
pendings pendings
}); });
@@ -1738,29 +1741,43 @@ impl Build {
check_disabled()?; check_disabled()?;
for obj in objs { for obj in objs {
let mut cmd = self.create_compile_object_cmd(obj)?; let (mut cmd, name) = self.create_compile_object_cmd(obj)?;
run(&mut cmd, &self.cargo_output)?; run(&mut cmd, &name, &self.cargo_output)?;
} }
Ok(()) Ok(())
} }
fn create_compile_object_cmd(&self, obj: &Object) -> Result<Command, Error> { fn create_compile_object_cmd(
&self,
obj: &Object,
) -> Result<(Command, Cow<'static, Path>), Error> {
let asm_ext = AsmFileExt::from_path(&obj.src); let asm_ext = AsmFileExt::from_path(&obj.src);
let is_asm = asm_ext.is_some(); let is_asm = asm_ext.is_some();
let target = self.get_target()?; let target = self.get_target()?;
let msvc = target.env == "msvc"; let msvc = target.env == "msvc";
let compiler = self.try_get_compiler()?; let compiler = self.try_get_compiler()?;
let clang = compiler.is_like_clang();
let gnu = compiler.family == ToolFamily::Gnu;
let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm); let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm);
let mut cmd = if is_assembler_msvc { let (mut cmd, name) = if is_assembler_msvc {
self.msvc_macro_assembler()? let (cmd, name) = self.msvc_macro_assembler()?;
(cmd, Cow::Borrowed(Path::new(name)))
} else { } else {
let mut cmd = compiler.to_command(); let mut cmd = compiler.to_command();
for (a, b) in self.env.iter() { for (a, b) in self.env.iter() {
cmd.env(a, b); cmd.env(a, b);
} }
cmd (
cmd,
compiler
.path
.file_name()
.ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))
.map(PathBuf::from)
.map(Cow::Owned)?,
)
}; };
let is_arm = matches!(target.arch, "aarch64" | "arm"); let is_arm = matches!(target.arch, "aarch64" | "arm");
command_add_output_file( command_add_output_file(
@@ -1770,8 +1787,8 @@ impl Build {
cuda: self.cuda, cuda: self.cuda,
is_assembler_msvc, is_assembler_msvc,
msvc: compiler.is_like_msvc(), msvc: compiler.is_like_msvc(),
clang: compiler.is_like_clang(), clang,
gnu: compiler.is_like_gnu(), gnu,
is_asm, is_asm,
is_arm, is_arm,
}, },
@@ -1800,7 +1817,7 @@ impl Build {
self.fix_env_for_apple_os(&mut cmd)?; self.fix_env_for_apple_os(&mut cmd)?;
} }
Ok(cmd) Ok((cmd, name))
} }
/// This will return a result instead of panicking; see [`Self::expand()`] for /// This will return a result instead of panicking; see [`Self::expand()`] for
@@ -1835,7 +1852,12 @@ impl Build {
cmd.args(self.files.iter().map(std::ops::Deref::deref)); cmd.args(self.files.iter().map(std::ops::Deref::deref));
run_output(&mut cmd, &self.cargo_output) let name = compiler
.path
.file_name()
.ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?;
run_output(&mut cmd, name, &self.cargo_output)
} }
/// Run the compiler, returning the macro-expanded version of the input files. /// Run the compiler, returning the macro-expanded version of the input files.
@@ -1892,17 +1914,78 @@ impl Build {
let mut cmd = self.get_base_compiler()?; let mut cmd = self.get_base_compiler()?;
// The flags below are added in roughly the following order: // Disable default flag generation via `no_default_flags` or environment variable
// 1. Default flags let no_defaults = self.no_default_flags || self.getenv_boolean("CRATE_CC_NO_DEFAULTS");
// - Controlled by `cc-rs`.
// 2. `rustc`-inherited flags if !no_defaults {
// - Controlled by `rustc`. self.add_default_flags(&mut cmd, &target, &opt_level)?;
// 3. Builder flags }
// - Controlled by the developer using `cc-rs` in e.g. their `build.rs`.
// 4. Environment flags if let Some(ref std) = self.std {
// - Controlled by the end user. let separator = match cmd.family {
// ToolFamily::Msvc { .. } => ':',
// This is important to allow later flags to override previous ones. ToolFamily::Gnu | ToolFamily::Clang { .. } => '=',
};
cmd.push_cc_arg(format!("-std{}{}", separator, std).into());
}
for directory in self.include_directories.iter() {
cmd.args.push("-I".into());
cmd.args.push(directory.as_os_str().into());
}
if let Ok(flags) = self.envflags(if self.cpp { "CXXFLAGS" } else { "CFLAGS" }) {
for arg in flags {
cmd.push_cc_arg(arg.into());
}
}
// If warnings and/or extra_warnings haven't been explicitly set,
// then we set them only if the environment doesn't already have
// CFLAGS/CXXFLAGS, since those variables presumably already contain
// the desired set of warnings flags.
if self.warnings.unwrap_or(!self.has_flags()) {
let wflags = cmd.family.warnings_flags().into();
cmd.push_cc_arg(wflags);
}
if self.extra_warnings.unwrap_or(!self.has_flags()) {
if let Some(wflags) = cmd.family.extra_warnings_flags() {
cmd.push_cc_arg(wflags.into());
}
}
for flag in self.flags.iter() {
cmd.args.push((**flag).into());
}
// Add cc flags inherited from matching rustc flags
if self.inherit_rustflags {
self.add_inherited_rustflags(&mut cmd, &target)?;
}
for flag in self.flags_supported.iter() {
if self
.is_flag_supported_inner(flag, &cmd, &target)
.unwrap_or(false)
{
cmd.push_cc_arg((**flag).into());
}
}
for (key, value) in self.definitions.iter() {
if let Some(ref value) = *value {
cmd.args.push(format!("-D{}={}", key, value).into());
} else {
cmd.args.push(format!("-D{}", key).into());
}
}
if self.warnings_into_errors {
let warnings_to_errors_flag = cmd.family.warnings_to_errors_flag().into();
cmd.push_cc_arg(warnings_to_errors_flag);
}
// Copied from <https://github.com/rust-lang/rust/blob/5db81020006d2920fc9c62ffc0f4322f90bffa04/compiler/rustc_codegen_ssa/src/back/linker.rs#L27-L38> // Copied from <https://github.com/rust-lang/rust/blob/5db81020006d2920fc9c62ffc0f4322f90bffa04/compiler/rustc_codegen_ssa/src/back/linker.rs#L27-L38>
// //
@@ -1917,78 +2000,6 @@ impl Build {
cmd.env.push(("LC_ALL".into(), "C".into())); cmd.env.push(("LC_ALL".into(), "C".into()));
} }
// Disable default flag generation via `no_default_flags` or environment variable
let no_defaults = self.no_default_flags || self.getenv_boolean("CRATE_CC_NO_DEFAULTS");
if !no_defaults {
self.add_default_flags(&mut cmd, &target, &opt_level)?;
}
// Specify various flags that are not considered part of the default flags above.
// FIXME(madsmtm): Should these be considered part of the defaults? If no, why not?
if let Some(ref std) = self.std {
let separator = match cmd.family {
ToolFamily::Msvc { .. } => ':',
ToolFamily::Gnu | ToolFamily::Clang { .. } => '=',
};
cmd.push_cc_arg(format!("-std{}{}", separator, std).into());
}
for directory in self.include_directories.iter() {
cmd.args.push("-I".into());
cmd.args.push(directory.as_os_str().into());
}
if self.warnings_into_errors {
let warnings_to_errors_flag = cmd.family.warnings_to_errors_flag().into();
cmd.push_cc_arg(warnings_to_errors_flag);
}
// If warnings and/or extra_warnings haven't been explicitly set,
// then we set them only if the environment doesn't already have
// CFLAGS/CXXFLAGS, since those variables presumably already contain
// the desired set of warnings flags.
let envflags = self.envflags(if self.cpp { "CXXFLAGS" } else { "CFLAGS" })?;
if self.warnings.unwrap_or(envflags.is_none()) {
let wflags = cmd.family.warnings_flags().into();
cmd.push_cc_arg(wflags);
}
if self.extra_warnings.unwrap_or(envflags.is_none()) {
if let Some(wflags) = cmd.family.extra_warnings_flags() {
cmd.push_cc_arg(wflags.into());
}
}
// Add cc flags inherited from matching rustc flags.
if self.inherit_rustflags {
self.add_inherited_rustflags(&mut cmd, &target)?;
}
// Set flags configured in the builder (do this second-to-last, to allow these to override
// everything above).
for flag in self.flags.iter() {
cmd.args.push((**flag).into());
}
for flag in self.flags_supported.iter() {
if self
.is_flag_supported_inner(flag, &cmd, &target)
.unwrap_or(false)
{
cmd.push_cc_arg((**flag).into());
}
}
for (key, value) in self.definitions.iter() {
if let Some(ref value) = *value {
cmd.args.push(format!("-D{}={}", key, value).into());
} else {
cmd.args.push(format!("-D{}", key).into());
}
}
// Set flags from the environment (do this last, to allow these to override everything else).
if let Some(flags) = &envflags {
for arg in flags {
cmd.push_cc_arg(arg.into());
}
}
Ok(cmd) Ok(cmd)
} }
@@ -2183,34 +2194,21 @@ impl Build {
// Pass `--target` with the LLVM target to configure Clang for cross-compiling. // Pass `--target` with the LLVM target to configure Clang for cross-compiling.
// //
// This is **required** for cross-compilation, as it's the only flag that // NOTE: In the past, we passed this, along with the deployment version in here
// consistently forces Clang to change the "toolchain" that is responsible for // on Apple targets, but versioned targets were found to have poor compatibility
// parsing target-specific flags: // with older versions of Clang, especially around comes to configuration files.
// https://github.com/rust-lang/cc-rs/issues/1388
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.7/clang/lib/Driver/Driver.cpp#L1359-L1360
// https://github.com/llvm/llvm-project/blob/llvmorg-19.1.7/clang/lib/Driver/Driver.cpp#L6347-L6532
// //
// This can be confusing, because on e.g. host macOS, you can usually get by // Instead, we specify `-arch` along with `-mmacosx-version-min=`, `-mtargetos=`
// with `-arch` and `-mtargetos=`. But that only works because the _default_ // and similar flags in `.apple_flags()`.
// toolchain is `Darwin`, which enables parsing of darwin-specific options.
// //
// NOTE: In the past, we passed the deployment version in here on all Apple // Note that Clang errors when both `-mtargetos=` and `-target` are specified,
// targets, but versioned targets were found to have poor compatibility with // so we omit this entirely on Apple targets (it's redundant when specifying
// older versions of Clang, especially when it comes to configuration files: // both the `-arch` and the deployment target / OS flag) (in theory we _could_
// https://github.com/rust-lang/cc-rs/issues/1278 // specify this on some of the Apple targets that use the older
// // `-m*-version-min=`, but for consistency we omit it entirely).
// So instead, we pass the deployment target with `-m*-version-min=`, and only if target.vendor != "apple" {
// pass it here on visionOS and Mac Catalyst where that option does not exist: cmd.push_cc_arg(format!("--target={}", target.llvm_target).into());
// https://github.com/rust-lang/cc-rs/issues/1383 }
let clang_target = if target.os == "visionos" || target.abi == "macabi" {
Cow::Owned(
target.versioned_llvm_target(&self.apple_deployment_target(target)),
)
} else {
Cow::Borrowed(target.llvm_target)
};
cmd.push_cc_arg(format!("--target={clang_target}").into());
} }
} }
ToolFamily::Msvc { clang_cl } => { ToolFamily::Msvc { clang_cl } => {
@@ -2224,16 +2222,7 @@ impl Build {
cmd.push_cc_arg("-m64".into()); cmd.push_cc_arg("-m64".into());
} else if target.arch == "x86" { } else if target.arch == "x86" {
cmd.push_cc_arg("-m32".into()); cmd.push_cc_arg("-m32".into());
// See cmd.push_cc_arg("-arch:IA32".into());
// <https://learn.microsoft.com/en-us/cpp/build/reference/arch-x86?view=msvc-170>.
//
// NOTE: Rust officially supported Windows targets all require SSE2 as part
// of baseline target features.
//
// NOTE: The same applies for STL. See: -
// <https://github.com/microsoft/STL/issues/3922>, and -
// <https://github.com/microsoft/STL/pull/4741>.
cmd.push_cc_arg("-arch:SSE2".into());
} else { } else {
cmd.push_cc_arg(format!("--target={}", target.llvm_target).into()); cmd.push_cc_arg(format!("--target={}", target.llvm_target).into());
} }
@@ -2468,7 +2457,13 @@ impl Build {
Ok(()) Ok(())
} }
fn msvc_macro_assembler(&self) -> Result<Command, Error> { fn has_flags(&self) -> bool {
let flags_env_var_name = if self.cpp { "CXXFLAGS" } else { "CFLAGS" };
let flags_env_var_value = self.getenv_with_target_prefixes(flags_env_var_name);
flags_env_var_value.is_ok()
}
fn msvc_macro_assembler(&self) -> Result<(Command, &'static str), Error> {
let target = self.get_target()?; let target = self.get_target()?;
let tool = if target.arch == "x86_64" { let tool = if target.arch == "x86_64" {
"ml64.exe" "ml64.exe"
@@ -2523,7 +2518,7 @@ impl Build {
cmd.arg("-safeseh"); cmd.arg("-safeseh");
} }
Ok(cmd) Ok((cmd, tool))
} }
fn assemble(&self, lib_name: &str, dst: &Path, objs: &[Object]) -> Result<(), Error> { fn assemble(&self, lib_name: &str, dst: &Path, objs: &[Object]) -> Result<(), Error> {
@@ -2551,7 +2546,7 @@ impl Build {
let dlink = out_dir.join(lib_name.to_owned() + "_dlink.o"); let dlink = out_dir.join(lib_name.to_owned() + "_dlink.o");
let mut nvcc = self.get_compiler().to_command(); let mut nvcc = self.get_compiler().to_command();
nvcc.arg("--device-link").arg("-o").arg(&dlink).arg(dst); nvcc.arg("--device-link").arg("-o").arg(&dlink).arg(dst);
run(&mut nvcc, &self.cargo_output)?; run(&mut nvcc, "nvcc", &self.cargo_output)?;
self.assemble_progressive(dst, &[dlink.as_path()])?; self.assemble_progressive(dst, &[dlink.as_path()])?;
} }
@@ -2579,12 +2574,12 @@ impl Build {
// Non-msvc targets (those using `ar`) need a separate step to add // Non-msvc targets (those using `ar`) need a separate step to add
// the symbol table to archives since our construction command of // the symbol table to archives since our construction command of
// `cq` doesn't add it for us. // `cq` doesn't add it for us.
let mut ar = self.try_get_archiver()?; let (mut ar, cmd, _any_flags) = self.get_ar()?;
// NOTE: We add `s` even if flags were passed using $ARFLAGS/ar_flag, because `s` // NOTE: We add `s` even if flags were passed using $ARFLAGS/ar_flag, because `s`
// here represents a _mode_, not an arbitrary flag. Further discussion of this choice // here represents a _mode_, not an arbitrary flag. Further discussion of this choice
// can be seen in https://github.com/rust-lang/cc-rs/pull/763. // can be seen in https://github.com/rust-lang/cc-rs/pull/763.
run(ar.arg("s").arg(dst), &self.cargo_output)?; run(ar.arg("s").arg(dst), &cmd, &self.cargo_output)?;
} }
Ok(()) Ok(())
@@ -2593,7 +2588,7 @@ impl Build {
fn assemble_progressive(&self, dst: &Path, objs: &[&Path]) -> Result<(), Error> { fn assemble_progressive(&self, dst: &Path, objs: &[&Path]) -> Result<(), Error> {
let target = self.get_target()?; let target = self.get_target()?;
let (mut cmd, program, any_flags) = self.try_get_archiver_and_flags()?; let (mut cmd, program, any_flags) = self.get_ar()?;
if target.env == "msvc" && !program.to_string_lossy().contains("llvm-ar") { if target.env == "msvc" && !program.to_string_lossy().contains("llvm-ar") {
// NOTE: -out: here is an I/O flag, and so must be included even if $ARFLAGS/ar_flag is // NOTE: -out: here is an I/O flag, and so must be included even if $ARFLAGS/ar_flag is
// in use. -nologo on the other hand is just a regular flag, and one that we'll skip if // in use. -nologo on the other hand is just a regular flag, and one that we'll skip if
@@ -2611,7 +2606,7 @@ impl Build {
cmd.arg(dst); cmd.arg(dst);
} }
cmd.args(objs); cmd.args(objs);
run(&mut cmd, &self.cargo_output)?; run(&mut cmd, &program, &self.cargo_output)?;
} else { } else {
// Set an environment variable to tell the OSX archiver to ensure // Set an environment variable to tell the OSX archiver to ensure
// that all dates listed in the archive are zero, improving // that all dates listed in the archive are zero, improving
@@ -2640,7 +2635,11 @@ impl Build {
// NOTE: We add cq here regardless of whether $ARFLAGS/ar_flag have been used because // NOTE: We add cq here regardless of whether $ARFLAGS/ar_flag have been used because
// it dictates the _mode_ ar runs in, which the setter of $ARFLAGS/ar_flag can't // it dictates the _mode_ ar runs in, which the setter of $ARFLAGS/ar_flag can't
// dictate. See https://github.com/rust-lang/cc-rs/pull/763 for further discussion. // dictate. See https://github.com/rust-lang/cc-rs/pull/763 for further discussion.
run(cmd.arg("cq").arg(dst).args(objs), &self.cargo_output)?; run(
cmd.arg("cq").arg(dst).args(objs),
&program,
&self.cargo_output,
)?;
} }
Ok(()) Ok(())
@@ -2649,29 +2648,21 @@ impl Build {
fn apple_flags(&self, cmd: &mut Tool) -> Result<(), Error> { fn apple_flags(&self, cmd: &mut Tool) -> Result<(), Error> {
let target = self.get_target()?; let target = self.get_target()?;
// This is a Darwin/Apple-specific flag that works both on GCC and Clang, but it is only // Add `-arch` on all compilers. This is a Darwin/Apple-specific flag
// necessary on GCC since we specify `-target` on Clang. // that works both on GCC and Clang.
// https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#:~:text=arch // https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html#:~:text=arch
// https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-arch // https://clang.llvm.org/docs/CommandGuide/clang.html#cmdoption-arch
if cmd.is_like_gnu() { let arch = map_darwin_target_from_rust_to_compiler_architecture(&target);
let arch = map_darwin_target_from_rust_to_compiler_architecture(&target); cmd.args.push("-arch".into());
cmd.args.push("-arch".into()); cmd.args.push(arch.into());
cmd.args.push(arch.into());
}
// Pass the deployment target via `-mmacosx-version-min=`, `-miphoneos-version-min=` and // Pass the deployment target via `-mmacosx-version-min=`, `-mtargetos=` and similar.
// similar. Also necessary on GCC, as it forces a compilation error if the compiler is not
// configured for Darwin: https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html
// //
// On visionOS and Mac Catalyst, there is no -m*-version-min= flag: // It is also necessary on GCC, as it forces a compilation error if the compiler is not
// https://github.com/llvm/llvm-project/issues/88271 // configured for Darwin: https://gcc.gnu.org/onlinedocs/gcc/Darwin-Options.html
// And the workaround to use `-mtargetos=` cannot be used with the `--target` flag that we let min_version = self.apple_deployment_target(&target);
// otherwise specify. So we avoid emitting that, and put the version in `--target` instead. cmd.args
if cmd.is_like_gnu() || !(target.os == "visionos" || target.abi == "macabi") { .push(target.apple_version_flag(&min_version).into());
let min_version = self.apple_deployment_target(&target);
cmd.args
.push(target.apple_version_flag(&min_version).into());
}
// AppleClang sometimes requires sysroot even on macOS // AppleClang sometimes requires sysroot even on macOS
if cmd.is_xctoolchain_clang() || target.os != "macos" { if cmd.is_xctoolchain_clang() || target.os != "macos" {
@@ -3102,6 +3093,10 @@ impl Build {
} }
} }
fn get_ar(&self) -> Result<(Command, PathBuf, bool), Error> {
self.try_get_archiver_and_flags()
}
/// Get the archiver (ar) that's in use for this configuration. /// Get the archiver (ar) that's in use for this configuration.
/// ///
/// You can use [`Command::get_program`] to get just the path to the command. /// You can use [`Command::get_program`] to get just the path to the command.
@@ -3134,8 +3129,8 @@ impl Build {
fn try_get_archiver_and_flags(&self) -> Result<(Command, PathBuf, bool), Error> { fn try_get_archiver_and_flags(&self) -> Result<(Command, PathBuf, bool), Error> {
let (mut cmd, name) = self.get_base_archiver()?; let (mut cmd, name) = self.get_base_archiver()?;
let mut any_flags = false; let mut any_flags = false;
if let Some(flags) = self.envflags("ARFLAGS")? { if let Ok(flags) = self.envflags("ARFLAGS") {
any_flags = true; any_flags |= !flags.is_empty();
cmd.args(flags); cmd.args(flags);
} }
for flag in &self.ar_flags { for flag in &self.ar_flags {
@@ -3181,7 +3176,7 @@ impl Build {
/// see [`Self::get_ranlib`] for the complete description. /// see [`Self::get_ranlib`] for the complete description.
pub fn try_get_ranlib(&self) -> Result<Command, Error> { pub fn try_get_ranlib(&self) -> Result<Command, Error> {
let mut cmd = self.get_base_ranlib()?; let mut cmd = self.get_base_ranlib()?;
if let Some(flags) = self.envflags("RANLIBFLAGS")? { if let Ok(flags) = self.envflags("RANLIBFLAGS") {
cmd.args(flags); cmd.args(flags);
} }
Ok(cmd) Ok(cmd)
@@ -3245,6 +3240,7 @@ impl Build {
} }
}); });
let default = tool.to_string();
let tool = match tool_opt { let tool = match tool_opt {
Some(t) => t, Some(t) => t,
None => { None => {
@@ -3305,7 +3301,7 @@ impl Build {
self.cmd(&name) self.cmd(&name)
} else if self.get_is_cross_compile()? { } else if self.get_is_cross_compile()? {
match self.prefix_for_target(&self.get_raw_target()?) { match self.prefix_for_target(&self.get_raw_target()?) {
Some(prefix) => { Some(p) => {
// GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both. // GCC uses $target-gcc-ar, whereas binutils uses $target-ar -- try both.
// Prefer -ar if it exists, as builds of `-gcc-ar` have been observed to be // Prefer -ar if it exists, as builds of `-gcc-ar` have been observed to be
// outright broken (such as when targeting freebsd with `--disable-lto` // outright broken (such as when targeting freebsd with `--disable-lto`
@@ -3313,31 +3309,24 @@ impl Build {
// fails to find one). // fails to find one).
// //
// The same applies to ranlib. // The same applies to ranlib.
let chosen = ["", "-gcc"] let mut chosen = default;
.iter() for &infix in &["", "-gcc"] {
.filter_map(|infix| { let target_p = format!("{}{}-{}", p, infix, tool);
let target_p = format!("{prefix}{infix}-{tool}"); if Command::new(&target_p).output().is_ok() {
let status = Command::new(&target_p) chosen = target_p;
.arg("--version") break;
.stdin(Stdio::null()) }
.stdout(Stdio::null()) }
.stderr(Stdio::null())
.status()
.ok()?;
status.success().then_some(target_p)
})
.next()
.unwrap_or_else(|| tool.to_string());
name = chosen.into(); name = chosen.into();
self.cmd(&name) self.cmd(&name)
} }
None => { None => {
name = tool.into(); name = default.into();
self.cmd(&name) self.cmd(&name)
} }
} }
} else { } else {
name = tool.into(); name = default.into();
self.cmd(&name) self.cmd(&name)
} }
} }
@@ -3668,8 +3657,7 @@ impl Build {
}) })
} }
/// The list of environment variables to check for a given env, in order of priority. fn getenv_with_target_prefixes(&self, var_base: &str) -> Result<Arc<OsStr>, Error> {
fn target_envs(&self, env: &str) -> Result<[String; 4], Error> {
let target = self.get_raw_target()?; let target = self.get_raw_target()?;
let kind = if self.get_is_cross_compile()? { let kind = if self.get_is_cross_compile()? {
"TARGET" "TARGET"
@@ -3677,55 +3665,33 @@ impl Build {
"HOST" "HOST"
}; };
let target_u = target.replace('-', "_"); let target_u = target.replace('-', "_");
Ok([
format!("{env}_{target}"),
format!("{env}_{target_u}"),
format!("{kind}_{env}"),
env.to_string(),
])
}
/// Get a single-valued environment variable with target variants.
fn getenv_with_target_prefixes(&self, env: &str) -> Result<Arc<OsStr>, Error> {
// Take from first environment variable in the environment.
let res = self let res = self
.target_envs(env)? .getenv(&format!("{}_{}", var_base, target))
.iter() .or_else(|| self.getenv(&format!("{}_{}", var_base, target_u)))
.filter_map(|env| self.getenv(env)) .or_else(|| self.getenv(&format!("{}_{}", kind, var_base)))
.next(); .or_else(|| self.getenv(var_base));
match res { match res {
Some(res) => Ok(res), Some(res) => Ok(res),
None => Err(Error::new( None => Err(Error::new(
ErrorKind::EnvVarNotFound, ErrorKind::EnvVarNotFound,
format!("could not find environment variable {env}"), format!("Could not find environment variable {}.", var_base),
)), )),
} }
} }
/// Get values from CFLAGS-style environment variable. fn envflags(&self, name: &str) -> Result<Vec<String>, Error> {
fn envflags(&self, env: &str) -> Result<Option<Vec<String>>, Error> { let env_os = self.getenv_with_target_prefixes(name)?;
// Collect from all environment variables, in reverse order as in let env = env_os.to_string_lossy();
// `getenv_with_target_prefixes` precedence (so that `CFLAGS_$TARGET`
// can override flags in `TARGET_CFLAGS`, which overrides those in
// `CFLAGS`).
let mut any_set = false;
let mut res = vec![];
for env in self.target_envs(env)?.iter().rev() {
if let Some(var) = self.getenv(env) {
any_set = true;
let var = var.to_string_lossy(); if self.get_shell_escaped_flags() {
if self.get_shell_escaped_flags() { Ok(Shlex::new(&env).collect())
res.extend(Shlex::new(&var)); } else {
} else { Ok(env
res.extend(var.split_ascii_whitespace().map(ToString::to_string)); .split_ascii_whitespace()
} .map(ToString::to_string)
} .collect())
} }
Ok(if any_set { Some(res) } else { None })
} }
fn fix_env_for_apple_os(&self, cmd: &mut Command) -> Result<(), Error> { fn fix_env_for_apple_os(&self, cmd: &mut Command) -> Result<(), Error> {
@@ -3777,6 +3743,7 @@ impl Build {
.arg("--show-sdk-path") .arg("--show-sdk-path")
.arg("--sdk") .arg("--sdk")
.arg(sdk), .arg(sdk),
"xcrun",
&self.cargo_output, &self.cargo_output,
)?; )?;
@@ -3833,6 +3800,7 @@ impl Build {
.arg("--show-sdk-version") .arg("--show-sdk-version")
.arg("--sdk") .arg("--sdk")
.arg(sdk), .arg(sdk),
"xcrun",
&self.cargo_output, &self.cargo_output,
) )
.ok()?; .ok()?;
@@ -4003,6 +3971,7 @@ impl Build {
) -> Option<PathBuf> { ) -> Option<PathBuf> {
let search_dirs = run_output( let search_dirs = run_output(
cc.arg("-print-search-dirs"), cc.arg("-print-search-dirs"),
"cc",
// this doesn't concern the compilation so we always want to show warnings. // this doesn't concern the compilation so we always want to show warnings.
cargo_output, cargo_output,
) )

View File

@@ -508,18 +508,6 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "aarch64_be-unknown-netbsd", llvm_target: "aarch64_be-unknown-netbsd",
}, },
), ),
(
"amdgcn-amd-amdhsa",
TargetInfo {
full_arch: "amdgcn",
arch: "amdgpu",
vendor: "amd",
os: "amdhsa",
env: "",
abi: "",
llvm_target: "amdgcn-amd-amdhsa",
},
),
( (
"arm-linux-androideabi", "arm-linux-androideabi",
TargetInfo { TargetInfo {
@@ -1108,18 +1096,6 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "wasm32-unknown-emscripten", llvm_target: "wasm32-unknown-emscripten",
}, },
), ),
(
"avr-none",
TargetInfo {
full_arch: "avr",
arch: "avr",
vendor: "unknown",
os: "none",
env: "",
abi: "",
llvm_target: "avr-unknown-unknown",
},
),
( (
"avr-unknown-gnu-atmega328", "avr-unknown-gnu-atmega328",
TargetInfo { TargetInfo {
@@ -1127,7 +1103,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
arch: "avr", arch: "avr",
vendor: "unknown", vendor: "unknown",
os: "none", os: "none",
env: "", env: "gnu",
abi: "", abi: "",
llvm_target: "avr-unknown-unknown", llvm_target: "avr-unknown-unknown",
}, },
@@ -1216,6 +1192,18 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "i386-apple-ios-simulator", llvm_target: "i386-apple-ios-simulator",
}, },
), ),
(
"i586-pc-nto-qnx700",
TargetInfo {
full_arch: "i586",
arch: "x86",
vendor: "pc",
os: "nto",
env: "nto70",
abi: "",
llvm_target: "i586-pc-unknown",
},
),
( (
"i586-pc-windows-msvc", "i586-pc-windows-msvc",
TargetInfo { TargetInfo {
@@ -1264,18 +1252,6 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "i586-unknown-netbsdelf", llvm_target: "i586-unknown-netbsdelf",
}, },
), ),
(
"i586-unknown-redox",
TargetInfo {
full_arch: "i586",
arch: "x86",
vendor: "unknown",
os: "redox",
env: "relibc",
abi: "",
llvm_target: "i586-unknown-redox",
},
),
( (
"i686-apple-darwin", "i686-apple-darwin",
TargetInfo { TargetInfo {
@@ -1300,18 +1276,6 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "i686-linux-android", llvm_target: "i686-linux-android",
}, },
), ),
(
"i686-pc-nto-qnx700",
TargetInfo {
full_arch: "i686",
arch: "x86",
vendor: "pc",
os: "nto",
env: "nto70",
abi: "",
llvm_target: "i586-pc-unknown",
},
),
( (
"i686-pc-windows-gnu", "i686-pc-windows-gnu",
TargetInfo { TargetInfo {
@@ -1432,6 +1396,18 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "i686-unknown-openbsd", llvm_target: "i686-unknown-openbsd",
}, },
), ),
(
"i686-unknown-redox",
TargetInfo {
full_arch: "i686",
arch: "x86",
vendor: "unknown",
os: "redox",
env: "relibc",
abi: "",
llvm_target: "i686-unknown-redox",
},
),
( (
"i686-unknown-uefi", "i686-unknown-uefi",
TargetInfo { TargetInfo {
@@ -3040,18 +3016,6 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
llvm_target: "x86_64-linux-android", llvm_target: "x86_64-linux-android",
}, },
), ),
(
"x86_64-pc-cygwin",
TargetInfo {
full_arch: "x86_64",
arch: "x86_64",
vendor: "pc",
os: "cygwin",
env: "",
abi: "",
llvm_target: "x86_64-pc-cygwin",
},
),
( (
"x86_64-pc-nto-qnx710", "x86_64-pc-nto-qnx710",
TargetInfo { TargetInfo {

View File

@@ -1,26 +1,3 @@
use super::TargetInfo;
impl TargetInfo<'_> {
/// The versioned LLVM/Clang target triple.
pub(crate) fn versioned_llvm_target(&self, version: &str) -> String {
// Only support versioned Apple targets for now.
assert_eq!(self.vendor, "apple");
let mut components = self.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");
if let Some(env) = environment {
format!("{arch}-{vendor}-{os}{version}-{env}")
} else {
format!("{arch}-{vendor}-{os}{version}")
}
}
}
/// Rust and Clang don't really agree on naming, so do a best-effort /// Rust and Clang don't really agree on naming, so do a best-effort
/// conversion to support out-of-tree / custom target-spec targets. /// conversion to support out-of-tree / custom target-spec targets.
pub(crate) fn guess_llvm_target_triple( pub(crate) fn guess_llvm_target_triple(
@@ -42,8 +19,7 @@ pub(crate) fn guess_llvm_target_triple(
os => os, os => os,
}; };
let env = match env { let env = match env {
"newlib" | "nto70" | "nto71" | "nto71_iosock" | "ohos" | "p1" | "p2" | "relibc" | "sgx" "newlib" | "nto70" | "nto71" | "ohos" | "p1" | "p2" | "relibc" | "sgx" | "uclibc" => "",
| "uclibc" => "",
env => env, env => env,
}; };
let abi = match abi { let abi = match abi {

View File

@@ -99,6 +99,7 @@ impl Tool {
fn is_zig_cc(path: &Path, cargo_output: &CargoOutput) -> bool { fn is_zig_cc(path: &Path, cargo_output: &CargoOutput) -> bool {
run_output( run_output(
Command::new(path).arg("--version"), Command::new(path).arg("--version"),
path,
// tool detection issues should always be shown as warnings // tool detection issues should always be shown as warnings
cargo_output, cargo_output,
) )
@@ -124,6 +125,7 @@ impl Tool {
// stdin is set to null to ensure that the help output is never paginated. // stdin is set to null to ensure that the help output is never paginated.
let accepts_cl_style_flags = run( let accepts_cl_style_flags = run(
Command::new(path).args(args).arg("-?").stdin(Stdio::null()), Command::new(path).args(args).arg("-?").stdin(Stdio::null()),
path,
&{ &{
// the errors are not errors! // the errors are not errors!
let mut cargo_output = cargo_output.clone(); let mut cargo_output = cargo_output.clone();
@@ -200,6 +202,7 @@ impl Tool {
let stdout = run_output( let stdout = run_output(
Command::new(path).arg("-E").arg(tmp.path()), Command::new(path).arg("-E").arg(tmp.path()),
path,
&compiler_detect_output, &compiler_detect_output,
)?; )?;
let stdout = String::from_utf8_lossy(&stdout); let stdout = String::from_utf8_lossy(&stdout);
@@ -207,6 +210,7 @@ impl Tool {
if stdout.contains("-Wslash-u-filename") { if stdout.contains("-Wslash-u-filename") {
let stdout = run_output( let stdout = run_output(
Command::new(path).arg("-E").arg("--").arg(tmp.path()), Command::new(path).arg("-E").arg("--").arg(tmp.path()),
path,
&compiler_detect_output, &compiler_detect_output,
)?; )?;
let stdout = String::from_utf8_lossy(&stdout); let stdout = String::from_utf8_lossy(&stdout);

View File

@@ -4,10 +4,10 @@
// This is used in the crate's public API, so don't use #[cfg(windows)] // This is used in the crate's public API, so don't use #[cfg(windows)]
pub mod find_tools; pub mod find_tools;
#[cfg(windows)]
mod windows_link;
#[cfg(windows)] #[cfg(windows)]
pub(crate) mod windows_sys; pub(crate) mod windows_sys;
#[cfg(windows)]
mod windows_targets;
#[cfg(windows)] #[cfg(windows)]
mod registry; mod registry;

View File

@@ -6,7 +6,7 @@
// cd generate-windows-sys/ // cd generate-windows-sys/
// cargo run // cargo run
// ``` // ```
// Bindings generated by `windows-bindgen` 0.60.0 // Bindings generated by `windows-bindgen` 0.59.0
#![allow( #![allow(
non_snake_case, non_snake_case,
@@ -16,22 +16,22 @@
clippy::all clippy::all
)] )]
windows_link::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : * mut core::ffi::c_void, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut core::ffi::c_void) -> HRESULT); windows_targets::link!("ole32.dll" "system" fn CoCreateInstance(rclsid : *const GUID, punkouter : * mut core::ffi::c_void, dwclscontext : CLSCTX, riid : *const GUID, ppv : *mut *mut core::ffi::c_void) -> HRESULT);
windows_link::link!("ole32.dll" "system" fn CoInitializeEx(pvreserved : *const core::ffi::c_void, dwcoinit : u32) -> HRESULT); windows_targets::link!("ole32.dll" "system" fn CoInitializeEx(pvreserved : *const core::ffi::c_void, dwcoinit : u32) -> HRESULT);
windows_link::link!("kernel32.dll" "system" fn FreeLibrary(hlibmodule : HMODULE) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn FreeLibrary(hlibmodule : HMODULE) -> BOOL);
windows_link::link!("kernel32.dll" "system" fn GetMachineTypeAttributes(machine : u16, machinetypeattributes : *mut MACHINE_ATTRIBUTES) -> HRESULT); windows_targets::link!("kernel32.dll" "system" fn GetMachineTypeAttributes(machine : u16, machinetypeattributes : *mut MACHINE_ATTRIBUTES) -> HRESULT);
windows_link::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC); windows_targets::link!("kernel32.dll" "system" fn GetProcAddress(hmodule : HMODULE, lpprocname : PCSTR) -> FARPROC);
windows_link::link!("kernel32.dll" "system" fn LoadLibraryA(lplibfilename : PCSTR) -> HMODULE); windows_targets::link!("kernel32.dll" "system" fn LoadLibraryA(lplibfilename : PCSTR) -> HMODULE);
windows_link::link!("kernel32.dll" "system" fn OpenSemaphoreA(dwdesiredaccess : u32, binherithandle : BOOL, lpname : PCSTR) -> HANDLE); windows_targets::link!("kernel32.dll" "system" fn OpenSemaphoreA(dwdesiredaccess : u32, binherithandle : BOOL, lpname : PCSTR) -> HANDLE);
windows_link::link!("kernel32.dll" "system" fn PeekNamedPipe(hnamedpipe : HANDLE, lpbuffer : *mut core::ffi::c_void, nbuffersize : u32, lpbytesread : *mut u32, lptotalbytesavail : *mut u32, lpbytesleftthismessage : *mut u32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn PeekNamedPipe(hnamedpipe : HANDLE, lpbuffer : *mut core::ffi::c_void, nbuffersize : u32, lpbytesread : *mut u32, lptotalbytesavail : *mut u32, lpbytesleftthismessage : *mut u32) -> BOOL);
windows_link::link!("advapi32.dll" "system" fn RegCloseKey(hkey : HKEY) -> WIN32_ERROR); windows_targets::link!("advapi32.dll" "system" fn RegCloseKey(hkey : HKEY) -> WIN32_ERROR);
windows_link::link!("advapi32.dll" "system" fn RegEnumKeyExW(hkey : HKEY, dwindex : u32, lpname : PWSTR, lpcchname : *mut u32, lpreserved : *const u32, lpclass : PWSTR, lpcchclass : *mut u32, lpftlastwritetime : *mut FILETIME) -> WIN32_ERROR); windows_targets::link!("advapi32.dll" "system" fn RegEnumKeyExW(hkey : HKEY, dwindex : u32, lpname : PWSTR, lpcchname : *mut u32, lpreserved : *const u32, lpclass : PWSTR, lpcchclass : *mut u32, lpftlastwritetime : *mut FILETIME) -> WIN32_ERROR);
windows_link::link!("advapi32.dll" "system" fn RegOpenKeyExW(hkey : HKEY, lpsubkey : PCWSTR, uloptions : u32, samdesired : REG_SAM_FLAGS, phkresult : *mut HKEY) -> WIN32_ERROR); windows_targets::link!("advapi32.dll" "system" fn RegOpenKeyExW(hkey : HKEY, lpsubkey : PCWSTR, uloptions : u32, samdesired : REG_SAM_FLAGS, phkresult : *mut HKEY) -> WIN32_ERROR);
windows_link::link!("advapi32.dll" "system" fn RegQueryValueExW(hkey : HKEY, lpvaluename : PCWSTR, lpreserved : *const u32, lptype : *mut REG_VALUE_TYPE, lpdata : *mut u8, lpcbdata : *mut u32) -> WIN32_ERROR); windows_targets::link!("advapi32.dll" "system" fn RegQueryValueExW(hkey : HKEY, lpvaluename : PCWSTR, lpreserved : *const u32, lptype : *mut REG_VALUE_TYPE, lpdata : *mut u8, lpcbdata : *mut u32) -> WIN32_ERROR);
windows_link::link!("kernel32.dll" "system" fn ReleaseSemaphore(hsemaphore : HANDLE, lreleasecount : i32, lppreviouscount : *mut i32) -> BOOL); windows_targets::link!("kernel32.dll" "system" fn ReleaseSemaphore(hsemaphore : HANDLE, lreleasecount : i32, lppreviouscount : *mut i32) -> BOOL);
windows_link::link!("oleaut32.dll" "system" fn SysFreeString(bstrstring : BSTR)); windows_targets::link!("oleaut32.dll" "system" fn SysFreeString(bstrstring : BSTR));
windows_link::link!("oleaut32.dll" "system" fn SysStringLen(pbstr : BSTR) -> u32); windows_targets::link!("oleaut32.dll" "system" fn SysStringLen(pbstr : BSTR) -> u32);
windows_link::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT); windows_targets::link!("kernel32.dll" "system" fn WaitForSingleObject(hhandle : HANDLE, dwmilliseconds : u32) -> WAIT_EVENT);
pub type ADVANCED_FEATURE_FLAGS = u16; pub type ADVANCED_FEATURE_FLAGS = u16;
pub type BOOL = i32; pub type BOOL = i32;
pub type BSTR = *const u16; pub type BSTR = *const u16;
@@ -131,4 +131,4 @@ pub type WIN32_ERROR = u32;
#[link(name = "ole32")] #[link(name = "ole32")]
#[link(name = "oleaut32")] #[link(name = "oleaut32")]
extern "C" {} extern "C" {}
use super::windows_link; use super::windows_targets;