Skip to content

Commit aa41e0d

Browse files
committed
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.
1 parent 6566ad9 commit aa41e0d

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[submodule "compiler-rt"]
2-
path = compiler-rt
3-
url = https://github.com/rust-lang/compiler-rt
41
[submodule "libm"]
52
path = libm
63
url = https://github.com/rust-lang-nursery/libm

build.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ mod c {
7676

7777
use std::collections::BTreeMap;
7878
use std::env;
79-
use std::path::Path;
79+
use std::path::PathBuf;
8080

8181
struct Sources {
8282
// SYMBOL -> PATH TO SOURCE
@@ -411,15 +411,19 @@ mod c {
411411
sources.remove(&["__aeabi_cdcmp", "__aeabi_cfcmp"]);
412412
}
413413

414-
// When compiling in rustbuild (the rust-lang/rust repo) this build
415-
// script runs from a directory other than this root directory.
416-
let root = if cfg!(feature = "rustbuild") {
417-
Path::new("../../libcompiler_builtins")
418-
} else {
419-
Path::new(".")
414+
// When compiling the C code we require the user to tell us where the
415+
// source code is, and this is largely done so when we're compiling as
416+
// part of rust-lang/rust we can use the same llvm-project repository as
417+
// rust-lang/rust.
418+
let root = match env::var_os("RUST_COMPILER_RT_ROOT") {
419+
Some(s) => PathBuf::from(s),
420+
None => panic!("RUST_COMPILER_RT_ROOT is not set"),
420421
};
422+
if !root.exists() {
423+
panic!("RUST_COMPILER_RT_ROOT={} does not exist", root.display());
424+
}
421425

422-
let src_dir = root.join("compiler-rt/lib/builtins");
426+
let src_dir = root.join("lib/builtins");
423427
for (sym, src) in sources.map.iter() {
424428
let src = src_dir.join(src);
425429
cfg.file(&src);

ci/azure-steps.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ steps:
44

55
- template: azure-install-rust.yml
66

7-
- script: rustup component add rust-src
8-
displayName: Install Rust sources
9-
condition: eq( variables['XARGO'], '1' )
10-
117
- bash: rustup target add $TARGET
128
displayName: Install Rust target
13-
condition: ne( variables['XARGO'], '1' )
9+
10+
- bash: |
11+
set -e
12+
curl -L https://github.com/rust-lang/llvm-project/archive/rustc/8.0-2019-03-18.tar.gz | \
13+
tar xzf - --strip-components 1 llvm-project-rustc-8.0-2019-03-18/compiler-rt
14+
echo '##vso[task.setvariable variable=RUST_COMPILER_RT_ROOT]./compiler-rt'
15+
displayName: "Download compiler-rt reference sources"
1416
1517
- bash: ./ci/run.sh $TARGET
1618
condition: ne( variables['Agent.OS'], 'Linux' )

ci/run-docker.sh

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ run() {
1818
--user $(id -u):$(id -g) \
1919
-e CARGO_HOME=/cargo \
2020
-e CARGO_TARGET_DIR=/target \
21+
-e RUST_COMPILER_RT_ROOT \
2122
-v $HOME/.cargo:/cargo \
2223
-v `pwd`/target:/target \
2324
-v `pwd`:/checkout:ro \

ci/run.sh

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
set -ex
22

3-
export CARGO_INCREMENTAL=0
43
cargo=cargo
54

65
# Test our implementation

compiler-rt

-1
This file was deleted.

0 commit comments

Comments
 (0)