Skip to content

Commit 9e2bd92

Browse files
committed
mk: Don't consider LLVM done until it's done
Currently if an LLVM build is interrupted *after* it creates the llvm-config binary but before it's done it puts us in an inconsistent state where we think LLVM is compiled but it's not actually. This tweaks our logic to only consider LLVM done building once it's actually done building. This should hopefully alleviate problems on the bots where if we interrupt at the wrong time it doesn't corrupt the build directory.
1 parent c2b56fb commit 9e2bd92

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Diff for: mk/llvm.mk

+5-2
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,19 @@ endif
3737
ifeq ($(CFG_LLVM_ROOT),)
3838

3939
LLVM_STAMP_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-auto-clean-stamp
40+
LLVM_DONE_$(1) = $$(CFG_LLVM_BUILD_DIR_$(1))/llvm-finished-building
4041

41-
$$(LLVM_CONFIG_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
42+
$$(LLVM_CONFIG_$(1)): $$(LLVM_DONE_$(1))
43+
44+
$$(LLVM_DONE_$(1)): $$(LLVM_DEPS_TARGET_$(1)) $$(LLVM_STAMP_$(1))
4245
@$$(call E, cmake: llvm)
4346
ifeq ($$(findstring msvc,$(1)),msvc)
4447
$$(Q)$$(CFG_CMAKE) --build $$(CFG_LLVM_BUILD_DIR_$(1)) \
4548
--config $$(LLVM_BUILD_CONFIG_MODE)
4649
else
4750
$$(Q)$$(MAKE) -C $$(CFG_LLVM_BUILD_DIR_$(1))
4851
endif
49-
$$(Q)touch $$(LLVM_CONFIG_$(1))
52+
$$(Q)touch $$@
5053

5154
ifeq ($$(findstring msvc,$(1)),msvc)
5255
clean-llvm$(1):

Diff for: src/bootstrap/build/native.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
2121
use std::path::Path;
2222
use std::process::Command;
23-
use std::fs;
23+
use std::fs::{self, File};
2424

2525
use build_helper::output;
2626
use cmake;
2727
use gcc;
2828

2929
use build::Build;
30-
use build::util::{exe, staticlib, up_to_date};
30+
use build::util::{staticlib, up_to_date};
3131

3232
/// Compile LLVM for `target`.
3333
pub fn llvm(build: &Build, target: &str) {
@@ -43,9 +43,9 @@ pub fn llvm(build: &Build, target: &str) {
4343
// artifacts are missing) then we keep going, otherwise we bail out.
4444
let dst = build.llvm_out(target);
4545
let stamp = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
46-
let llvm_config = dst.join("bin").join(exe("llvm-config", target));
46+
let done_stamp = dst.join("llvm-finished-building");
4747
build.clear_if_dirty(&dst, &stamp);
48-
if fs::metadata(llvm_config).is_ok() {
48+
if fs::metadata(&done_stamp).is_ok() {
4949
return
5050
}
5151

@@ -111,6 +111,8 @@ pub fn llvm(build: &Build, target: &str) {
111111
// tools. Figure out how to filter them down and only build the right
112112
// tools and libs on all platforms.
113113
cfg.build();
114+
115+
t!(File::create(&done_stamp));
114116
}
115117

116118
fn check_llvm_version(build: &Build, llvm_config: &Path) {

0 commit comments

Comments
 (0)