about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--compiler/rustc_target/src/spec/base/apple/mod.rs10
-rw-r--r--src/doc/rustc/src/platform-support/apple-ios-macabi.md2
-rw-r--r--src/doc/rustc/src/platform-support/arm64e-apple-ios.md2
-rw-r--r--tests/run-make/apple-deployment-target/rmake.rs28
4 files changed, 26 insertions, 16 deletions
diff --git a/compiler/rustc_target/src/spec/base/apple/mod.rs b/compiler/rustc_target/src/spec/base/apple/mod.rs
index b1fe49f76ca..5da47322b92 100644
--- a/compiler/rustc_target/src/spec/base/apple/mod.rs
+++ b/compiler/rustc_target/src/spec/base/apple/mod.rs
@@ -323,12 +323,18 @@ fn deployment_target(os: &str, arch: Arch, abi: TargetAbi) -> (u16, u8, u8) {
     };
 
     // On certain targets it makes sense to raise the minimum OS version.
+    //
+    // This matches what LLVM does, see:
+    // <https://github.com/llvm/llvm-project/blob/llvmorg-18.1.8/llvm/lib/TargetParser/Triple.cpp#L1900-L1932>
     let min = match (os, arch, abi) {
-        // Use 11.0 on Aarch64 as that's the earliest version with M1 support.
         ("macos", Arch::Arm64 | Arch::Arm64e, _) => (11, 0, 0),
-        ("ios", Arch::Arm64e, _) => (14, 0, 0),
+        ("ios", Arch::Arm64 | Arch::Arm64e, TargetAbi::MacCatalyst) => (14, 0, 0),
+        ("ios", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (14, 0, 0),
+        ("ios", Arch::Arm64e, TargetAbi::Normal) => (14, 0, 0),
         // Mac Catalyst defaults to 13.1 in Clang.
         ("ios", _, TargetAbi::MacCatalyst) => (13, 1, 0),
+        ("tvos", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (14, 0, 0),
+        ("watchos", Arch::Arm64 | Arch::Arm64e, TargetAbi::Simulator) => (7, 0, 0),
         _ => os_min,
     };
 
diff --git a/src/doc/rustc/src/platform-support/apple-ios-macabi.md b/src/doc/rustc/src/platform-support/apple-ios-macabi.md
index 678630873b1..a54656190d1 100644
--- a/src/doc/rustc/src/platform-support/apple-ios-macabi.md
+++ b/src/doc/rustc/src/platform-support/apple-ios-macabi.md
@@ -24,7 +24,7 @@ environment variable.
 
 ### OS version
 
-The minimum supported version is iOS 13.1.
+The minimum supported version is iOS 13.1 on x86 and 14.0 on Aarch64.
 
 This can be raised per-binary by changing the deployment target. `rustc`
 respects the common environment variables used by Xcode to do so, in this
diff --git a/src/doc/rustc/src/platform-support/arm64e-apple-ios.md b/src/doc/rustc/src/platform-support/arm64e-apple-ios.md
index 3c878f7250e..fc4ec5e373f 100644
--- a/src/doc/rustc/src/platform-support/arm64e-apple-ios.md
+++ b/src/doc/rustc/src/platform-support/arm64e-apple-ios.md
@@ -2,7 +2,7 @@
 
 **Tier: 3**
 
-ARM64e iOS (12.0+)
+ARM64e iOS (14.0+)
 
 ## Target maintainers
 
diff --git a/tests/run-make/apple-deployment-target/rmake.rs b/tests/run-make/apple-deployment-target/rmake.rs
index b2d1af65177..230f33a8d78 100644
--- a/tests/run-make/apple-deployment-target/rmake.rs
+++ b/tests/run-make/apple-deployment-target/rmake.rs
@@ -55,11 +55,8 @@ fn main() {
         rustc().env(env_var, example_version).run();
         minos("foo.o", example_version);
 
-        // FIXME(madsmtm): Doesn't work on Mac Catalyst and the simulator.
-        if !target().contains("macabi") && !target().contains("sim") {
-            rustc().env_remove(env_var).run();
-            minos("foo.o", default_version);
-        }
+        rustc().env_remove(env_var).run();
+        minos("foo.o", default_version);
     });
 
     // Test that version makes it to the linker when linking dylibs.
@@ -105,8 +102,18 @@ fn main() {
             rustc
         };
 
-        // FIXME(madsmtm): Doesn't work on watchOS for some reason?
-        if !target().contains("watchos") {
+        // FIXME(madsmtm): Xcode's version of Clang seems to require a minimum
+        // version of 9.0 on aarch64-apple-watchos for some reason? Which is
+        // odd, because the first Aarch64 watch was Apple Watch Series 4,
+        // which runs on as low as watchOS 5.0.
+        //
+        // You can see Clang's behaviour by running:
+        // ```
+        // echo "int main() { return 0; }" > main.c
+        // xcrun --sdk watchos clang --target=aarch64-apple-watchos main.c
+        // vtool -show a.out
+        // ```
+        if target() != "aarch64-apple-watchos" {
             rustc().env(env_var, example_version).run();
             minos("foo", example_version);
 
@@ -148,10 +155,7 @@ fn main() {
         rustc().env(env_var, higher_example_version).run();
         minos("foo.o", higher_example_version);
 
-        // FIXME(madsmtm): Doesn't work on Mac Catalyst and the simulator.
-        if !target().contains("macabi") && !target().contains("sim") {
-            rustc().env_remove(env_var).run();
-            minos("foo.o", default_version);
-        }
+        rustc().env_remove(env_var).run();
+        minos("foo.o", default_version);
     });
 }