-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add UWP MSVC targets #63155
Merged
Merged
Add UWP MSVC targets #63155
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5e6619e
Fix UWP build
mfkl 54e268c
Fix README MSVC URI
mfkl 6e4d023
Add UWP MSVC targets
mfkl 3c6f6f0
Fix tidy checks
mfkl e3d8b68
review feedback: find lib root path from registry
mfkl 89044a9
move store lib probing code to librustc_codegen_ssa
mfkl c9da160
review feedback: move uwp link code to get_linker
mfkl 1581c43
review feedback: add comments and use local flavor variable
mfkl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,29 @@ | ||
use crate::spec::{LinkerFlavor, Target, TargetResult, PanicStrategy}; | ||
use std::env; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::windows_uwp_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; | ||
|
||
let lib_root_path = env::var("VCToolsInstallDir").expect("VCToolsInstallDir not found in env"); | ||
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap() | ||
.push(format!("{}{}{}", "/LIBPATH:".to_string(), lib_root_path, "lib\\arm64\\store".to_string())); | ||
|
||
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: "uwp".to_string(), | ||
linker_flavor: LinkerFlavor::Msvc, | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use crate::spec::{LinkerFlavor, Target, TargetResult}; | ||
use std::env; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::windows_uwp_msvc_base::opts(); | ||
base.cpu = "pentium4".to_string(); | ||
base.max_atomic_width = Some(64); | ||
base.has_elf_tls = true; | ||
|
||
let lib_root_path = env::var("VCToolsInstallDir").expect("VCToolsInstallDir not found in env"); | ||
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap() | ||
.push(format!("{}{}{}", "/LIBPATH:".to_string(), lib_root_path, "lib\\x86\\store".to_string())); | ||
|
||
Ok(Target { | ||
llvm_target: "i686-pc-windows-msvc".to_string(), | ||
target_endian: "little".to_string(), | ||
target_pointer_width: "32".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32".to_string(), | ||
arch: "x86".to_string(), | ||
target_os: "windows".to_string(), | ||
target_env: "msvc".to_string(), | ||
target_vendor: "uwp".to_string(), | ||
linker_flavor: LinkerFlavor::Msvc, | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut args = LinkArgs::new(); | ||
args.insert(LinkerFlavor::Msvc, | ||
vec!["/NOLOGO".to_string(), | ||
"/NXCOMPAT".to_string(), | ||
"/APPCONTAINER".to_string(), | ||
"mincore.lib".to_string()]); | ||
|
||
TargetOptions { | ||
function_sections: true, | ||
dynamic_linking: true, | ||
executables: true, | ||
dll_prefix: String::new(), | ||
dll_suffix: ".dll".to_string(), | ||
exe_suffix: ".exe".to_string(), | ||
staticlib_prefix: String::new(), | ||
staticlib_suffix: ".lib".to_string(), | ||
target_family: Some("windows".to_string()), | ||
is_like_windows: true, | ||
is_like_msvc: true, | ||
pre_link_args: args, | ||
crt_static_allows_dylibs: true, | ||
crt_static_respected: true, | ||
abi_return_struct_as_int: true, | ||
emit_debug_gdb_scripts: false, | ||
requires_uwtable: true, | ||
|
||
.. Default::default() | ||
} | ||
} |
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,27 @@ | ||
use crate::spec::{LinkerFlavor, Target, TargetResult}; | ||
use std::env; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::windows_uwp_msvc_base::opts(); | ||
base.cpu = "x86-64".to_string(); | ||
base.max_atomic_width = Some(64); | ||
base.has_elf_tls = true; | ||
|
||
let lib_root_path = env::var("VCToolsInstallDir").expect("VCToolsInstallDir not found in env"); | ||
base.pre_link_args.get_mut(&LinkerFlavor::Msvc).unwrap() | ||
.push(format!("{}{}{}", "/LIBPATH:".to_string(), lib_root_path, "lib\\x64\\store".to_string())); | ||
|
||
Ok(Target { | ||
llvm_target: "x86_64-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-i64:64-f80:128-n8:16:32:64-S128".to_string(), | ||
arch: "x86_64".to_string(), | ||
target_os: "windows".to_string(), | ||
target_env: "msvc".to_string(), | ||
target_vendor: "uwp".to_string(), | ||
linker_flavor: LinkerFlavor::Msvc, | ||
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the background on this FIXME that causes it to exist? Does that belong in a comment or an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AArch64 Windows backend didn't implement SEH unwinding when the aarch64-pc-windows-msvc target was first added, so I suspect this is the same as that. I haven't checked the LLVM backend recently to see if this works.