Skip to content

Commit 3b52bef

Browse files
committed
Raise minimum supported iOS version to 10.0
Drop the armv7-apple-ios target too because its no longer supported with the hardware iOS 10 requires.
1 parent 58bbca9 commit 3b52bef

File tree

8 files changed

+17
-49
lines changed

8 files changed

+17
-49
lines changed

compiler/rustc_target/src/spec/apple_base.rs

+13-14
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use Arch::*;
1111
#[allow(non_camel_case_types)]
1212
#[derive(Copy, Clone)]
1313
pub enum Arch {
14-
Armv7,
1514
Armv7k,
1615
Armv7s,
1716
Arm64,
@@ -29,7 +28,6 @@ pub enum Arch {
2928
impl Arch {
3029
pub fn target_name(self) -> &'static str {
3130
match self {
32-
Armv7 => "armv7",
3331
Armv7k => "armv7k",
3432
Armv7s => "armv7s",
3533
Arm64 | Arm64_macabi | Arm64_sim => "arm64",
@@ -43,7 +41,7 @@ impl Arch {
4341

4442
pub fn target_arch(self) -> Cow<'static, str> {
4543
Cow::Borrowed(match self {
46-
Armv7 | Armv7k | Armv7s => "arm",
44+
Armv7k | Armv7s => "arm",
4745
Arm64 | Arm64_32 | Arm64_macabi | Arm64_sim => "aarch64",
4846
I386 | I686 => "x86",
4947
X86_64 | X86_64_sim | X86_64_macabi | X86_64h => "x86_64",
@@ -52,7 +50,7 @@ impl Arch {
5250

5351
fn target_abi(self) -> &'static str {
5452
match self {
55-
Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
53+
Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64h => "",
5654
X86_64_macabi | Arm64_macabi => "macabi",
5755
// x86_64-apple-ios is a simulator target, even though it isn't
5856
// declared that way in the target like the other ones...
@@ -62,9 +60,8 @@ impl Arch {
6260

6361
fn target_cpu(self) -> &'static str {
6462
match self {
65-
Armv7 => "cortex-a8", // iOS7 is supported on iPhone 4 and higher
6663
Armv7k => "cortex-a8",
67-
Armv7s => "cortex-a9",
64+
Armv7s => "swift", // iOS 10 is only supported on iPhone 5 or higher.
6865
Arm64 => "apple-a7",
6966
Arm64_32 => "apple-s4",
7067
// Only macOS 10.12+ is supported, which means
@@ -118,9 +115,6 @@ fn pre_link_args(os: &'static str, arch: Arch, abi: &'static str) -> LinkArgs {
118115
}
119116

120117
pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
121-
// TODO: iOS 10+ always has TLS too.
122-
let has_thread_local = os == "macos";
123-
124118
let abi = arch.target_abi();
125119

126120
TargetOptions {
@@ -136,12 +130,17 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions {
136130
pre_link_args: pre_link_args(os, arch, abi),
137131
families: cvs!["unix"],
138132
is_like_osx: true,
139-
default_dwarf_version: 2,
133+
// LLVM notes that macOS 10.11+ and iOS 9+ default
134+
// to v4, so we do the same.
135+
// https://github.com/llvm/llvm-project/blob/378778a0d10c2f8d5df8ceff81f95b6002984a4b/clang/lib/Driver/ToolChains/Darwin.cpp#L1203
136+
default_dwarf_version: 4,
140137
frame_pointer: FramePointer::Always,
141138
has_rpath: true,
142139
dll_suffix: ".dylib".into(),
143140
archive_format: "darwin".into(),
144-
has_thread_local,
141+
// Thread locals became available with iOS 8 and macOS 10.7,
142+
// and both are far below our minimum.
143+
has_thread_local: true,
145144
abi_return_struct_as_int: true,
146145
emit_debug_gdb_scripts: false,
147146
eh_frame_header: false,
@@ -281,8 +280,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
281280
// Otherwise if cross-compiling for a different OS/SDK, remove any part
282281
// of the linking environment that's wrong and reversed.
283282
match arch {
284-
Armv7 | Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim
285-
| X86_64h | Arm64_sim => {
283+
Armv7k | Armv7s | Arm64 | Arm64_32 | I386 | I686 | X86_64 | X86_64_sim | X86_64h
284+
| Arm64_sim => {
286285
cvs!["MACOSX_DEPLOYMENT_TARGET"]
287286
}
288287
X86_64_macabi | Arm64_macabi => cvs!["IPHONEOS_DEPLOYMENT_TARGET"],
@@ -292,7 +291,7 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow<str>]>
292291

293292
fn ios_deployment_target() -> (u32, u32) {
294293
// If you are looking for the default deployment target, prefer `rustc --print deployment-target`.
295-
from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0))
294+
from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((10, 0))
296295
}
297296

298297
fn mac_catalyst_deployment_target() -> (u32, u32) {

compiler/rustc_target/src/spec/armv7_apple_ios.rs

-21
This file was deleted.

compiler/rustc_target/src/spec/armv7s_apple_ios.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use super::apple_base::{opts, Arch};
1+
use super::apple_base::{ios_llvm_target, opts, Arch};
22
use crate::spec::{Target, TargetOptions};
33

44
pub fn target() -> Target {
55
let arch = Arch::Armv7s;
66
Target {
7-
llvm_target: "armv7s-apple-ios".into(),
7+
llvm_target: ios_llvm_target(arch).into(),
88
pointer_width: 32,
99
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".into(),
1010
arch: arch.target_arch(),

compiler/rustc_target/src/spec/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,6 @@ supported_targets! {
13901390
("i386-apple-ios", i386_apple_ios),
13911391
("x86_64-apple-ios", x86_64_apple_ios),
13921392
("aarch64-apple-ios", aarch64_apple_ios),
1393-
("armv7-apple-ios", armv7_apple_ios),
13941393
("armv7s-apple-ios", armv7s_apple_ios),
13951394
("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi),
13961395
("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi),

library/std/src/sys/unix/thread_local_dtor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
4848
// workaround below is to register, via _tlv_atexit, a custom DTOR list once per
4949
// thread. thread_local dtors are pushed to the DTOR list without calling
5050
// _tlv_atexit.
51-
#[cfg(target_os = "macos")]
51+
#[cfg(any(target_os = "macos", target_os = "ios", target_os = "watchos"))]
5252
pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern "C" fn(*mut u8)) {
5353
use crate::cell::Cell;
5454
use crate::mem;

src/bootstrap/llvm.rs

+1-8
Original file line numberDiff line numberDiff line change
@@ -703,14 +703,7 @@ fn configure_cmake(
703703
cflags.push(" ");
704704
cflags.push(s);
705705
}
706-
// Some compiler features used by LLVM (such as thread locals) will not work on a min version below iOS 10.
707-
if target.contains("apple-ios") {
708-
if target.contains("86-") {
709-
cflags.push(" -miphonesimulator-version-min=10.0");
710-
} else {
711-
cflags.push(" -miphoneos-version-min=10.0");
712-
}
713-
}
706+
714707
if builder.config.llvm_clang_cl.is_some() {
715708
cflags.push(&format!(" --target={target}"));
716709
}

src/doc/rustc/src/platform-support.md

-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ target | std | host | notes
244244
`armv6-unknown-freebsd` | ✓ | ✓ | ARMv6 FreeBSD
245245
[`armv6-unknown-netbsd-eabihf`](platform-support/netbsd.md) | ✓ | ✓ | ARMv6 NetBSD w/hard-float
246246
[`armv6k-nintendo-3ds`](platform-support/armv6k-nintendo-3ds.md) | ? | | ARMv6K Nintendo 3DS, Horizon (Requires devkitARM toolchain)
247-
`armv7-apple-ios` | ✓ | | ARMv7-A Cortex-A8 iOS
248247
[`armv7-sony-vita-newlibeabihf`](platform-support/armv7-sony-vita-newlibeabihf.md) | ? | | ARMv7-A Cortex-A9 Sony PlayStation Vita (requires VITASDK toolchain)
249248
[`armv7-unknown-linux-ohos`](platform-support/openharmony.md) | ✓ | | ARMv7-A OpenHarmony |
250249
[`armv7-unknown-linux-uclibceabi`](platform-support/armv7-unknown-linux-uclibceabi.md) | ✓ | ✓ | ARMv7-A Linux with uClibc, softfloat

src/tools/build-manifest/src/main.rs

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ static TARGETS: &[&str] = &[
6969
"arm-unknown-linux-musleabihf",
7070
"armv5te-unknown-linux-gnueabi",
7171
"armv5te-unknown-linux-musleabi",
72-
"armv7-apple-ios",
7372
"armv7-linux-androideabi",
7473
"thumbv7neon-linux-androideabi",
7574
"armv7-unknown-linux-gnueabi",

0 commit comments

Comments
 (0)