Skip to content

Commit

Permalink
Use -windows-gnu for all UEFI targets
Browse files Browse the repository at this point in the history
This restores the behavior prior to
rust-lang#1252, when the UEFI targets were
hardcoded in src/lib.rs.
  • Loading branch information
nicholasbishop committed Nov 3, 2024
1 parent 7a786c5 commit 9182f44
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions dev-tools/gen-target-info/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ 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("");

// 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 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("-")
} else if os == "uefi" && spec.llvm_target.ends_with("windows") {
format!("{}-gnu", spec.llvm_target)
} else {
spec.llvm_target.clone()
};
Expand Down
4 changes: 2 additions & 2 deletions src/target/generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "uefi",
env: "",
abi: "",
unversioned_llvm_target: "aarch64-unknown-windows",
unversioned_llvm_target: "aarch64-unknown-windows-gnu",
},
),
(
Expand Down Expand Up @@ -3205,7 +3205,7 @@ pub(crate) const LIST: &[(&str, TargetInfo<'static>)] = &[
os: "uefi",
env: "",
abi: "",
unversioned_llvm_target: "x86_64-unknown-windows",
unversioned_llvm_target: "x86_64-unknown-windows-gnu",
},
),
(
Expand Down

0 comments on commit 9182f44

Please sign in to comment.