add lld_flavor info to target spec

this field defaults to the LD / GNU flavor
This commit is contained in:
Jorge Aparicio 2018-08-18 16:31:36 +02:00
parent a0911cf95d
commit 750e72b9e0
2 changed files with 6 additions and 0 deletions

View File

@ -624,6 +624,8 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
LinkerFlavor::Ld
} else if stem == "link" || stem == "lld-link" {
LinkerFlavor::Msvc
} else if stem == "lld" || stem == "rust-lld" {
LinkerFlavor::Lld(sess.target.target.options.lld_flavor)
} else {
// fall back to the value in the target spec
sess.target.target.linker_flavor

View File

@ -433,6 +433,9 @@ pub struct TargetOptions {
/// Linker to invoke
pub linker: Option<String>,
/// LLD flavor
pub lld_flavor: LldFlavor,
/// Linker arguments that are passed *before* any user-defined libraries.
pub pre_link_args: LinkArgs, // ... unconditionally
pub pre_link_args_crt: LinkArgs, // ... when linking with a bundled crt
@ -650,6 +653,7 @@ impl Default for TargetOptions {
TargetOptions {
is_builtin: false,
linker: option_env!("CFG_DEFAULT_LINKER").map(|s| s.to_string()),
lld_flavor: LldFlavor::Ld,
pre_link_args: LinkArgs::new(),
pre_link_args_crt: LinkArgs::new(),
post_link_args: LinkArgs::new(),