Skip to content

Commit 447297c

Browse files
committedJun 23, 2017
Make wasm32 buildbot test LLVM backend
This adds the experimental targets option to configure so it can be used by the builders and changes the wasm32 Dockerfile accordingly. Instead of using LLVM from the emsdk, the builder's emscripten tools now uses the Rust in-tree LLVM, since this is the one built with wasm support.
1 parent bd62230 commit 447297c

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed
 

‎configure

+1
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,7 @@ valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory"
490490
valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory"
491491
valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
492492
valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this"
493+
valopt experimental-targets "" "experimental LLVM targets to build"
493494

494495
if [ -e ${CFG_SRC_DIR}.git ]
495496
then

‎src/bootstrap/config.rs

+3
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,9 @@ impl Config {
497497
"CFG_TARGET" if value.len() > 0 => {
498498
self.target.extend(value.split(" ").map(|s| s.to_string()));
499499
}
500+
"CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
501+
self.llvm_experimental_targets = Some(value.to_string());
502+
}
500503
"CFG_MUSL_ROOT" if value.len() > 0 => {
501504
self.musl_root = Some(parse_configure_path(value));
502505
}

‎src/ci/docker/disabled/wasm32/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN sh /scripts/dumb-init.sh
2020
# emscripten
2121
COPY scripts/emscripten.sh /scripts/
2222
RUN bash /scripts/emscripten.sh
23-
COPY wasm32/node.sh /usr/local/bin/node
23+
COPY disabled/wasm32/node.sh /usr/local/bin/node
2424

2525
# env
2626
ENV PATH=$PATH:/emsdk-portable
@@ -30,9 +30,9 @@ ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
3030
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
3131
ENV EM_CONFIG=/emsdk-portable/.emscripten
3232

33-
ENV TARGETS=wasm32-unknown-emscripten
33+
ENV TARGETS=wasm32-unknown-emscripten,wasm32-experimental-emscripten
3434

35-
ENV RUST_CONFIGURE_ARGS --target=$TARGETS
35+
ENV RUST_CONFIGURE_ARGS --target=$TARGETS --experimental-targets=WebAssembly
3636

3737
ENV SCRIPT python2.7 ../x.py test --target $TARGETS
3838

‎src/ci/docker/scripts/emscripten.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,12 @@ hide_output ./emsdk install sdk-1.37.13-64bit
4040
source ./emsdk_env.sh
4141
echo "main(){}" > a.c
4242
HOME=/emsdk-portable/ emcc a.c
43-
HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c
43+
HOME=/emsdk-portable/ emcc -s WASM=1 a.c
4444
rm -f a.*
4545

46+
# Make emscripten use Rust's LLVM
47+
echo "LLVM_ROOT='/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/bin'" >> /root/.emscripten
48+
4649
# Make emsdk usable by any user
4750
cp /root/.emscripten /emsdk-portable
4851
chmod a+rxw -R /emsdk-portable

‎src/tools/compiletest/src/runtest.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -1280,6 +1280,12 @@ actual:\n\
12801280
let extra_link_args = vec!["-L".to_owned(),
12811281
aux_dir.to_str().unwrap().to_owned()];
12821282

1283+
let mut env = self.props.rustc_env.clone();
1284+
// Tell emscripten to link using libc produced with LLVM backend
1285+
if self.config.target.contains("wasm32") && self.config.target.contains("experimental") {
1286+
env.push(("EMCC_WASM_BACKEND".to_string(), "1".to_string()));
1287+
}
1288+
12831289
for rel_ab in &self.props.aux_builds {
12841290
let aux_testpaths = self.compute_aux_test_paths(rel_ab);
12851291
let aux_props = self.props.from_aux_file(&aux_testpaths.file,
@@ -1319,7 +1325,7 @@ actual:\n\
13191325
};
13201326
let aux_args = aux_cx.make_compile_args(crate_type, &aux_testpaths.file, aux_output);
13211327
let auxres = aux_cx.compose_and_run(aux_args,
1322-
Vec::new(),
1328+
env.clone(),
13231329
aux_cx.config.compile_lib_path.to_str().unwrap(),
13241330
Some(aux_dir.to_str().unwrap()),
13251331
None);
@@ -1332,13 +1338,12 @@ actual:\n\
13321338
}
13331339

13341340
self.compose_and_run(args,
1335-
self.props.rustc_env.clone(),
1341+
env,
13361342
self.config.compile_lib_path.to_str().unwrap(),
13371343
Some(aux_dir.to_str().unwrap()),
13381344
input)
13391345
}
13401346

1341-
13421347
fn compose_and_run(&self,
13431348
ProcArgs{ args, prog }: ProcArgs,
13441349
procenv: Vec<(String, String)> ,

0 commit comments

Comments
 (0)
Please sign in to comment.