diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2018-01-24 08:22:34 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2018-01-28 18:32:45 -0800 |
| commit | c6daea7c9a7d4be88e1ae8d54d992937fcfe24fa (patch) | |
| tree | 29d8d7e69c49ae4e9930c3568ebccb8b840cfde1 /src/ci | |
| parent | 385ef1514c80fb8c0cb061dc69eb1d953a84e2b3 (diff) | |
| download | rust-c6daea7c9a7d4be88e1ae8d54d992937fcfe24fa.tar.gz rust-c6daea7c9a7d4be88e1ae8d54d992937fcfe24fa.zip | |
rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding compiling the `JSBackend` target in the main LLVM codegen backend. This builds on the foundation provided by #47671 to create a new codegen backend dedicated solely to Emscripten, removing the `JSBackend` of the main codegen backend in the process. A new field was added to each target for this commit which specifies the backend to use for translation, the default being `llvm` which is the main backend that we use. The Emscripten targets specify an `emscripten` backend instead of the main `llvm` one. There's a whole bunch of consequences of this change, but I'll try to enumerate them here: * A *second* LLVM submodule was added in this commit. The main LLVM submodule will soon start to drift from the Emscripten submodule, but currently they're both at the same revision. * Logic was added to rustbuild to *not* build the Emscripten backend by default. This is gated behind a `--enable-emscripten` flag to the configure script. By default users should neither check out the emscripten submodule nor compile it. * The `init_repo.sh` script was updated to fetch the Emscripten submodule from GitHub the same way we do the main LLVM submodule (a tarball fetch). * The Emscripten backend, turned off by default, is still turned on for a number of targets on CI. We'll only be shipping an Emscripten backend with Tier 1 platforms, though. All cross-compiled platforms will not be receiving an Emscripten backend yet. This commit means that when you download the `rustc` package in Rustup for Tier 1 platforms you'll be receiving two trans backends, one for Emscripten and one that's the general LLVM backend. If you never compile for Emscripten you'll never use the Emscripten backend, so we may update this one day to only download the Emscripten backend when you add the Emscripten target. For now though it's just an extra 10MB gzip'd. Closes #46819
Diffstat (limited to 'src/ci')
| -rw-r--r-- | src/ci/docker/asmjs/Dockerfile | 2 | ||||
| -rw-r--r-- | src/ci/docker/dist-i686-linux/Dockerfile | 3 | ||||
| -rw-r--r-- | src/ci/docker/dist-various-1/Dockerfile | 3 | ||||
| -rw-r--r-- | src/ci/docker/dist-x86_64-linux/Dockerfile | 3 | ||||
| -rwxr-xr-x | src/ci/init_repo.sh | 15 |
5 files changed, 17 insertions, 9 deletions
diff --git a/src/ci/docker/asmjs/Dockerfile b/src/ci/docker/asmjs/Dockerfile index 07849a20d00..ff0708459bc 100644 --- a/src/ci/docker/asmjs/Dockerfile +++ b/src/ci/docker/asmjs/Dockerfile @@ -29,6 +29,6 @@ ENV EM_CONFIG=/emsdk-portable/.emscripten ENV TARGETS=asmjs-unknown-emscripten -ENV RUST_CONFIGURE_ARGS --target=$TARGETS +ENV RUST_CONFIGURE_ARGS --target=$TARGETS --enable-emscripten ENV SCRIPT python2.7 ../x.py test --target $TARGETS diff --git a/src/ci/docker/dist-i686-linux/Dockerfile b/src/ci/docker/dist-i686-linux/Dockerfile index a5d776af19d..0fd6af6e10d 100644 --- a/src/ci/docker/dist-i686-linux/Dockerfile +++ b/src/ci/docker/dist-i686-linux/Dockerfile @@ -85,7 +85,8 @@ ENV RUST_CONFIGURE_ARGS \ --host=$HOSTS \ --enable-extended \ --enable-sanitizers \ - --enable-profiler + --enable-profiler \ + --enable-emscripten ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS # This is the only builder which will create source tarballs diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile index 64c993860d9..c83f101d0ac 100644 --- a/src/ci/docker/dist-various-1/Dockerfile +++ b/src/ci/docker/dist-various-1/Dockerfile @@ -95,7 +95,8 @@ ENV RUST_CONFIGURE_ARGS \ --musl-root-armv7=/musl-armv7 \ --musl-root-aarch64=/musl-aarch64 \ --musl-root-mips=/musl-mips \ - --musl-root-mipsel=/musl-mipsel + --musl-root-mipsel=/musl-mipsel \ + --enable-emscripten ENV SCRIPT python2.7 ../x.py dist --target $TARGETS diff --git a/src/ci/docker/dist-x86_64-linux/Dockerfile b/src/ci/docker/dist-x86_64-linux/Dockerfile index a954fd86a24..d368a00b55b 100644 --- a/src/ci/docker/dist-x86_64-linux/Dockerfile +++ b/src/ci/docker/dist-x86_64-linux/Dockerfile @@ -85,7 +85,8 @@ ENV RUST_CONFIGURE_ARGS \ --host=$HOSTS \ --enable-extended \ --enable-sanitizers \ - --enable-profiler + --enable-profiler \ + --enable-emscripten ENV SCRIPT python2.7 ../x.py dist --host $HOSTS --target $HOSTS # This is the only builder which will create source tarballs diff --git a/src/ci/init_repo.sh b/src/ci/init_repo.sh index 14a1906ff42..8ab4276fa3b 100755 --- a/src/ci/init_repo.sh +++ b/src/ci/init_repo.sh @@ -48,7 +48,12 @@ travis_time_start # Update the cache (a pristine copy of the rust source master) retry sh -c "rm -rf $cache_src_dir && mkdir -p $cache_src_dir && \ git clone --depth 1 https://github.com/rust-lang/rust.git $cache_src_dir" -(cd $cache_src_dir && git rm src/llvm) +if [ -d $cache_src_dir/src/llvm ]; then + (cd $cache_src_dir && git rm src/llvm) +fi +if [ -d $cache_src_dir/src/llvm-emscripten ]; then + (cd $cache_src_dir && git rm src/llvm-emscripten) +fi retry sh -c "cd $cache_src_dir && \ git submodule deinit -f . && git submodule sync && git submodule update --init" @@ -64,14 +69,14 @@ travis_time_start # http://stackoverflow.com/questions/12641469/list-submodules-in-a-git-repository modules="$(git config --file .gitmodules --get-regexp '\.path$' | cut -d' ' -f2)" for module in $modules; do - if [ "$module" = src/llvm ]; then - commit="$(git ls-tree HEAD src/llvm | awk '{print $3}')" - git rm src/llvm + if [ "$module" = src/llvm ] || [ "$module" = src/llvm-emscripten ]; then + commit="$(git ls-tree HEAD $module | awk '{print $3}')" + git rm $module retry sh -c "rm -f $commit.tar.gz && \ curl -sSL -O https://github.com/rust-lang/llvm/archive/$commit.tar.gz" tar -C src/ -xf "$commit.tar.gz" rm "$commit.tar.gz" - mv "src/llvm-$commit" src/llvm + mv "src/llvm-$commit" $module continue fi if [ ! -e "$cache_src_dir/$module/.git" ]; then |
