Skip to content

bootstrap should rebuild LLVM when it changes #111893

Closed
@jyn514

Description

@jyn514

I tried this code:

; ./configure --set llvm.download-ci-llvm=false
; x build --stage 0 rustc_llvm
; (cd src/llvm_project && git apply)
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index dd86144d16..43395b1ecd 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -153,6 +153,8 @@ static void dumpStringOffsetsSection(raw_ostream &OS, DIDumpOptions DumpOpts,
                                      StringRef StringSection,
                                      DWARFContext::unit_iterator_range Units,
                                      bool LittleEndian) {
+  OS << "debug: dumpStringOffsetsSection" << "\n";
+
   auto Contributions = collectContributionData(Units);
   DWARFDataExtractor StrOffsetExt(Obj, StringOffsetsSection, LittleEndian, 0);
   DataExtractor StrData(StringSection, LittleEndian, 0);
; x build --stage 0 rustc_llvm

I expected to see this happen: bootstrap rebuilds LLVM, since it's changed.

Instead, this happened: bootstrap does nothing.

The problem is that we 're using a stamp file and assume that if the commit hasn't changed then none of the files have changed either:

rust/src/bootstrap/llvm.rs

Lines 108 to 123 in 95e8b6a

let stamp = out_dir.join("llvm-finished-building");
let stamp = HashStamp::new(stamp, builder.in_tree_llvm_info.sha());
if stamp.is_done() {
if stamp.hash.is_none() {
builder.info(
"Could not determine the LLVM submodule commit hash. \
Assuming that an LLVM rebuild is not necessary.",
);
builder.info(&format!(
"To force LLVM to rebuild, remove the file `{}`",
stamp.path.display()
));
}
return Ok(res);
}

I am not sure why we do that? Are we assuming that CMake rebuilds too frequently? That seems like something we should fix upstream ...

cc @rust-lang/wg-llvm, I think this would make your lives easier.

Meta

HEAD is branched from ba6f5e3.

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions