Skip to content

Commit c434448

Browse files
authored
Rollup merge of rust-lang#74541 - shepmaster:aarch64-apple-darwin-target, r=nagisa
Add the aarch64-apple-darwin target This is a basic copy-paste-modify from the existing x86_64-apple-darwin target.
2 parents 6b829d9 + 804241e commit c434448

File tree

5 files changed

+41
-7
lines changed

5 files changed

+41
-7
lines changed

Cargo.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ version = "0.1.0"
412412

413413
[[package]]
414414
name = "cc"
415-
version = "1.0.57"
415+
version = "1.0.58"
416416
source = "registry+https://github.com/rust-lang/crates.io-index"
417-
checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
417+
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
418418
dependencies = [
419419
"jobserver",
420420
]
@@ -1576,9 +1576,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
15761576

15771577
[[package]]
15781578
name = "libc"
1579-
version = "0.2.71"
1579+
version = "0.2.73"
15801580
source = "registry+https://github.com/rust-lang/crates.io-index"
1581-
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
1581+
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
15821582
dependencies = [
15831583
"rustc-std-workspace-core",
15841584
]

src/librustc_llvm/Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ static-libstdcpp = []
1414
emscripten = []
1515

1616
[dependencies]
17-
libc = "0.2"
17+
libc = "0.2.73"
1818

1919
[build-dependencies]
2020
build_helper = { path = "../build_helper" }
21-
cc = "1.0.1"
21+
cc = "1.0.58"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};
2+
3+
pub fn target() -> TargetResult {
4+
let mut base = super::apple_base::opts();
5+
base.cpu = "apple-a12".to_string();
6+
base.max_atomic_width = Some(128);
7+
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);
8+
9+
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
10+
11+
// Clang automatically chooses a more specific target based on
12+
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
13+
// correctly, we do too.
14+
let arch = "aarch64";
15+
let llvm_target = super::apple_base::macos_llvm_target(&arch);
16+
17+
Ok(Target {
18+
llvm_target,
19+
target_endian: "little".to_string(),
20+
target_pointer_width: "64".to_string(),
21+
target_c_int_width: "32".to_string(),
22+
data_layout: "e-m:o-i64:64-i128:128-n32:64-S128".to_string(),
23+
arch: arch.to_string(),
24+
target_os: "macos".to_string(),
25+
target_env: String::new(),
26+
target_vendor: "apple".to_string(),
27+
linker_flavor: LinkerFlavor::Gcc,
28+
options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
29+
})
30+
}

src/librustc_target/spec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ supported_targets! {
574574
("i686-unknown-haiku", i686_unknown_haiku),
575575
("x86_64-unknown-haiku", x86_64_unknown_haiku),
576576

577+
("aarch64-apple-darwin", aarch64_apple_darwin),
577578
("x86_64-apple-darwin", x86_64_apple_darwin),
578579
("i686-apple-darwin", i686_apple_darwin),
579580

src/librustc_target/spec/x86_64_apple_darwin.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ pub fn target() -> TargetResult {
55
base.cpu = "core2".to_string();
66
base.max_atomic_width = Some(128); // core2 support cmpxchg16b
77
base.eliminate_frame_pointer = false;
8-
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
8+
base.pre_link_args.insert(
9+
LinkerFlavor::Gcc,
10+
vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
11+
);
912
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
1013
base.stack_probes = true;
1114

0 commit comments

Comments
 (0)