Skip to content

Commit 7f2d2af

Browse files
committed
Auto merge of #38697 - alexcrichton:rollup, r=alexcrichton
Rollup of 25 pull requests - Successful merges: #37149, #38491, #38517, #38559, #38587, #38609, #38611, #38622, #38628, #38630, #38631, #38632, #38635, #38647, #38649, #38655, #38659, #38660, #38662, #38665, #38671, #38674, #38676, #38693, #38695 - Failed merges: #38657, #38680
2 parents 75f5981 + e484197 commit 7f2d2af

File tree

57 files changed

+1022
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1022
-300
lines changed

.travis.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ matrix:
1919
- env: IMAGE=i686-gnu-nopt
2020
- env: IMAGE=x86_64-freebsd
2121
- env: IMAGE=x86_64-gnu
22-
- env: IMAGE=x86_64-gnu-cargotest
22+
- env: IMAGE=x86_64-gnu-full-bootstrap
23+
- env: IMAGE=x86_64-gnu-aux
2324
- env: IMAGE=x86_64-gnu-debug
2425
- env: IMAGE=x86_64-gnu-nopt
2526
- env: IMAGE=x86_64-gnu-make
@@ -66,10 +67,10 @@ script:
6667
if [ "$ALLOW_PR" = "" ] && [ "$TRAVIS_BRANCH" != "auto" ]; then
6768
echo skipping, not a full build;
6869
elif [ "$TRAVIS_OS_NAME" = "osx" ]; then
69-
git submodule update --init;
70+
git submodule update --init &&
7071
src/ci/run.sh;
7172
else
72-
git submodule update --init;
73+
git submodule update --init &&
7374
src/ci/docker/run.sh $IMAGE;
7475
fi
7576
@@ -78,7 +79,7 @@ before_cache:
7879
- docker history -q rust-ci |
7980
grep -v missing |
8081
xargs docker save |
81-
gzip -9 > $HOME/docker/rust-ci.tar.gz
82+
gzip > $HOME/docker/rust-ci.tar.gz
8283
before_install:
8384
- zcat $HOME/docker/rust-ci.tar.gz | docker load || true
8485

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ build.
8282
# Install build tools needed for Rust. If you're building a 32-bit compiler,
8383
# then replace "x86_64" below with "i686". If you've already got git, python,
8484
# or CMake installed and in PATH you can remove them from this list. Note
85-
# that it is important that the `python2` and `cmake` packages **not** used.
86-
# The build has historically been known to fail with these packages.
85+
# that it is important that you do **not** use the 'python2' and 'cmake'
86+
# packages from the 'msys2' subsystem. The build has historically been known
87+
# to fail with these packages.
8788
$ pacman -S git \
8889
make \
8990
diffutils \

appveyor.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ environment:
2121
# MSVC cargotest
2222
- MSYS_BITS: 64
2323
NO_VENDOR: 1
24-
RUST_CHECK_TARGET: check-cargotest
24+
RUST_CHECK_TARGET: check-aux
2525
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc
2626

2727
# 32/64-bit MinGW builds.

configure

+1
Original file line numberDiff line numberDiff line change
@@ -693,6 +693,7 @@ opt_nosave manage-submodules 1 "let the build manage the git submodules"
693693
opt_nosave clang 0 "prefer clang to gcc for building the runtime"
694694
opt_nosave jemalloc 1 "build liballoc with jemalloc"
695695
opt elf-tls 1 "elf thread local storage on platforms where supported"
696+
opt full-bootstrap 0 "build three compilers instead of two"
696697

697698
valopt_nosave prefix "/usr/local" "set installation prefix"
698699
valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"

src/bootstrap/check.rs

