Fix incorrect 'llvm_target' value used on watchOS target

The expected value is "<arch>-apple-watchos<major>.<minor>.0", i.e.
"arm64_32-apple-watchos8.0.0".

compiler/rustc_target/src/spec/base/apple/mod.rs contains functions that
construct such string. There is an existing function
`watchos_sim_llvm_target` which returns llvm target value for watchOS
simulator. But there is none for watchOS device. This commit adds that
missing function to align watchOS with other Apple platform targets.
This commit is contained in:
Tony Li 2024-04-04 19:08:54 +13:00
parent b4acbe4233
commit 1ffb410aa2
No known key found for this signature in database
GPG Key ID: 920A8FB267BC6A52
2 changed files with 9 additions and 3 deletions

View File

@ -359,6 +359,11 @@ fn watchos_deployment_target() -> (u32, u32) {
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
}
pub fn watchos_llvm_target(arch: Arch) -> String {
let (major, minor) = watchos_deployment_target();
format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor)
}
pub fn watchos_sim_llvm_target(arch: Arch) -> String {
let (major, minor) = watchos_deployment_target();
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)

View File

@ -1,10 +1,11 @@
use crate::spec::base::apple::{opts, Arch};
use crate::spec::base::apple::{opts, watchos_llvm_target, Arch};
use crate::spec::{Target, TargetOptions};
pub fn target() -> Target {
let base = opts("watchos", Arch::Arm64_32);
let arch = Arch::Arm64_32;
let base = opts("watchos", arch);
Target {
llvm_target: "arm64_32-apple-watchos".into(),
llvm_target: watchos_llvm_target(arch).into(),
metadata: crate::spec::TargetMetadata {
description: None,
tier: None,