-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #53173 - alexcrichton:win-arm64, r=sfackler
Start adding an `aarch64-pc-windows-msvc` target This commit adds the necessary definitions for target specs and such as well as the necessary support in libstd to compile basic `aarch64-pc-windows-msvc` binaries. The target is not currently built on CI, but it can be built locally with: ./configure --target=aarch64-pc-windows-msvc --set rust.lld ./x.py build src/libstd --target aarch64-pc-windows-msvc Currently this fails to build `libtest` due to a linker bug (seemingly in LLD?) which hasn't been investigate yet. Otherwise though with libstd you can build a hello world program (linked with LLD). I've not tried to execute it yet, but it at least links! Full support for this target is still a long road ahead, but this is hopefully a good stepping stone to get started. Points of note about this target are: * Currently defaults to `panic=abort` as support is still landing in LLVM for SEH on AArch64. * Currently defaults to LLD as a linker as I was able to get farther with it than I was with `link.exe`
- Loading branch information
Showing
8 changed files
with
201 additions
and
33 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
/// A macro for defining `#[cfg]` if-else statements. | ||
/// | ||
/// This is similar to the `if/elif` C preprocessor macro by allowing definition | ||
/// of a cascade of `#[cfg]` cases, emitting the implementation which matches | ||
/// first. | ||
/// | ||
/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code | ||
/// without having to rewrite each clause multiple times. | ||
macro_rules! cfg_if { | ||
($( | ||
if #[cfg($($meta:meta),*)] { $($it:item)* } | ||
) else * else { | ||
$($it2:item)* | ||
}) => { | ||
__cfg_if_items! { | ||
() ; | ||
$( ( ($($meta),*) ($($it)*) ), )* | ||
( () ($($it2)*) ), | ||
} | ||
} | ||
} | ||
|
||
macro_rules! __cfg_if_items { | ||
(($($not:meta,)*) ; ) => {}; | ||
(($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => { | ||
__cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* } | ||
__cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* } | ||
} | ||
} | ||
|
||
macro_rules! __cfg_if_apply { | ||
($m:meta, $($it:item)*) => { | ||
$(#[$m] $it)* | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use spec::{LinkerFlavor, Target, TargetResult, PanicStrategy, LldFlavor}; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::windows_msvc_base::opts(); | ||
base.max_atomic_width = Some(64); | ||
base.has_elf_tls = true; | ||
|
||
// FIXME: this shouldn't be panic=abort, it should be panic=unwind | ||
base.panic_strategy = PanicStrategy::Abort; | ||
base.linker = Some("rust-lld".to_owned()); | ||
|
||
Ok(Target { | ||
llvm_target: "aarch64-pc-windows-msvc".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "64".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(), | ||
arch: "aarch64".to_string(), | ||
target_os: "windows".to_string(), | ||
target_env: "msvc".to_string(), | ||
target_vendor: "pc".to_string(), | ||
linker_flavor: LinkerFlavor::Lld(LldFlavor::Link), | ||
options: base, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters