Skip to content

Commit 1ffb410

Browse files
committed
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.
1 parent b4acbe4 commit 1ffb410

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

compiler/rustc_target/src/spec/base/apple/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,11 @@ fn watchos_deployment_target() -> (u32, u32) {
359359
from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0))
360360
}
361361

362+
pub fn watchos_llvm_target(arch: Arch) -> String {
363+
let (major, minor) = watchos_deployment_target();
364+
format!("{}-apple-watchos{}.{}.0", arch.target_name(), major, minor)
365+
}
366+
362367
pub fn watchos_sim_llvm_target(arch: Arch) -> String {
363368
let (major, minor) = watchos_deployment_target();
364369
format!("{}-apple-watchos{}.{}.0-simulator", arch.target_name(), major, minor)

compiler/rustc_target/src/spec/targets/arm64_32_apple_watchos.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use crate::spec::base::apple::{opts, Arch};
1+
use crate::spec::base::apple::{opts, watchos_llvm_target, Arch};
22
use crate::spec::{Target, TargetOptions};
33

44
pub fn target() -> Target {
5-
let base = opts("watchos", Arch::Arm64_32);
5+
let arch = Arch::Arm64_32;
6+
let base = opts("watchos", arch);
67
Target {
7-
llvm_target: "arm64_32-apple-watchos".into(),
8+
llvm_target: watchos_llvm_target(arch).into(),
89
metadata: crate::spec::TargetMetadata {
910
description: None,
1011
tier: None,

0 commit comments

Comments
 (0)