Skip to content

Commit 929682c

Browse files
author
Ricky (deg4uss3r)
committed
basics of adding aarch64_apple_ios_sim as a rustc target
1 parent e708cbd commit 929682c

File tree

4 files changed

+36
-4
lines changed

4 files changed

+36
-4
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-sim".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-ios-sim\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: 3 additions & 0 deletions
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,6 +23,7 @@ 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
}
@@ -30,6 +32,7 @@ fn link_env_remove(arch: Arch) -> Vec<String> {
3032
match arch {
3133
Armv7 | Armv7s | Arm64 | I386 | X86_64 => vec!["MACOSX_DEPLOYMENT_TARGET".to_string()],
3234
X86_64_macabi | Arm64_macabi => vec!["IPHONEOS_DEPLOYMENT_TARGET".to_string()],
35+
Arm64_sim => vec!["IPHONEOS_DEPLOYMENT_TARGET".to_string()],
3336
}
3437
}
3538

compiler/rustc_target/src/spec/mod.rs

Lines changed: 1 addition & 4 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

@@ -808,10 +809,6 @@ supported_targets! {
808809
("mipsel-sony-psp", mipsel_sony_psp),
809810
("mipsel-unknown-none", mipsel_unknown_none),
810811
("thumbv4t-none-eabi", thumbv4t_none_eabi),
811-
812-
("aarch64_be-unknown-linux-gnu", aarch64_be_unknown_linux_gnu),
813-
("aarch64-unknown-linux-gnu_ilp32", aarch64_unknown_linux_gnu_ilp32),
814-
("aarch64_be-unknown-linux-gnu_ilp32", aarch64_be_unknown_linux_gnu_ilp32),
815812
}
816813

817814
/// Everything `rustc` knows about how to compile for a specific target.

0 commit comments

Comments
 (0)