Skip to content

Commit 999580c

Browse files
committed
Rename llvm_libzstd to llvm.libzstd, set it off by default except for config.dist.toml
1 parent 15d02df commit 999580c

File tree

5 files changed

+12
-26
lines changed

5 files changed

+12
-26
lines changed

config.example.toml

+3-8
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
# library provided by LLVM.
8888
#static-libstdcpp = false
8989

90+
# Enable LLVM to use zstd for compression.
91+
#libzstd = false
92+
9093
# Whether to use Ninja to build LLVM. This runs much faster than make.
9194
#ninja = true
9295

@@ -713,11 +716,6 @@
713716
# option will override this if set.
714717
#llvm-libunwind = 'no'
715718

716-
# Global default for llvm-libzstd for all targets. See the target-specific
717-
# documentation for llvm-libzstd below. Note that the target-specific
718-
# option will override this if set.
719-
#llvm-libzstd = false
720-
721719
# Enable Windows Control Flow Guard checks in the standard library.
722720
# This only applies from stage 1 onwards, and only for Windows targets.
723721
#control-flow-guard = false
@@ -821,9 +819,6 @@
821819
# it must link to `libgcc_eh.a` to get a working output, and this option have no effect.
822820
#llvm-libunwind = 'no' if Linux, 'in-tree' if Fuchsia
823821

824-
# Enable LLVM to use zstd for compression.
825-
#llvm-libzstd = if linux { true } else { false }
826-
827822
# Build the sanitizer runtimes for this target.
828823
# This option will override the same option under [build] section.
829824
#sanitizers = build.sanitizers (bool)

src/bootstrap/defaults/config.dist.toml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ extended = true
1111
# Most users installing from source want to build all parts of the project from source.
1212
[llvm]
1313
download-ci-llvm = false
14+
libzstd = if linux { true } else { false }
1415
[rust]
1516
# We have several defaults in bootstrap that depend on whether the channel is `dev` (e.g. `omit-git-hash` and `download-ci-llvm`).
1617
# Make sure they don't get set when installing from source.

src/bootstrap/src/core/build_steps/llvm.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ fn configure_llvm(builder: &Builder<'_>, target: TargetSelection, cfg: &mut cmak
822822
cfg.define("LLVM_ENABLE_ZLIB", "OFF");
823823
}
824824

