Skip to content

Commit

Permalink
Rename unversioned_llvm_target to llvm_target
Browse files Browse the repository at this point in the history
Since we no longer version the LLVM target, it is no longer that
important to call out that the LLVM target is unversioned.
  • Loading branch information
madsmtm committed Jan 1, 2025
1 parent 1136a7d commit 5fc270a
Show file tree
Hide file tree
Showing 5 changed files with 291 additions and 304 deletions.
19 changes: 4 additions & 15 deletions dev-tools/gen-target-info/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,9 @@ fn generate_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std
let env = spec.env.as_deref().unwrap_or("");
let abi = spec.abi.as_deref().unwrap_or("");

let unversioned_llvm_target = if spec.llvm_target.contains("apple") {
// Remove deployment target information from LLVM target triples (we
// will add this in another part of CC).
//
// FIXME(madsmtm): Should become unnecessary after
// https://github.com/rust-lang/rust/pull/131037
let mut components = spec.llvm_target.split("-").collect::<Vec<_>>();

components[2] = components[2].trim_end_matches(|c: char| c.is_numeric() || c == '.');

components.join("-")
// FIXME(madsmtm): Unnecessary once we bump MSRV to Rust 1.74
let llvm_target = if spec.llvm_target == "armv7-apple-ios7.0.0" {
"armv7-apple-ios".to_string()
} else if os == "uefi" {
// Override the UEFI LLVM targets.
//
Expand Down Expand Up @@ -80,10 +72,7 @@ fn generate_target_mapping(f: &mut File, target_specs: &RustcTargetSpecs) -> std
writeln!(f, " os: {os:?},")?;
writeln!(f, " env: {env:?},")?;
writeln!(f, " abi: {abi:?},")?;
writeln!(
f,
" unversioned_llvm_target: {unversioned_llvm_target:?},"
)?;
writeln!(f, " llvm_target: {llvm_target:?},")?;
writeln!(f, " }},")?;
writeln!(f, " ),")?;
}
Expand Down
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2189,7 +2189,7 @@ impl Build {
// and instead pass that via `-mmacosx-version-min=` and similar flags, for
// better compatibility with older versions of Clang that has poor support for
// versioned target names (especially when it comes to configuration files).
cmd.push_cc_arg(format!("--target={}", target.unversioned_llvm_target).into());
cmd.push_cc_arg(format!("--target={}", target.llvm_target).into());
}
}
ToolFamily::Msvc { clang_cl } => {
Expand All @@ -2205,9 +2205,7 @@ impl Build {
cmd.push_cc_arg("-m32".into());
cmd.push_cc_arg("-arch:IA32".into());
} else {
cmd.push_cc_arg(
format!("--target={}", target.unversioned_llvm_target).into(),
);
cmd.push_cc_arg(format!("--target={}", target.llvm_target).into());
}
} else if target.full_arch == "i586" {
cmd.push_cc_arg("-arch:IA32".into());
Expand Down
2 changes: 1 addition & 1 deletion src/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) struct TargetInfo<'a> {
///
/// NOTE: You should never need to match on this explicitly, use the other
/// fields on [`TargetInfo`] instead.
pub unversioned_llvm_target: &'a str,
pub llvm_target: &'a str,
}

impl FromStr for TargetInfo<'_> {
Expand Down
Loading

0 comments on commit 5fc270a

Please sign in to comment.