From ef41cf028809328d3f976d3c2eb6a7ef8d912a19 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 29 Jun 2018 14:35:10 -0700 Subject: Compile stage0 tools with the raw bootstrap compiler This commit updates the stage0 build of tools to use the libraries of the stage0 compiler instead of the compiled libraries by the stage0 compiler. This should enable us to avoid any stage0 hacks (like missing SIMD). --- src/bootstrap/builder.rs | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src/bootstrap/builder.rs') diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index fa2440e27d0..fad0a553802 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -769,6 +769,22 @@ impl<'a> Builder<'a> { let want_rustdoc = self.doc_tests != DocTests::No; + // We synthetically interpret a stage0 compiler used to build tools as a + // "raw" compiler in that it's the exact snapshot we download. Normally + // the stage0 build means it uses libraries build by the stage0 + // compiler, but for tools we just use the precompiled libraries that + // we've downloaded + let use_snapshot = mode == Mode::ToolBootstrap; + assert!(!use_snapshot || stage == 0); + + let maybe_sysroot = self.sysroot(compiler); + let sysroot = if use_snapshot { + self.rustc_snapshot_sysroot() + } else { + &maybe_sysroot + }; + let libdir = sysroot.join(libdir(&compiler.host)); + // Customize the compiler we're running. Specify the compiler to cargo // as our shim and then pass it some various options used to configure // how the actual compiler itself is called. @@ -784,8 +800,8 @@ impl<'a> Builder<'a> { "RUSTC_DEBUG_ASSERTIONS", self.config.rust_debug_assertions.to_string(), ) - .env("RUSTC_SYSROOT", self.sysroot(compiler)) - .env("RUSTC_LIBDIR", self.rustc_libdir(compiler)) + .env("RUSTC_SYSROOT", &sysroot) + .env("RUSTC_LIBDIR", &libdir) .env("RUSTC_RPATH", self.config.rust_rpath.to_string()) .env("RUSTDOC", self.out.join("bootstrap/debug/rustdoc")) .env( @@ -809,7 +825,7 @@ impl<'a> Builder<'a> { cargo.env("RUSTC_ERROR_FORMAT", error_format); } if cmd != "build" && cmd != "check" && want_rustdoc { - cargo.env("RUSTDOC_LIBDIR", self.sysroot_libdir(compiler, self.config.build)); + cargo.env("RUSTDOC_LIBDIR", &libdir); } if mode.is_tool() { -- cgit 1.4.1-3-g733a5