Skip to content

Commit

Permalink
Support *-unknown-linux-gnu under hermetic_cc_toolchain
Browse files Browse the repository at this point in the history
This fork provides a temporary fix for ziglang/zig#4911,
by making our current Rust builds not generate targets that `zig cc`
doesn't understand.
  • Loading branch information
mattbryant-asana committed Feb 27, 2025
1 parent 9131f33 commit 8eb9bdc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2206,6 +2206,15 @@ impl Build {
Cow::Owned(
target.versioned_llvm_target(&self.apple_deployment_target(target)),
)
} else if target.vendor == "unknown" && target.os == "linux" && target.abi == "gnu" {
// Special case the `<foo>-unknown-linux-gnu` target triple, since Bazel's
// hermetic build system doesn't support these target quads.
match target.arch {
"x86_64" => Cow::Borrowed("x86_64-linux-gnu"),
"aarch64" => Cow::Borrowed("aarch64-linux-gnu"),
"arm64" => Cow::Borrowed("arm64-linux-gnu"),
_ => panic!("Unsupported target triple - please update the cc-rs patch"),
}
} else {
Cow::Borrowed(target.llvm_target)
};
Expand Down

0 comments on commit 8eb9bdc

Please sign in to comment.