+14-4
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,22 @@ pub fn krate(build: &Build,
341341
println!("{} {} stage{} ({} -> {})", test_kind, name, compiler.stage,
342342
compiler.host, target);
343343

344+
// If we're not doing a full bootstrap but we're testing a stage2 version of
345+
// libstd, then what we're actually testing is the libstd produced in
346+
// stage1. Reflect that here by updating the compiler that we're working
347+
// with automatically.
348+
let compiler = if build.force_use_stage1(compiler, target) {
349+
Compiler::new(1, compiler.host)
350+
} else {
351+
compiler.clone()
352+
};
353+
344354
// Build up the base `cargo test` command.
345355
//
346356
// Pass in some standard flags then iterate over the graph we've discovered
347357
// in `cargo metadata` with the maps above and figure out what `-p`
348358
// arguments need to get passed.
349-
let mut cargo = build.cargo(compiler, mode, target, test_kind.subcommand());
359+
let mut cargo = build.cargo(&compiler, mode, target, test_kind.subcommand());
350360
cargo.arg("--manifest-path")
351361
.arg(build.src.join(path).join("Cargo.toml"))
352362
.arg("--features").arg(features);
@@ -380,7 +390,7 @@ pub fn krate(build: &Build,
380390
// Note that to run the compiler we need to run with the *host* libraries,
381391
// but our wrapper scripts arrange for that to be the case anyway.
382392
let mut dylib_path = dylib_path();
383-
dylib_path.insert(0, build.sysroot_libdir(compiler, target));
393+
dylib_path.insert(0, build.sysroot_libdir(&compiler, target));
384394
cargo.env(dylib_path_var(), env::join_paths(&dylib_path).unwrap());
385395

386396
if target.contains("android") {
@@ -399,10 +409,10 @@ pub fn krate(build: &Build,
399409

400410
if target.contains("android") {
401411
build.run(&mut cargo);
402-
krate_android(build, compiler, target, mode);
412+
krate_android(build, &compiler, target, mode);
403413
} else if target.contains("emscripten") {
404414
build.run(&mut cargo);
405-
krate_emscripten(build, compiler, target, mode);
415+
krate_emscripten(build, &compiler, target, mode);
406416
} else {
407417
cargo.args(&build.flags.cmd.test_args());
408418
build.run(&mut cargo);

src/bootstrap/compile.rs

+61-53
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,12 @@ use {Build, Compiler, Mode};
3333
/// This will build the standard library for a particular stage of the build
3434
/// using the `compiler` targeting the `target` architecture. The artifacts
3535
/// created will also be linked into the sysroot directory.
36-
pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
37-
println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
38-
compiler.host, target);
39-
36+
pub fn std(build: &Build, target: &str, compiler: &Compiler) {
4037
let libdir = build.sysroot_libdir(compiler, target);
41-
let _ = fs::remove_dir_all(&libdir);
4238
t!(fs::create_dir_all(&libdir));
4339

44-
// Some platforms have startup objects that may be required to produce the
45-
// libstd dynamic library, for example.
46-
build_startup_objects(build, target, &libdir);
40+
println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
41+
compiler.host, target);
4742

4843
let out_dir = build.cargo_out(compiler, Mode::Libstd, target);
4944
build.clear_if_dirty(&out_dir, &build.compiler_path(compiler));
@@ -65,29 +60,30 @@ pub fn std<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
6560

6661
build.run(&mut cargo);
6762
update_mtime(&libstd_stamp(build, &compiler, target));
68-
std_link(build, target, compiler.stage, compiler.host);
6963
}
7064

7165
/// Link all libstd rlibs/dylibs into the sysroot location.
7266
///
73-
/// Links those artifacts generated in the given `stage` for `target` produced
74-
/// by `compiler` into `host`'s sysroot.
67+
/// Links those artifacts generated by `compiler` to a the `stage` compiler's
68+
/// sysroot for the specified `host` and `target`.
69+
///
70+
/// Note that this assumes that `compiler` has already generated the libstd
71+
/// libraries for `target`, and this method will find them in the relevant
72+
/// output directory.
7573
pub fn std_link(build: &Build,
76-
target: &str,
77-
stage: u32,
78-
host: &str) {
79-
let compiler = Compiler::new(stage, &build.config.build);
80-
let target_compiler = Compiler::new(compiler.stage, host);
74+
compiler: &Compiler,
75+
target_compiler: &Compiler,
76+
target: &str) {
77+
println!("Copying stage{} std from stage{} ({} -> {} / {})",
78+
target_compiler.stage,
79+
compiler.stage,
80+
compiler.host,
81+
target_compiler.host,
82+
target);
8183
let libdir = build.sysroot_libdir(&target_compiler, target);
8284
let out_dir = build.cargo_out(&compiler, Mode::Libstd, target);
8385

84-
// If we're linking one compiler host's output into another, then we weren't
85-
// called from the `std` method above. In that case we clean out what's
86-
// already there.
87-
if host != compiler.host {
88-
let _ = fs::remove_dir_all(&libdir);
89-
t!(fs::create_dir_all(&libdir));
90-
}
86+
t!(fs::create_dir_all(&libdir));
9187
add_to_sysroot(&out_dir, &libdir);
9288

9389
if target.contains("musl") && !target.contains("mips") {
@@ -110,20 +106,23 @@ fn copy_musl_third_party_objects(build: &Build, target: &str, into: &Path) {
110106
/// They don't require any library support as they're just plain old object
111107
/// files, so we just use the nightly snapshot compiler to always build them (as
112108
/// no other compilers are guaranteed to be available).
113-
fn build_startup_objects(build: &Build, target: &str, into: &Path) {
109+
pub fn build_startup_objects(build: &Build, for_compiler: &Compiler, target: &str) {
114110
if !target.contains("pc-windows-gnu") {
115111
return
116112
}
113+
117114
let compiler = Compiler::new(0, &build.config.build);
118115
let compiler_path = build.compiler_path(&compiler);
116+
let into = build.sysroot_libdir(for_compiler, target);
117+
t!(fs::create_dir_all(&into));
119118

120119
for file in t!(fs::read_dir(build.src.join("src/rtstartup"))) {
121120
let file = t!(file);
122121
let mut cmd = Command::new(&compiler_path);
123122
build.run(cmd.env("RUSTC_BOOTSTRAP", "1")
124123
.arg("--target").arg(target)
125124
.arg("--emit=obj")
126-
.arg("--out-dir").arg(into)
125+
.arg("--out-dir").arg(&into)
127126
.arg(file.path()));
128127
}
129128

@@ -137,7 +136,7 @@ fn build_startup_objects(build: &Build, target: &str, into: &Path) {
137136
/// This will build libtest and supporting libraries for a particular stage of
138137
/// the build using the `compiler` targeting the `target` architecture. The
139138
/// artifacts created will also be linked into the sysroot directory.
140-
pub fn test<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
139+
pub fn test(build: &Build, target: &str, compiler: &Compiler) {
141140
println!("Building stage{} test artifacts ({} -> {})", compiler.stage,
142141
compiler.host, target);
143142
let out_dir = build.cargo_out(compiler, Mode::Libtest, target);
@@ -147,19 +146,19 @@ pub fn test<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
147146
.arg(build.src.join("src/rustc/test_shim/Cargo.toml"));
148147
build.run(&mut cargo);
149148
update_mtime(&libtest_stamp(build, compiler, target));
150-
test_link(build, target, compiler.stage, compiler.host);
151149
}
152150

153-
/// Link all libtest rlibs/dylibs into the sysroot location.
154-
///
155-
/// Links those artifacts generated in the given `stage` for `target` produced
156-
/// by `compiler` into `host`'s sysroot.
151+
/// Same as `std_link`, only for libtest
157152
pub fn test_link(build: &Build,
158-
target: &str,
159-
stage: u32,
160-
host: &str) {
161-
let compiler = Compiler::new(stage, &build.config.build);
162-
let target_compiler = Compiler::new(compiler.stage, host);
153+
compiler: &Compiler,
154+
target_compiler: &Compiler,
155+
target: &str) {
156+
println!("Copying stage{} test from stage{} ({} -> {} / {})",
157+
target_compiler.stage,
158+
compiler.stage,
159+
compiler.host,
160+
target_compiler.host,
161+
target);
163162
let libdir = build.sysroot_libdir(&target_compiler, target);
164163
let out_dir = build.cargo_out(&compiler, Mode::Libtest, target);
165164
add_to_sysroot(&out_dir, &libdir);
@@ -170,7 +169,7 @@ pub fn test_link(build: &Build,
170169
/// This will build the compiler for a particular stage of the build using
171170
/// the `compiler` targeting the `target` architecture. The artifacts
172171
/// created will also be linked into the sysroot directory.
173-
pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
172+
pub fn rustc(build: &Build, target: &str, compiler: &Compiler) {
174173
println!("Building stage{} compiler artifacts ({} -> {})",
175174
compiler.stage, compiler.host, target);
176175

@@ -222,20 +221,19 @@ pub fn rustc<'a>(build: &'a Build, target: &str, compiler: &Compiler<'a>) {
222221
cargo.env("CFG_DEFAULT_AR", s);
223222
}
224223
build.run(&mut cargo);
225-
226-
rustc_link(build, target, compiler.stage, compiler.host);
227224
}
228225

229-
/// Link all librustc rlibs/dylibs into the sysroot location.
230-
///
231-
/// Links those artifacts generated in the given `stage` for `target` produced
232-
/// by `compiler` into `host`'s sysroot.
226+
/// Same as `std_link`, only for librustc
233227
pub fn rustc_link(build: &Build,
234-
target: &str,
235-
stage: u32,
236-
host: &str) {
237-
let compiler = Compiler::new(stage, &build.config.build);
238-
let target_compiler = Compiler::new(compiler.stage, host);
228+
compiler: &Compiler,
229+
target_compiler: &Compiler,
230+
target: &str) {
231+
println!("Copying stage{} rustc from stage{} ({} -> {} / {})",
232+
target_compiler.stage,
233+
compiler.stage,
234+
compiler.host,
235+
target_compiler.host,
236+
target);
239237
let libdir = build.sysroot_libdir(&target_compiler, target);
240238
let out_dir = build.cargo_out(&compiler, Mode::Librustc, target);
241239
add_to_sysroot(&out_dir, &libdir);
@@ -259,6 +257,17 @@ fn compiler_file(compiler: &Path, file: &str) -> PathBuf {
259257
PathBuf::from(out.trim())
260258
}
261259

260+
pub fn create_sysroot(build: &Build, compiler: &Compiler) {
261+
// nothing to do in stage0
262+
if compiler.stage == 0 {
263+
return
264+
}
265+
266+
let sysroot = build.sysroot(compiler);
267+
let _ = fs::remove_dir_all(&sysroot);
268+
t!(fs::create_dir_all(&sysroot));
269+
}
270+
262271
/// Prepare a new compiler from the artifacts in `stage`
263272
///
264273
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
@@ -269,18 +278,17 @@ pub fn assemble_rustc(build: &Build, stage: u32, host: &str) {
269278
if stage == 0 {
270279
return
271280
}
281+
282+
println!("Copying stage{} compiler ({})", stage, host);
283+
272284
// The compiler that we're assembling
273285
let target_compiler = Compiler::new(stage, host);
274286

275287
// The compiler that compiled the compiler we're assembling
276288
let build_compiler = Compiler::new(stage - 1, &build.config.build);
277289

278-
// Clear out old files
279-
let sysroot = build.sysroot(&target_compiler);
280-
let _ = fs::remove_dir_all(&sysroot);
281-
t!(fs::create_dir_all(&sysroot));
282-
283290
// Link in all dylibs to the libdir
291+
let sysroot = build.sysroot(&target_compiler);
284292
let sysroot_libdir = sysroot.join(libdir(host));
285293
t!(fs::create_dir_all(&sysroot_libdir));
286294
let src_libdir = build.sysroot_libdir(&build_compiler, host);

src/bootstrap/config.rs

+7
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ pub struct Config {
4646
pub docs: bool,
4747
pub vendor: bool,
4848
pub target_config: HashMap<String, Target>,
49+
pub full_bootstrap: bool,
4950

5051
// llvm codegen options
5152
pub llvm_assertions: bool,
@@ -54,6 +55,7 @@ pub struct Config {
5455
pub llvm_version_check: bool,
5556
pub llvm_static_stdcpp: bool,
5657
pub llvm_link_shared: bool,
58+
pub llvm_targets: Option<String>,
5759

5860
// rust codegen options
5961
pub rust_optimize: bool,
@@ -134,6 +136,7 @@ struct Build {
134136
vendor: Option<bool>,
135137
nodejs: Option<String>,
136138
python: Option<String>,
139+
full_bootstrap: Option<bool>,
137140
}
138141

139142
/// TOML representation of various global install decisions.
@@ -152,6 +155,7 @@ struct Llvm {
152155
release_debuginfo: Option<bool>,
153156
version_check: Option<bool>,
154157
static_libstdcpp: Option<bool>,
158+
targets: Option<String>,
155159
}
156160

157161
#[derive(RustcDecodable)]
@@ -264,6 +268,7 @@ impl Config {
264268
set(&mut config.docs, build.docs);
265269
set(&mut config.submodules, build.submodules);
266270
set(&mut config.vendor, build.vendor);
271+
set(&mut config.full_bootstrap, build.full_bootstrap);
267272

268273
if let Some(ref install) = toml.install {
269274
config.prefix = install.prefix.clone();
@@ -285,6 +290,7 @@ impl Config {
285290
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
286291
set(&mut config.llvm_version_check, llvm.version_check);
287292
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
293+
config.llvm_targets = llvm.targets.clone();
288294
}
289295

290296
if let Some(ref rust) = toml.rust {
@@ -393,6 +399,7 @@ impl Config {
393399
("NINJA", self.ninja),
394400
("CODEGEN_TESTS", self.codegen_tests),
395401
("VENDOR", self.vendor),
402+
("FULL_BOOTSTRAP", self.full_bootstrap),
396403
}
397404

398405
match key {

0 commit comments

Comments
 (0)