Skip to content

Commit

Permalink
Only consider stem when extension is exe.
Browse files Browse the repository at this point in the history
This commit modifies linker flavor inference to only remove the extension
to the linker when performing inference if that extension is a 'exe'.
  • Loading branch information
davidtwco committed Nov 29, 2018
1 parent 147e60c commit 0124341
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/librustc_codegen_ssa/back/link.rs
Expand Up @@ -161,7 +161,11 @@ pub fn linker_and_flavor(sess: &Session) -> (PathBuf, LinkerFlavor) {
LinkerFlavor::Lld(_) => "lld",
}), flavor)),
(Some(linker), None) => {
let stem = linker.file_stem().and_then(|stem| stem.to_str()).unwrap_or_else(|| {
let stem = if linker.extension().and_then(|ext| ext.to_str()) == Some("exe") {
linker.file_stem().and_then(|stem| stem.to_str())
} else {
linker.to_str()
}.unwrap_or_else(|| {
sess.fatal("couldn't extract file stem from specified linker");
}).to_owned();

Expand Down

0 comments on commit 0124341

Please sign in to comment.