@@ -623,7 +623,7 @@ impl Config {
623
623
targets : llvm_targets,
624
624
experimental_targets : llvm_experimental_targets,
625
625
link_jobs : llvm_link_jobs,
626
- link_shared : llvm_link_shared_ ,
626
+ link_shared : llvm_link_shared ,
627
627
version_suffix : llvm_version_suffix,
628
628
clang_cl : llvm_clang_cl,
629
629
cflags : llvm_cflags,
@@ -682,7 +682,6 @@ impl Config {
682
682
683
683
let mut target_config = HashMap :: new ( ) ;
684
684
let mut download_rustc_commit = None ;
685
- let llvm_link_shared = Cell :: default ( ) ;
686
685
let mut llvm_from_ci = false ;
687
686
let mut channel = "dev" . to_string ( ) ;
688
687
let mut out = flags_build_dir
@@ -764,7 +763,7 @@ impl Config {
764
763
) ) ;
765
764
766
765
let initial_cargo = build_cargo. unwrap_or_else ( || {
767
- download_beta_toolchain ( & mut dwn_ctx) ;
766
+ download_beta_toolchain ( & dwn_ctx) ;
768
767
initial_sysroot. join ( "bin" ) . join ( exe ( "cargo" , host_target) )
769
768
} ) ;
770
769
@@ -848,11 +847,9 @@ impl Config {
848
847
"WARNING: `rust.download-rustc` is enabled. The `rust.channel` option will be overridden by the CI rustc's channel."
849
848
) ;
850
849
851
- let channel_ = read_file_by_commit ( & dwn_ctx, Path :: new ( "src/ci/channel" ) , commit)
850
+ channel = read_file_by_commit ( & dwn_ctx, Path :: new ( "src/ci/channel" ) , commit)
852
851
. trim ( )
853
852
. to_owned ( ) ;
854
-
855
- channel = channel_;
856
853
}
857
854
858
855
if let Some ( t) = toml. target {
@@ -917,6 +914,9 @@ impl Config {
917
914
dwn_ctx. target_config = target_config. clone ( ) ;
918
915
}
919
916
917
+ llvm_from_ci = parse_download_ci_llvm ( & dwn_ctx, llvm_download_ci_llvm, llvm_assertions) ;
918
+ dwn_ctx. llvm_from_ci = llvm_from_ci;
919
+
920
920
// We make `x86_64-unknown-linux-gnu` use the self-contained linker by default, so we will
921
921
// build our internal lld and use it as the default linker, by setting the `rust.lld` config
922
922
// to true by default:
@@ -939,13 +939,6 @@ impl Config {
939
939
rust_lld_enabled. unwrap_or ( false )
940
940
} ;
941
941
942
- if let Some ( v) = llvm_link_shared_ {
943
- llvm_link_shared. set ( Some ( v) ) ;
944
- }
945
-
946
- llvm_from_ci = parse_download_ci_llvm ( & dwn_ctx, llvm_download_ci_llvm, llvm_assertions) ;
947
- dwn_ctx. llvm_from_ci = llvm_from_ci;
948
-
949
942
if llvm_from_ci {
950
943
let warn = |option : & str | {
951
944
println ! (
@@ -960,7 +953,7 @@ impl Config {
960
953
warn ( "static-libstdcpp" ) ;
961
954
}
962
955
963
- if llvm_link_shared_ . is_some ( ) {
956
+ if llvm_link_shared . is_some ( ) {
964
957
warn ( "link-shared" ) ;
965
958
}
966
959
@@ -981,13 +974,6 @@ impl Config {
981
974
}
982
975
}
983
976
984
- if !llvm_from_ci && llvm_thin_lto. unwrap_or ( false ) && llvm_link_shared_. is_none ( ) {
985
- // If we're building with ThinLTO on, by default we want to link
986
- // to LLVM shared, to avoid re-doing ThinLTO (which happens in
987
- // the link step) with each stage.
988
- llvm_link_shared. set ( Some ( true ) ) ;
989
- }
990
-
991
977
if llvm_from_ci {
992
978
let triple = & host_target. triple ;
993
979
let ci_llvm_bin = ci_llvm_root ( & dwn_ctx) . join ( "bin" ) ;
@@ -1340,6 +1326,13 @@ impl Config {
1340
1326
patch_binaries_for_nix : build_patch_binaries_for_nix,
1341
1327
cmd : flags_cmd,
1342
1328
submodules : build_submodules,
1329
+ // If we're building with ThinLTO on, by default we want to link
1330
+ // to LLVM shared, to avoid re-doing ThinLTO (which happens in
1331
+ // the link step) with each stage.
1332
+ llvm_link_shared : Cell :: new (
1333
+ llvm_link_shared
1334
+ . or ( ( !llvm_from_ci && llvm_thin_lto. unwrap_or ( false ) ) . then_some ( true ) ) ,
1335
+ ) ,
1343
1336
exec_ctx,
1344
1337
out,
1345
1338
rust_info,
@@ -1361,7 +1354,6 @@ impl Config {
1361
1354
path_modification_cache,
1362
1355
stage0_metadata,
1363
1356
download_rustc_commit,
1364
- llvm_link_shared,
1365
1357
}
1366
1358
}
1367
1359
0 commit comments