Skip to content

Commit

Permalink
Rollup merge of #74541 - shepmaster:aarch64-apple-darwin-target, r=na…
Browse files Browse the repository at this point in the history
…gisa

Add the aarch64-apple-darwin target

This is a basic copy-paste-modify from the existing
x86_64-apple-darwin target.
  • Loading branch information
Manishearth authored Jul 22, 2020
2 parents 4828895 + 804241e commit 8114dc7
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 7 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,9 @@ version = "0.1.0"

[[package]]
name = "cc"
version = "1.0.57"
version = "1.0.58"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fde55d2a2bfaa4c9668bbc63f531fbdeee3ffe188f4662511ce2c22b3eedebe"
checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518"
dependencies = [
"jobserver",
]
Expand Down Expand Up @@ -1576,9 +1576,9 @@ checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"

[[package]]
name = "libc"
version = "0.2.71"
version = "0.2.73"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49"
checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9"
dependencies = [
"rustc-std-workspace-core",
]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_llvm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ static-libstdcpp = []
emscripten = []

[dependencies]
libc = "0.2"
libc = "0.2.73"

[build-dependencies]
build_helper = { path = "../build_helper" }
cc = "1.0.1"
cc = "1.0.58"
30 changes: 30 additions & 0 deletions src/librustc_target/spec/aarch64_apple_darwin.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
use crate::spec::{LinkerFlavor, Target, TargetOptions, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::apple_base::opts();
base.cpu = "apple-a12".to_string();
base.max_atomic_width = Some(128);
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-arch".to_string(), "arm64".to_string()]);

base.link_env_remove.extend(super::apple_base::macos_link_env_remove());

// Clang automatically chooses a more specific target based on
// MACOSX_DEPLOYMENT_TARGET. To enable cross-language LTO to work
// correctly, we do too.
let arch = "aarch64";
let llvm_target = super::apple_base::macos_llvm_target(&arch);

Ok(Target {
llvm_target,
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-i128:128-n32:64-S128".to_string(),
arch: arch.to_string(),
target_os: "macos".to_string(),
target_env: String::new(),
target_vendor: "apple".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: TargetOptions { target_mcount: "\u{1}mcount".to_string(), ..base },
})
}
1 change: 1 addition & 0 deletions src/librustc_target/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ supported_targets! {
("i686-unknown-haiku", i686_unknown_haiku),
("x86_64-unknown-haiku", x86_64_unknown_haiku),

("aarch64-apple-darwin", aarch64_apple_darwin),
("x86_64-apple-darwin", x86_64_apple_darwin),
("i686-apple-darwin", i686_apple_darwin),

Expand Down
5 changes: 4 additions & 1 deletion src/librustc_target/spec/x86_64_apple_darwin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ pub fn target() -> TargetResult {
base.cpu = "core2".to_string();
base.max_atomic_width = Some(128); // core2 support cmpxchg16b
base.eliminate_frame_pointer = false;
base.pre_link_args.insert(LinkerFlavor::Gcc, vec!["-m64".to_string()]);
base.pre_link_args.insert(
LinkerFlavor::Gcc,
vec!["-m64".to_string(), "-arch".to_string(), "x86_64".to_string()],
);
base.link_env_remove.extend(super::apple_base::macos_link_env_remove());
base.stack_probes = true;

Expand Down

0 comments on commit 8114dc7

Please sign in to comment.