From aa41e0d25fcb2b11b9b5c269846dd70547f2a787 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 16 May 2019 07:30:36 -0700 Subject: [PATCH] Remove `compiler-rt` submodule from this repository This commit removes the `compiler-rt` submodule from this repository. The goal here is to align the `compiler-rt` used for compiling C intrinsics with the upstream rust-lang/rust's usage of `llvm-project`. Currently we have both an `llvm-project` repository as well as `compiler-rt`, but they can naturally get out of sync and it's just one more submodule to manage. The thinking here is that the feature `c` for this crate, when activated, will require the user to configure where the source code for `compiler-rt` is present. This places the onus on the builder of `compiler-builtins` to check-out and arrange for the appropriate `compiler-rt` source code to be placed somewhere. For rust-lang/rust this is already done with the `llvm-project` submodule, and we can arrange for it to happen on this crate's CI anyway. For users of this crate this is a bit of a bummer, but `c` is disabled by default anyway and it seems unlikely that `c` is explicitly opted in to all that much. (given the purpose of this crate) This should allow us to archive the `compiler-rt` repository and simply use `llvm-project` in the rust-lang/rust repository. --- .gitmodules | 3 --- build.rs | 20 ++++++++++++-------- ci/azure-steps.yml | 12 +++++++----- ci/run-docker.sh | 1 + ci/run.sh | 1 - compiler-rt | 1 - 6 files changed, 20 insertions(+), 18 deletions(-) delete mode 160000 compiler-rt diff --git a/.gitmodules b/.gitmodules index 50ed51e..a71118f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "compiler-rt"] - path = compiler-rt - url = https://github.com/rust-lang/compiler-rt [submodule "libm"] path = libm url = https://github.com/rust-lang-nursery/libm diff --git a/build.rs b/build.rs index be5d42b..c714bc1 100644 --- a/build.rs +++ b/build.rs @@ -76,7 +76,7 @@ mod c { use std::collections::BTreeMap; use std::env; - use std::path::Path; + use std::path::PathBuf; struct Sources { // SYMBOL -> PATH TO SOURCE @@ -411,15 +411,19 @@ mod c { sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]); } - // When compiling in rustbuild (the rust-lang/rust repo) this build - // script runs from a directory other than this root directory. - let root = if cfg!(feature = "rustbuild") { - Path::new("../../libcompiler_builtins") - } else { - Path::new(".") + // When compiling the C code we require the user to tell us where the + // source code is, and this is largely done so when we're compiling as + // part of rust-lang/rust we can use the same llvm-project repository as + // rust-lang/rust. + let root = match env::var_os("RUST_COMPILER_RT_ROOT") { + Some(s) => PathBuf::from(s), + None => panic!("RUST_COMPILER_RT_ROOT is not set"), }; + if !root.exists() { + panic!("RUST_COMPILER_RT_ROOT={} does not exist", root.display()); + } - let src_dir = root.join("compiler-rt/lib/builtins"); + let src_dir = root.join("lib/builtins"); for (sym, src) in sources.map.iter() { let src = src_dir.join(src); cfg.file(&src); diff --git a/ci/azure-steps.yml b/ci/azure-steps.yml index c8a9540..f08beca 100644 --- a/ci/azure-steps.yml +++ b/ci/azure-steps.yml @@ -4,13 +4,15 @@ steps: - template: azure-install-rust.yml - - script: rustup component add rust-src - displayName: Install Rust sources - condition: eq( variables['XARGO'], '1' ) - - bash: rustup target add $TARGET displayName: Install Rust target - condition: ne( variables['XARGO'], '1' ) + + - bash: | + set -e + curl -L https://github.com/rust-lang/llvm-project/archive/rustc/8.0-2019-03-18.tar.gz | \ + tar xzf - --strip-components 1 llvm-project-rustc-8.0-2019-03-18/compiler-rt + echo '##vso[task.setvariable variable=RUST_COMPILER_RT_ROOT]./compiler-rt' + displayName: "Download compiler-rt reference sources" - bash: ./ci/run.sh $TARGET condition: ne( variables['Agent.OS'], 'Linux' ) diff --git a/ci/run-docker.sh b/ci/run-docker.sh index ddb970c..dbc86ca 100755 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -18,6 +18,7 @@ run() { --user $(id -u):$(id -g) \ -e CARGO_HOME=/cargo \ -e CARGO_TARGET_DIR=/target \ + -e RUST_COMPILER_RT_ROOT \ -v $HOME/.cargo:/cargo \ -v `pwd`/target:/target \ -v `pwd`:/checkout:ro \ diff --git a/ci/run.sh b/ci/run.sh index 4d6d6c6..ae32806 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -1,6 +1,5 @@ set -ex -export CARGO_INCREMENTAL=0 cargo=cargo # Test our implementation diff --git a/compiler-rt b/compiler-rt deleted file mode 160000 index 03fc28f..0000000 --- a/compiler-rt +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 03fc28f9273eeab16f1005f982dfde5900bddb29