diff --git a/config.toml.example b/config.toml.example index 9afbd937c422c187ce58113dd664b1748729708c..8c1049f42c535bae2b1aad811d1b5db7fe41a189 100644 --- a/config.toml.example +++ b/config.toml.example @@ -14,10 +14,6 @@ # ============================================================================= [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 diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index ffd23e72e80a68cd206f7e43c1943a06ee61bde6..cc452c7a137fa434ac467984b13973dab6783bb0 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -996,10 +996,7 @@ pub fn cargo( // For other crates, however, we know that we've already got a standard // library up and running, so we can use the normal compiler to compile // build scripts in that situation. - // - // 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.llvm_enabled { + if mode == Mode::Std { cargo .env("RUSTC_SNAPSHOT", &self.initial_rustc) .env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_snapshot_libdir()); diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index d20958854ed6a132a14a6daa18ded263d3440afd..6162c7e0a37c3f9bf63c175129f0dcf8b89e56f9 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -64,7 +64,6 @@ 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_thin_lto: bool, @@ -244,7 +243,6 @@ struct Install { #[derive(Deserialize, Default)] #[serde(deny_unknown_fields, rename_all = "kebab-case")] struct Llvm { - enabled: Option, ccache: Option, ninja: Option, assertions: Option, @@ -360,7 +358,6 @@ fn path_from_python(var_key: &str) -> PathBuf { pub fn default_opts() -> Config { let mut config = Config::default(); - config.llvm_enabled = true; config.llvm_optimize = true; config.llvm_version_check = true; config.backtrace = true; @@ -512,7 +509,6 @@ pub fn parse(args: &[String]) -> 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_thin_lto, llvm.thin_lto); @@ -671,6 +667,11 @@ pub fn verbose(&self) -> bool { pub fn very_verbose(&self) -> bool { self.verbose > 1 } + + pub fn llvm_enabled(&self) -> bool { + self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) + || self.rust_codegen_backends.contains(&INTERNER.intern_str("emscripten")) + } } fn set(field: &mut T, val: Option) { diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 81e09bc878a1087d40dfad356150f3a87bb3e7e6..8a9d99c1662ddef1b9b2a690ab6516c486621f2f 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1194,7 +1194,7 @@ fn run(self, builder: &Builder<'_>) { cmd.arg("--quiet"); } - if builder.config.llvm_enabled { + if builder.config.llvm_enabled() { let llvm_config = builder.ensure(native::Llvm { target: builder.config.build, emscripten: false, @@ -1227,12 +1227,6 @@ fn run(self, builder: &Builder<'_>) { } } } - if suite == "run-make-fulldeps" && !builder.config.llvm_enabled { - builder.info( - "Ignoring run-make test suite as they generally don't work without LLVM" - ); - return; - } if suite != "run-make-fulldeps" { cmd.arg("--cc") diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 9dbcacf70262c131f32a6608a6d8e0c9665f329f..c8eb0ccf2273e17000a60d4b5556d198a65ad2a0 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -699,8 +699,8 @@ fn prepare_tool_cmd(&self, compiler: Compiler, tool: Tool, cmd: &mut Command) { add_lib_path(lib_paths, cmd); } - fn llvm_bin_path(&self) -> Option { - if self.config.llvm_enabled { +fn llvm_bin_path(&self) -> Option { + if self.config.llvm_enabled() { let llvm_config = self.ensure(native::Llvm { target: self.config.build, emscripten: false,