Skip to content

Commit aec4b59

Browse files
committed
add the correct version of LLVM into the stage0 sysroot
In some cases(see #109314), when the stage0 compiler relies on more recent version of LLVM than the beta compiler, it may not be able to locate the correct LLVM in the sysroot. This situation typically occurs when we upgrade LLVM version while the beta compiler continues to use an older version. Signed-off-by: ozkanonur <[email protected]>
1 parent ec5b882 commit aec4b59

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/bootstrap/compile.rs

+10
Original file line numberDiff line numberDiff line change
@@ -1390,6 +1390,16 @@ impl Step for Sysroot {
13901390
let _ = fs::remove_dir_all(&sysroot);
13911391
t!(fs::create_dir_all(&sysroot));
13921392

1393+
// In some cases(see https://github.com/rust-lang/rust/issues/109314), when the stage0
1394+
// compiler relies on more recent version of LLVM than the beta compiler, it may not
1395+
// be able to locate the correct LLVM in the sysroot. This situation typically occurs
1396+
// when we upgrade LLVM version while the beta compiler continues to use an older version.
1397+
//
1398+
// Make sure to add the correct version of LLVM into the stage0 sysroot.
1399+
if compiler.stage == 0 {
1400+
dist::maybe_install_llvm_target(builder, compiler.host, &sysroot);
1401+
}
1402+
13931403
// If we're downloading a compiler from CI, we can use the same compiler for all stages other than 0.
13941404
if builder.download_rustc() && compiler.stage != 0 {
13951405
assert_eq!(

0 commit comments

Comments
 (0)