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.
This commit is contained in:
Thomas Lively 2017-06-20 13:37:58 -07:00
parent bd62230fbd
commit 447297ce59
5 changed files with 19 additions and 7 deletions

1
configure vendored
View File

@ -490,6 +490,7 @@ valopt musl-root-armhf "" "arm-unknown-linux-musleabihf install directory"
valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory" valopt musl-root-armv7 "" "armv7-unknown-linux-musleabihf install directory"
valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag" valopt extra-filename "" "Additional data that is hashed and passed to the -C extra-filename flag"
valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this" valopt qemu-armhf-rootfs "" "rootfs in qemu testing, you probably don't want to use this"
valopt experimental-targets "" "experimental LLVM targets to build"
if [ -e ${CFG_SRC_DIR}.git ] if [ -e ${CFG_SRC_DIR}.git ]
then then

View File

@ -497,6 +497,9 @@ impl Config {
"CFG_TARGET" if value.len() > 0 => { "CFG_TARGET" if value.len() > 0 => {
self.target.extend(value.split(" ").map(|s| s.to_string())); self.target.extend(value.split(" ").map(|s| s.to_string()));
} }
"CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
self.llvm_experimental_targets = Some(value.to_string());
}
"CFG_MUSL_ROOT" if value.len() > 0 => { "CFG_MUSL_ROOT" if value.len() > 0 => {
self.musl_root = Some(parse_configure_path(value)); self.musl_root = Some(parse_configure_path(value));
} }

View File

@ -20,7 +20,7 @@ RUN sh /scripts/dumb-init.sh
# emscripten # emscripten
COPY scripts/emscripten.sh /scripts/ COPY scripts/emscripten.sh /scripts/
RUN bash /scripts/emscripten.sh RUN bash /scripts/emscripten.sh
COPY wasm32/node.sh /usr/local/bin/node COPY disabled/wasm32/node.sh /usr/local/bin/node
# env # env
ENV PATH=$PATH:/emsdk-portable ENV PATH=$PATH:/emsdk-portable
@ -30,9 +30,9 @@ ENV EMSCRIPTEN=/emsdk-portable/emscripten/1.37.13/
ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/ ENV BINARYEN_ROOT=/emsdk-portable/clang/e1.37.13_64bit/binaryen/
ENV EM_CONFIG=/emsdk-portable/.emscripten ENV EM_CONFIG=/emsdk-portable/.emscripten
ENV TARGETS=wasm32-unknown-emscripten ENV TARGETS=wasm32-unknown-emscripten,wasm32-experimental-emscripten
ENV RUST_CONFIGURE_ARGS --target=$TARGETS ENV RUST_CONFIGURE_ARGS --target=$TARGETS --experimental-targets=WebAssembly
ENV SCRIPT python2.7 ../x.py test --target $TARGETS ENV SCRIPT python2.7 ../x.py test --target $TARGETS

View File

@ -40,9 +40,12 @@ hide_output ./emsdk install sdk-1.37.13-64bit
source ./emsdk_env.sh source ./emsdk_env.sh
echo "main(){}" > a.c echo "main(){}" > a.c
HOME=/emsdk-portable/ emcc a.c HOME=/emsdk-portable/ emcc a.c
HOME=/emsdk-portable/ emcc -s BINARYEN=1 a.c HOME=/emsdk-portable/ emcc -s WASM=1 a.c
rm -f a.* rm -f a.*
# Make emscripten use Rust's LLVM
echo "LLVM_ROOT='/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/bin'" >> /root/.emscripten
# Make emsdk usable by any user # Make emsdk usable by any user
cp /root/.emscripten /emsdk-portable cp /root/.emscripten /emsdk-portable
chmod a+rxw -R /emsdk-portable chmod a+rxw -R /emsdk-portable

View File

@ -1280,6 +1280,12 @@ actual:\n\
let extra_link_args = vec!["-L".to_owned(), let extra_link_args = vec!["-L".to_owned(),
aux_dir.to_str().unwrap().to_owned()]; aux_dir.to_str().unwrap().to_owned()];
let mut env = self.props.rustc_env.clone();
// Tell emscripten to link using libc produced with LLVM backend
if self.config.target.contains("wasm32") && self.config.target.contains("experimental") {
env.push(("EMCC_WASM_BACKEND".to_string(), "1".to_string()));
}
for rel_ab in &self.props.aux_builds { for rel_ab in &self.props.aux_builds {
let aux_testpaths = self.compute_aux_test_paths(rel_ab); let aux_testpaths = self.compute_aux_test_paths(rel_ab);
let aux_props = self.props.from_aux_file(&aux_testpaths.file, let aux_props = self.props.from_aux_file(&aux_testpaths.file,
@ -1319,7 +1325,7 @@ actual:\n\
}; };
let aux_args = aux_cx.make_compile_args(crate_type, &aux_testpaths.file, aux_output); let aux_args = aux_cx.make_compile_args(crate_type, &aux_testpaths.file, aux_output);
let auxres = aux_cx.compose_and_run(aux_args, let auxres = aux_cx.compose_and_run(aux_args,
Vec::new(), env.clone(),
aux_cx.config.compile_lib_path.to_str().unwrap(), aux_cx.config.compile_lib_path.to_str().unwrap(),
Some(aux_dir.to_str().unwrap()), Some(aux_dir.to_str().unwrap()),
None); None);
@ -1332,13 +1338,12 @@ actual:\n\
} }
self.compose_and_run(args, self.compose_and_run(args,
self.props.rustc_env.clone(), env,
self.config.compile_lib_path.to_str().unwrap(), self.config.compile_lib_path.to_str().unwrap(),
Some(aux_dir.to_str().unwrap()), Some(aux_dir.to_str().unwrap()),
input) input)
} }
fn compose_and_run(&self, fn compose_and_run(&self,
ProcArgs{ args, prog }: ProcArgs, ProcArgs{ args, prog }: ProcArgs,
procenv: Vec<(String, String)> , procenv: Vec<(String, String)> ,