825-
if builder.config.llvm_libzstd(target) {
825+
if builder.config.llvm_libzstd {
826826
cfg.define("LLVM_ENABLE_ZSTD", "FORCE_ON");
827827
cfg.define("LLVM_USE_STATIC_ZSTD", "TRUE");
828828
} else {

src/bootstrap/src/core/config/config.rs

+6-16
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ pub struct Config {
218218
pub llvm_thin_lto: bool,
219219
pub llvm_release_debuginfo: bool,
220220
pub llvm_static_stdcpp: bool,
221+
pub llvm_libzstd: bool,
221222
/// `None` if `llvm_from_ci` is true and we haven't yet downloaded llvm.
222223
#[cfg(not(test))]
223224
llvm_link_shared: Cell<Option<bool>>,
@@ -280,7 +281,6 @@ pub struct Config {
280281
pub llvm_profile_use: Option<String>,
281282
pub llvm_profile_generate: bool,
282283
pub llvm_libunwind_default: Option<LlvmLibunwind>,
283-
pub llvm_libzstd_default: Option<bool>,
284284
pub enable_bolt_settings: bool,
285285

286286
pub reproducible_artifacts: Vec<String>,
@@ -551,7 +551,6 @@ pub struct Target {
551551
/// Some(path to FileCheck) if one was specified.
552552
pub llvm_filecheck: Option<PathBuf>,
553553
pub llvm_libunwind: Option<LlvmLibunwind>,
554-
pub llvm_libzstd: Option<bool>,
555554
pub cc: Option<PathBuf>,
556555
pub cxx: Option<PathBuf>,
557556
pub ar: Option<PathBuf>,
@@ -880,6 +879,7 @@ define_config! {
880879
plugins: Option<bool> = "plugins",
881880
ccache: Option<StringOrBool> = "ccache",
882881
static_libstdcpp: Option<bool> = "static-libstdcpp",
882+
libzstd: Option<bool> = "libzstd",
883883
ninja: Option<bool> = "ninja",
884884
targets: Option<String> = "targets",
885885
experimental_targets: Option<String> = "experimental-targets",
@@ -1108,7 +1108,6 @@ define_config! {
11081108
jemalloc: Option<bool> = "jemalloc",
11091109
test_compare_mode: Option<bool> = "test-compare-mode",
11101110
llvm_libunwind: Option<String> = "llvm-libunwind",
1111-
llvm_libzstd: Option<bool> = "llvm-libzstd",
11121111
control_flow_guard: Option<bool> = "control-flow-guard",
11131112
ehcont_guard: Option<bool> = "ehcont-guard",
11141113
new_symbol_mangling: Option<bool> = "new-symbol-mangling",
@@ -1135,7 +1134,6 @@ define_config! {
11351134
llvm_has_rust_patches: Option<bool> = "llvm-has-rust-patches",
11361135
llvm_filecheck: Option<String> = "llvm-filecheck",
11371136
llvm_libunwind: Option<String> = "llvm-libunwind",
1138-
llvm_libzstd: Option<bool> = "llvm-libzstd",
11391137
sanitizers: Option<bool> = "sanitizers",
11401138
profiler: Option<StringOrBool> = "profiler",
11411139
rpath: Option<bool> = "rpath",
@@ -1157,6 +1155,7 @@ impl Config {
11571155
llvm_optimize: true,
11581156
ninja_in_file: true,
11591157
llvm_static_stdcpp: false,
1158+
llvm_libzstd: false,
11601159
backtrace: true,
11611160
rust_optimize: RustOptimize::Bool(true),
11621161
rust_optimize_tests: true,
@@ -1637,7 +1636,6 @@ impl Config {
16371636
jemalloc,
16381637
test_compare_mode,
16391638
llvm_libunwind,
1640-
llvm_libzstd,
16411639
control_flow_guard,
16421640
ehcont_guard,
16431641
new_symbol_mangling,
@@ -1724,7 +1722,6 @@ impl Config {
17241722
set(&mut config.ehcont_guard, ehcont_guard);
17251723
config.llvm_libunwind_default =
17261724
llvm_libunwind.map(|v| v.parse().expect("failed to parse rust.llvm-libunwind"));
1727-
config.llvm_libzstd_default = llvm_libzstd;
17281725

17291726
if let Some(ref backends) = codegen_backends {
17301727
let available_backends = ["llvm", "cranelift", "gcc"];
@@ -1793,6 +1790,7 @@ impl Config {
17931790
plugins,
17941791
ccache,
17951792
static_libstdcpp,
1793+
libzstd,
17961794
ninja,
17971795
targets,
17981796
experimental_targets,
@@ -1827,6 +1825,7 @@ impl Config {
18271825
set(&mut config.llvm_thin_lto, thin_lto);
18281826
set(&mut config.llvm_release_debuginfo, release_debuginfo);
18291827
set(&mut config.llvm_static_stdcpp, static_libstdcpp);
1828+
set(&mut config.llvm_libzstd, libzstd);
18301829
if let Some(v) = link_shared {
18311830
config.llvm_link_shared.set(Some(v));
18321831
}
@@ -1877,6 +1876,7 @@ impl Config {
18771876
check_ci_llvm!(optimize_toml);
18781877
check_ci_llvm!(thin_lto);
18791878
check_ci_llvm!(release_debuginfo);
1879+
//check_ci_llvm!(libzstd);
18801880
check_ci_llvm!(targets);
18811881
check_ci_llvm!(experimental_targets);
18821882
check_ci_llvm!(clang_cl);
@@ -1931,7 +1931,6 @@ impl Config {
19311931
panic!("failed to parse target.{triple}.llvm-libunwind")
19321932
})
19331933
});
1934-
target.llvm_libzstd = cfg.llvm_libzstd;
19351934
if let Some(s) = cfg.no_std {
19361935
target.no_std = s;
19371936
}
@@ -2418,14 +2417,6 @@ impl Config {
24182417
})
24192418
}
24202419

2421-
pub fn llvm_libzstd(&self, target: TargetSelection) -> bool {
2422-
self.target_config
2423-
.get(&target)
2424-
.and_then(|t| t.llvm_libzstd)
2425-
.or(self.llvm_libzstd_default)
2426-
.unwrap_or(target.contains("linux"))
2427-
}
2428-
24292420
pub fn split_debuginfo(&self, target: TargetSelection) -> SplitDebuginfo {
24302421
self.target_config
24312422
.get(&target)
@@ -2730,7 +2721,6 @@ fn check_incompatible_options_for_ci_rustc(rust: &Rust) -> Result<(), String> {
27302721
remap_debuginfo: _,
27312722
test_compare_mode: _,
27322723
llvm_libunwind: _,
2733-
llvm_libzstd: _,
27342724
control_flow_guard: _,
27352725
ehcont_guard: _,
27362726
new_symbol_mangling: _,

src/bootstrap/src/utils/change_tracker.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,6 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
223223
ChangeInfo {
224224
change_id: 125642,
225225
severity: ChangeSeverity::Info,
226-
summary: "New option `llvm-libzstd` to control whether llvm is built with zstd support.",
226+
summary: "New option `llvm.libzstd` to control whether llvm is built with zstd support.",
227227
},
228228
];

0 commit comments

Comments
 (0)