Skip to content

Commit 8545b39

Browse files
authored
Rollup merge of rust-lang#147447 - madsmtm:aarch64-watchos-default-deployment-target, r=davidtwco
Set the minimum deployment target for `aarch64-apple-watchos` To match what's done in LLVM 21 and Xcode 26, watchOS 26 is the first OS version that actually runs true Aarch64 binaries. This affects the object files we create, and the linker invocation when using `-Clinker=ld`. See also investigation in rust-lang#147223.
2 parents 4b57d81 + a914f82 commit 8545b39

File tree

2 files changed

+5
-1
lines changed
  • compiler/rustc_target/src/spec/base/apple
  • tests/run-make/apple-deployment-target

2 files changed

+5
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ impl OSVersion {
304304
/// to raise the minimum OS version.
305305
///
306306
/// This matches what LLVM does, see in part:
307-
/// <https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932>
307+
/// <https://github.com/llvm/llvm-project/blob/llvmorg-21.1.3/llvm/lib/TargetParser/Triple.cpp#L2140-L2175>
308308
pub fn minimum_deployment_target(target: &Target) -> Self {
309309
let (major, minor, patch) = match (&*target.os, &*target.arch, &*target.env) {
310310
("macos", "aarch64", _) => (11, 0, 0),
@@ -315,6 +315,9 @@ impl OSVersion {
315315
("ios", _, "macabi") => (13, 1, 0),
316316
("tvos", "aarch64", "sim") => (14, 0, 0),
317317
("watchos", "aarch64", "sim") => (7, 0, 0),
318+
// True Aarch64 on watchOS (instead of their Aarch64 Ilp32 called `arm64_32`) has been
319+
// available since Xcode 14, but it's only actually used more recently in watchOS 26.
320+
("watchos", "aarch64", "") if !target.llvm_target.starts_with("arm64_32") => (26, 0, 0),
318321
(os, _, _) => return Self::os_minimum_deployment_target(os),
319322
};
320323
Self { major, minor, patch }

tests/run-make/apple-deployment-target/rmake.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn main() {
3333
// armv7s-apple-ios and i386-apple-ios only supports iOS 10.0
3434
"ios" if target() == "armv7s-apple-ios" || target() == "i386-apple-ios" => ("10.0", "10.0"),
3535
"ios" => ("15.0", "16.0"),
36+
"watchos" if target() == "aarch64-apple-watchos" => ("28.0", "30.0"),
3637
"watchos" => ("7.0", "9.0"),
3738
"tvos" => ("14.0", "15.0"),
3839
"visionos" => ("1.1", "1.2"),

0 commit comments

Comments
 (0)