Rollup merge of #68609 - Zoxc:lld-msvc, r=alexcrichton

Set lld flavor for MSVC to link.exe

This enables linking with LLD on Windows with just `-C linker=rust-lld` instead of needing `-C linker=rust-lld -C linker-flavor=lld-link`.
This commit is contained in:
Yuki Okushi 2020-01-29 18:56:31 +09:00 committed by GitHub
commit 288cabde8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,9 +1,11 @@
use crate::spec::{LinkArgs, LinkerFlavor, TargetOptions}; use crate::spec::{LinkArgs, LinkerFlavor, LldFlavor, TargetOptions};
use std::default::Default; use std::default::Default;
pub fn opts() -> TargetOptions { pub fn opts() -> TargetOptions {
let pre_args = vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()];
let mut args = LinkArgs::new(); let mut args = LinkArgs::new();
args.insert(LinkerFlavor::Msvc, vec!["/NOLOGO".to_string(), "/NXCOMPAT".to_string()]); args.insert(LinkerFlavor::Msvc, pre_args.clone());
args.insert(LinkerFlavor::Lld(LldFlavor::Link), pre_args);
TargetOptions { TargetOptions {
function_sections: true, function_sections: true,
@ -21,6 +23,7 @@ pub fn opts() -> TargetOptions {
// language packs, and avoid generating Non-UTF-8 error // language packs, and avoid generating Non-UTF-8 error
// messages if a link error occurred. // messages if a link error occurred.
link_env: vec![("VSLANG".to_string(), "1033".to_string())], link_env: vec![("VSLANG".to_string(), "1033".to_string())],
lld_flavor: LldFlavor::Link,
pre_link_args: args, pre_link_args: args,
crt_static_allows_dylibs: true, crt_static_allows_dylibs: true,
crt_static_respected: true, crt_static_respected: true,