Skip to content

Commit a397add

Browse files
committed
Partial fix for #38489.
1 parent c217ab6 commit a397add

File tree

4 files changed

+26
-4
lines changed

4 files changed

+26
-4
lines changed

src/librustc_back/target/asmjs_unknown_emscripten.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use super::{Target, TargetOptions};
12+
use super::emscripten_base::{cmd};
1213

1314
pub fn target() -> Result<Target, String> {
1415
let opts = TargetOptions {
15-
linker: "emcc".to_string(),
16-
ar: "emar".to_string(),
16+
linker: cmd("emcc"),
17+
ar: cmd("emar"),
1718

1819
dynamic_linking: false,
1920
executables: true,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[cfg(not(windows))]
12+
pub fn cmd(name: &str) -> String {
13+
name.to_string()
14+
}
15+
16+
#[cfg(windows)]
17+
pub fn cmd(name: &str) -> String {
18+
[name, ".bat"].concat()
19+
}

src/librustc_back/target/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ mod apple_ios_base;
5858
mod arm_base;
5959
mod bitrig_base;
6060
mod dragonfly_base;
61+
mod emscripten_base;
6162
mod freebsd_base;
6263
mod haiku_base;
6364
mod linux_base;

src/librustc_back/target/wasm32_unknown_emscripten.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use super::{Target, TargetOptions};
12+
use super::emscripten_base::{cmd};
1213

1314
pub fn target() -> Result<Target, String> {
1415
let opts = TargetOptions {
15-
linker: "emcc".to_string(),
16-
ar: "emar".to_string(),
16+
linker: cmd("emcc"),
17+
ar: cmd("emar"),
1718

1819
dynamic_linking: false,
1920
executables: true,

0 commit comments

Comments
 (0)