diff options
| author | Benedikt Terhechte <terhechte@gmail.com> | 2019-08-11 20:31:01 +0200 |
|---|---|---|
| committer | Benedikt Terhechte <terhechte@gmail.com> | 2019-08-11 20:31:01 +0200 |
| commit | af1e668f33d5c8b4d93e35b31be8e78fec18fcf4 (patch) | |
| tree | a1ebf89006e86e8ce8a968255b43146b7bddd5c3 | |
| parent | 2b78e10ac1454d2d4190c575f6ece03f484ac398 (diff) | |
| download | rust-af1e668f33d5c8b4d93e35b31be8e78fec18fcf4.tar.gz rust-af1e668f33d5c8b4d93e35b31be8e78fec18fcf4.zip | |
Add initial files for iOS catalyst / macabi support
This is a first attempt of adding support for the new Apple Catalyst ABI (i.e. running iOS apps on macOS). Currently, `rustc` supports the iOS and iOS simulator targets for iOS: - iOS: ARM cpu, iOS SDK, linked agains the iOS ABI - Simulator: X86_64 cpu, iOS SDK, linked against the iOS ABI Apple Catalyst will add an additional target: - Macabi: X86_64 CPU, iOS SDK, linked again the macOS ABI. Note, it the actual SDK is the also the macOS 10.15 SDK, but the symbols are the iOS SDK symbols as they were added to macOS with 10.15. This commits adds the files for this new target triple.
| -rw-r--r-- | src/librustc_target/spec/apple_ios_base.rs | 10 | ||||
| -rw-r--r-- | src/librustc_target/spec/mod.rs | 1 | ||||
| -rw-r--r-- | src/librustc_target/spec/x86_64_apple_ios_macabi.rs | 23 |
3 files changed, 31 insertions, 3 deletions
diff --git a/src/librustc_target/spec/apple_ios_base.rs b/src/librustc_target/spec/apple_ios_base.rs index f46ad06ba43..6d3900c0b20 100644 --- a/src/librustc_target/spec/apple_ios_base.rs +++ b/src/librustc_target/spec/apple_ios_base.rs @@ -13,7 +13,8 @@ pub enum Arch { Armv7s, Arm64, I386, - X86_64 + X86_64, + X86_64_macabi, } impl Arch { @@ -23,7 +24,8 @@ impl Arch { Armv7s => "armv7s", Arm64 => "arm64", I386 => "i386", - X86_64 => "x86_64" + X86_64 => "x86_64", + X86_64_macabi => "x86_64" } } } @@ -67,7 +69,8 @@ pub fn get_sdk_root(sdk_name: &str) -> Result<String, String> { fn build_pre_link_args(arch: Arch) -> Result<LinkArgs, String> { let sdk_name = match arch { Armv7 | Armv7s | Arm64 => "iphoneos", - I386 | X86_64 => "iphonesimulator" + I386 | X86_64 => "iphonesimulator", + X86_64_macabi => "macosx10.15", }; let arch_name = arch.to_string(); @@ -93,6 +96,7 @@ fn target_cpu(arch: Arch) -> String { Arm64 => "cyclone", I386 => "yonah", X86_64 => "core2", + X86_64_macabi => "core2", }.to_string() } diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs index ec72c00c28f..bb68f2a833c 100644 --- a/src/librustc_target/spec/mod.rs +++ b/src/librustc_target/spec/mod.rs @@ -425,6 +425,7 @@ supported_targets! { ("aarch64-apple-ios", aarch64_apple_ios), ("armv7-apple-ios", armv7_apple_ios), ("armv7s-apple-ios", armv7s_apple_ios), + ("x86_64-apple-ios-macabi", x86_64_apple_ios_macabi), ("armebv7r-none-eabi", armebv7r_none_eabi), ("armebv7r-none-eabihf", armebv7r_none_eabihf), diff --git a/src/librustc_target/spec/x86_64_apple_ios_macabi.rs b/src/librustc_target/spec/x86_64_apple_ios_macabi.rs new file mode 100644 index 00000000000..2ce77282e90 --- /dev/null +++ b/src/librustc_target/spec/x86_64_apple_ios_macabi.rs @@ -0,0 +1,23 @@ +use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult}; +use super::apple_ios_base::{opts, Arch}; + +pub fn target() -> TargetResult { + let base = opts(Arch::X86_64_macabi)?; + Ok(Target { + llvm_target: "x86_64-apple-ios13.0-macabi".to_string(), + target_endian: "little".to_string(), + target_pointer_width: "64".to_string(), + target_c_int_width: "32".to_string(), + data_layout: "e-m:o-i64:64-f80:128-n8:16:32:64-S128".to_string(), + arch: "x86_64".to_string(), + target_os: "ios".to_string(), + target_env: String::new(), + target_vendor: "apple".to_string(), + linker_flavor: LinkerFlavor::Gcc, + options: TargetOptions { + max_atomic_width: Some(64), + stack_probes: true, + .. base + } + }) +} |
