Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] Update Mac Catalyst support for Clang 13 #96392

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions compiler/rustc_target/src/spec/apple_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,8 @@ pub fn ios_sim_llvm_target(arch: &str) -> String {
let (major, minor) = ios_deployment_target();
format!("{}-apple-ios{}.{}.0-simulator", arch, major, minor)
}

pub fn macabi_llvm_target(arch: &str) -> String {
let (major, minor) = ios_deployment_target();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure whether it is a good way. But as an iOS developer, I believe it looks good. Because in Xcode, Mac Catalyst minimal version is highly related to minimal iOS version. For example, if I choose iOS 14.0, I can only pick macOS 11+ for this situation:

image

image

(Copied from rust-lang/cc-rs#678)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good solution!

format!("{}-apple-ios{}.{}.0-macabi", arch, major, minor)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure whether this is suitable for the catalyst use case...

Please feel free to give hints.

}
4 changes: 3 additions & 1 deletion compiler/rustc_target/src/spec/x86_64_apple_ios_macabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ use crate::spec::{StackProbeType, Target, TargetOptions};

pub fn target() -> Target {
let base = opts("ios", Arch::X86_64_macabi);
let arch = "x86_64";
let llvm_target = super::apple_base::macabi_llvm_target(arch);
Target {
llvm_target: "x86_64-apple-ios13.0-macabi".into(),
llvm_target: llvm_target.into(),
pointer_width: 64,
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
.into(),
Expand Down