Revert changes to bootstrap, rustc_driver and fix {core,std}simd

This commit is contained in:
bjorn3 2018-06-30 10:45:14 +02:00
parent 163cb572a4
commit ff12beb875
11 changed files with 36 additions and 61 deletions

View File

@ -14,6 +14,10 @@
# =============================================================================
[llvm]
# Indicates whether rustc will support compilation with LLVM
# note: rustc does not compile without LLVM at the moment
#enabled = true
# Indicates whether the LLVM build is a Release or Debug build
#optimize = true
@ -330,8 +334,8 @@
# This is an array of the codegen backends that will be compiled for the rustc
# that's being compiled. The default is to only build the LLVM codegen backend,
# but you can also optionally enable the "emscripten" backend for asm.js or
# make this an empty array (which will disable LLVM, but that probably won't
# get too far in the bootstrap)
# make this an empty array (but that probably won't get too far in the
# bootstrap)
#codegen-backends = ["llvm"]
# This is the name of the directory in which codegen backends will get installed

View File

@ -107,11 +107,6 @@ fn main() {
env::join_paths(&dylib_path).unwrap());
let mut maybe_crate = None;
// Don't use metadata only backend for snapshot compiler, because it may be broken
if env::var("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND").is_err() {
cmd.arg("--cfg").arg("codegen_backend=\"llvm\"");
}
// Print backtrace in case of ICE
if env::var("RUSTC_BACKTRACE_ON_ICE").is_ok() && env::var("RUST_BACKTRACE").is_err() {
cmd.env("RUST_BACKTRACE", "1");

View File

@ -747,10 +747,6 @@ impl<'a> Builder<'a> {
stage = compiler.stage;
}
if self.config.rust_codegen_backends.is_empty() {
cargo.env("RUSTC_SHOULD_USE_METADATA_ONLY_BACKEND", "1");
}
let mut extra_args = env::var(&format!("RUSTFLAGS_STAGE_{}", stage)).unwrap_or_default();
if stage != 0 {
let s = env::var("RUSTFLAGS_STAGE_NOT_0").unwrap_or_default();
@ -897,7 +893,7 @@ impl<'a> Builder<'a> {
//
// If LLVM support is disabled we need to use the snapshot compiler to compile
// build scripts, as the new compiler doesn't support executables.
if mode == Mode::Std || self.config.rust_codegen_backends.is_empty() {
if mode == Mode::Std || !self.config.llvm_enabled {
cargo
.env("RUSTC_SNAPSHOT", &self.initial_rustc)
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir());

View File

@ -182,13 +182,11 @@ pub fn std_cargo(builder: &Builder,
// missing
// We also only build the runtimes when --enable-sanitizers (or its
// config.toml equivalent) is used
if !builder.config.rust_codegen_backends.is_empty() {
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
}
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
});
cargo.env("LLVM_CONFIG", llvm_config);
}
cargo.arg("--features").arg(features)
@ -645,13 +643,14 @@ impl Step for CodegenBackend {
fn make_run(run: RunConfig) {
let backend = run.builder.config.rust_codegen_backends.get(0);
if let Some(backend) = backend.cloned() {
run.builder.ensure(CodegenBackend {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
target: run.target,
backend,
});
}
let backend = backend.cloned().unwrap_or_else(|| {
INTERNER.intern_str("llvm")
});
run.builder.ensure(CodegenBackend {
compiler: run.builder.compiler(run.builder.top_stage, run.host),
target: run.target,
backend,
});
}
fn run(self, builder: &Builder) {

View File

@ -74,6 +74,7 @@ pub struct Config {
pub backtrace_on_ice: bool,
// llvm codegen options
pub llvm_enabled: bool,
pub llvm_assertions: bool,
pub llvm_optimize: bool,
pub llvm_release_debuginfo: bool,
@ -238,6 +239,7 @@ struct Install {
#[derive(Deserialize, Default)]
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
struct Llvm {
enabled: Option<bool>,
ccache: Option<StringOrBool>,
ninja: Option<bool>,
assertions: Option<bool>,
@ -339,6 +341,7 @@ impl Config {
pub fn default_opts() -> Config {
let mut config = Config::default();
config.llvm_enabled = true;
config.llvm_optimize = true;
config.llvm_version_check = true;
config.use_jemalloc = true;
@ -493,6 +496,7 @@ impl Config {
Some(StringOrBool::Bool(false)) | None => {}
}
set(&mut config.ninja, llvm.ninja);
set(&mut config.llvm_enabled, llvm.enabled);
llvm_assertions = llvm.assertions;
set(&mut config.llvm_optimize, llvm.optimize);
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);

View File

@ -1096,7 +1096,7 @@ impl Step for Compiletest {
cmd.arg("--quiet");
}
if !builder.config.rust_codegen_backends.is_empty() {
if builder.config.llvm_enabled {
let llvm_config = builder.ensure(native::Llvm {
target: builder.config.build,
emscripten: false,
@ -1129,7 +1129,7 @@ impl Step for Compiletest {
}
}
}
if suite == "run-make-fulldeps" && builder.config.rust_codegen_backends.is_empty() {
if suite == "run-make-fulldeps" && !builder.config.llvm_enabled {
builder.info(&format!(
"Ignoring run-make test suite as they generally don't work without LLVM"
));

View File

@ -672,7 +672,7 @@ impl<'a> Builder<'a> {
}
fn llvm_bin_path(&self) -> Option<PathBuf> {
if !self.config.rust_codegen_backends.is_empty() && !self.config.dry_run {
if self.config.llvm_enabled && !self.config.dry_run {
let llvm_config = self.ensure(native::Llvm {
target: self.config.build,
emscripten: false,

View File

@ -241,13 +241,12 @@ macro_rules! vector_impl { ($([$f:ident, $($args:tt)*]),*) => { $($f!($($args)*)
#[path = "../stdsimd/coresimd/mod.rs"]
#[allow(missing_docs, missing_debug_implementations, dead_code, unused_imports)]
#[unstable(feature = "stdsimd", issue = "48556")]
// allow changes to how stdsimd works in stage0 and don't use whithout LLVM
#[cfg(all(not(stage0), codegen_backend="llvm"))]
#[cfg(not(stage0))] // allow changes to how stdsimd works in stage0
mod coresimd;
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), codegen_backend="llvm"))]
#[cfg(not(stage0))]
pub use coresimd::simd;
#[stable(feature = "simd_arch", since = "1.27.0")]
#[cfg(all(not(stage0), codegen_backend="llvm"))]
#[cfg(not(stage0))]
pub use coresimd::arch;

View File

@ -1418,18 +1418,6 @@ pub fn default_configuration(sess: &Session) -> ast::CrateConfig {
if sess.opts.crate_types.contains(&CrateTypeProcMacro) {
ret.insert((Symbol::intern("proc_macro"), None));
}
/*if nightly_options::is_nightly_build() {
let backend_name = sess.opts
.debugging_opts
.codegen_backend
.as_ref()
.map(|s| s as &str)
.unwrap_or("llvm");
ret.insert((
Symbol::intern("codegen_backend"),
Some(Symbol::intern(backend_name)),
));
}*/
return ret;
}

View File

@ -375,20 +375,10 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<CodegenBackend> {
match file {
Some(ref s) => return load_backend_from_dylib(s),
None => {
if !::rustc::session::config::nightly_options::is_nightly_build() {
let err = format!("failed to load default codegen backend for `{}`, \
let err = format!("failed to load default codegen backend for `{}`, \
no appropriate codegen dylib found in `{}`",
backend_name, sysroot.display());
early_error(ErrorOutputType::default(), &err);
} else {
let warn = format!("no codegen-backend `{}`, \
no appropriate dylib in `{}`. \
Falling back to metadata_only codegen backend. \
**This is suitable for dev purposes only**",
backend_name, sysroot.display());
early_warn(ErrorOutputType::default(), &warn);
return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new;
}
early_error(ErrorOutputType::default(), &err);
}
}

View File

@ -523,22 +523,22 @@ pub mod rt;
#[path = "../stdsimd/stdsimd/mod.rs"]
#[allow(missing_debug_implementations, missing_docs, dead_code)]
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
#[cfg(all(not(stage0), not(test)))]
mod stdsimd;
// A "fake" module needed by the `stdsimd` module to compile, not actually
// exported though.
#[cfg(all(not(stage0), codegen_backend="llvm"))]
#[cfg(not(stage0))]
mod coresimd {
pub use core::arch;
pub use core::simd;
}
#[unstable(feature = "stdsimd", issue = "48556")]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
#[cfg(all(not(stage0), not(test)))]
pub use stdsimd::simd;
#[stable(feature = "simd_arch", since = "1.27.0")]
#[cfg(all(not(stage0), not(test), codegen_backend="llvm"))]
#[cfg(all(not(stage0), not(test)))]
pub use stdsimd::arch;
// Include a number of private modules that exist solely to provide