Skip to content

Commit f10fbbb

Browse files
author
Ricky (deg4uss3r)
committed
added aarch64_apple_ios_sim as a rustc target
1 parent e708cbd commit f10fbbb

File tree

5 files changed

+39
-1
lines changed

5 files changed

+39
-1
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2187,6 +2187,7 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
21872187
("x86_64", "tvos") => "appletvsimulator",
21882188
("arm", "ios") => "iphoneos",
21892189
("aarch64", "ios") if llvm_target.contains("macabi") => "macosx",
2190+
("aarch64", "ios") if llvm_target.contains("sim") => "iphonesimulator",
21902191
("aarch64", "ios") => "iphoneos",
21912192
("x86", "ios") => "iphonesimulator",
21922193
("x86_64", "ios") if llvm_target.contains("macabi") => "macosx",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use super::apple_sdk_base::{opts, Arch};
2+
use crate::spec::{Target, TargetOptions};
3+
4+
pub fn target() -> Target {
5+
let base = opts("ios", Arch::Arm64_sim);
6+
Target {
7+
llvm_target: "arm64-apple-ios-simulator".to_string(),
8+
pointer_width: 64,
9+
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
10+
arch: "aarch64".to_string(),
11+
options: TargetOptions {
12+
features: "+neon,+fp-armv8,+apple-a7".to_string(),
13+
eliminate_frame_pointer: false,
14+
max_atomic_width: Some(128),
15+
unsupported_abis: super::arm_base::unsupported_abis(),
16+
forces_embed_bitcode: true,
17+
// Taken from a clang build on Xcode 11.4.1.
18+
// These arguments are not actually invoked - they just have
19+
// to look right to pass App Store validation.
20+
bitcode_llvm_cmdline: "-triple\0\
21+
arm64-apple-ios14.0-simulator\0\
22+
-emit-obj\0\
23+
-disable-llvm-passes\0\
24+
-target-abi\0\
25+
darwinpcs\0\
26+
-Os\0"
27+
.to_string(),
28+
..base
29+
},
30+
}
31+
}

compiler/rustc_target/src/spec/apple_sdk_base.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub enum Arch {
1111
X86_64,
1212
X86_64_macabi,
1313
Arm64_macabi,
14+
Arm64_sim,
1415
}
1516

1617
fn target_cpu(arch: Arch) -> String {
@@ -22,13 +23,16 @@ fn target_cpu(arch: Arch) -> String {
2223
X86_64 => "core2",
2324
X86_64_macabi => "core2",
2425
Arm64_macabi => "apple-a12",
26+
Arm64_sim => "apple-a12",
2527
}
2628
.to_string()
2729
}
2830

2931
fn link_env_remove(arch: Arch) -> Vec<String> {
3032
match arch {
31-
Armv7 | Armv7s | Arm64 | I386 | X86_64 => vec!["MACOSX_DEPLOYMENT_TARGET".to_string()],
33+
Armv7 | Armv7s | Arm64 | I386 | X86_64 | Arm64_sim => {
34+
vec!["MACOSX_DEPLOYMENT_TARGET".to_string()]
35+
}
3236
X86_64_macabi | Arm64_macabi => vec!["IPHONEOS_DEPLOYMENT_TARGET".to_string()],
3337
}
3438
}

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ supported_targets! {
727727
("armv7s-apple-ios", armv7s_apple_ios),
728728
("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi),
729729
("aarch64-apple-ios-macabi", aarch64_apple_ios_macabi),
730+
("aarch64-apple-ios-sim", aarch64_apple_ios_sim),
730731
("aarch64-apple-tvos", aarch64_apple_tvos),
731732
("x86_64-apple-tvos", x86_64_apple_tvos),
732733

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ not available.
153153
target | std | host | notes
154154
-------|-----|------|-------
155155
`aarch64-apple-ios-macabi` | ? | | Apple Catalyst on ARM64
156+
`aarch64-apple-ios-sim` | ? | | Apple iOS Simulator on ARM64
156157
`aarch64-apple-tvos` | * | | ARM64 tvOS
157158
`aarch64-unknown-freebsd` | ✓ | ✓ | ARM64 FreeBSD
158159
`aarch64-unknown-hermit` | ? | |

0 commit comments

Comments
 (0)