Skip to content

Commit 8f65d15

Browse files
committed
allow specifying an ios version for the llvm target
1 parent 5998c2e commit 8f65d15

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

compiler/rustc_target/src/spec/apple_base.rs

+6
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,12 @@ fn ios_deployment_target() -> (u32, u32) {
9292
}
9393

9494
pub fn ios_llvm_target(arch: &str) -> String {
95+
// Modern iOS tooling extracts information about deployment target
96+
// from LC_BUILD_VERSION. This load command will only be emitted when
97+
// we build with a version specific `llvm_target`, with the version
98+
// set high enough. Luckily one LC_BUILD_VERSION is enough, for Xcode
99+
// to pick it up (since std and core are still built with the fallback
100+
// of version 7.0 and hence emit the old LC_IPHONE_MIN_VERSION).
95101
let (major, minor) = ios_deployment_target();
96102
format!("{}-apple-ios{}.{}.0", arch, major, minor)
97103
}

compiler/rustc_target/src/spec/armv7_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use crate::spec::{Target, TargetOptions};
33

44
pub fn target() -> Target {
55
Target {
6-
llvm_target: "armv7-apple-ios".to_string(),
6+
llvm_target: super::apple_base::ios_llvm_target("armv7"),
77
pointer_width: 32,
88
data_layout: "e-m:o-p:32:32-Fi8-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32".to_string(),
99
arch: "arm".to_string(),

compiler/rustc_target/src/spec/i386_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::spec::{StackProbeType, Target, TargetOptions};
44
pub fn target() -> Target {
55
let base = opts("ios", Arch::I386);
66
Target {
7-
llvm_target: "i386-apple-ios".to_string(),
7+
llvm_target: super::apple_base::ios_sim_llvm_target("i386"),
88
pointer_width: 32,
99
data_layout: "e-m:o-p:32:32-p270:32:32-p271:32:32-p272:64:64-\
1010
f64:32:64-f80:128-n8:16:32-S128"

compiler/rustc_target/src/spec/x86_64_apple_ios.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::spec::{StackProbeType, Target, TargetOptions};
44
pub fn target() -> Target {
55
let base = opts("ios", Arch::X86_64);
66
Target {
7-
llvm_target: "x86_64-apple-ios".to_string(),
7+
llvm_target: super::apple_base::ios_sim_llvm_target("x86_64"),
88
pointer_width: 64,
99
data_layout: "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
1010
.to_string(),

0 commit comments

Comments
 (0)