diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-07-20 07:13:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-20 07:13:43 +0200 |
| commit | 4f20ee51e164a133b864100a3ea71b1328892671 (patch) | |
| tree | b177f4efbc14c4c3f29f05733d34d2f99db2db6c | |
| parent | aa6ae4beca9a74e02d4c89e36b3131d71a65b59c (diff) | |
| parent | f0a2b5b0d92a23cacb0acbae9ede9282b65c5dc1 (diff) | |
| download | rust-4f20ee51e164a133b864100a3ea71b1328892671.tar.gz rust-4f20ee51e164a133b864100a3ea71b1328892671.zip | |
Rollup merge of #127866 - alexcrichton:disable-wasm-component-ld-by-default, r=onur-ozkan
Conditionally build `wasm-component-ld` This commit updates the support for the `wasm-component-ld` tool from #126967 to conditionally build rather than unconditionally building it when LLD is enabled. This support is disabled by default and can be enabled by one of two means: * the `extended` field in `config.toml` which dist builders use to build a complete set of tools for each host platform. * a `"wasm-component-ld"` entry in the `tools` section of `config.toml`. Neither of these are enabled by default meaning that most local builds will likely not have this new tool built. Dist builders should still, however, build the tool.
| -rw-r--r-- | config.example.toml | 1 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/src/lib.rs | 13 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/change_tracker.rs | 5 |
4 files changed, 26 insertions, 5 deletions
diff --git a/config.example.toml b/config.example.toml index a2c2fa1c2bd..26687bcfb37 100644 --- a/config.example.toml +++ b/config.example.toml @@ -333,6 +333,7 @@ # "rust-analyzer-proc-macro-srv", # "analysis", # "src", +# "wasm-component-ld", #] # Verbosity level: 0 == not verbose, 1 == verbose, 2 == very verbose, 3 == print environment variables on each rustc invocation diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index d4dd3e546ec..c3ce66d5e3a 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1820,12 +1820,14 @@ impl Step for Assemble { &self_contained_lld_dir.join(exe(name, target_compiler.host)), ); } + } - // In addition to `rust-lld` also install `wasm-component-ld` when - // LLD is enabled. This is a relatively small binary that primarily - // delegates to the `rust-lld` binary for linking and then runs - // logic to create the final binary. This is used by the - // `wasm32-wasip2` target of Rust. + // In addition to `rust-lld` also install `wasm-component-ld` when + // LLD is enabled. This is a relatively small binary that primarily + // delegates to the `rust-lld` binary for linking and then runs + // logic to create the final binary. This is used by the + // `wasm32-wasip2` target of Rust. + if builder.build_wasm_component_ld() { let wasm_component_ld_exe = builder.ensure(crate::core::build_steps::tool::WasmComponentLd { compiler: build_compiler, diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs index a77c20067e6..d2910f8edc6 100644 --- a/src/bootstrap/src/lib.rs +++ b/src/bootstrap/src/lib.rs @@ -1414,6 +1414,19 @@ Executed at: {executed_at}"#, None } + /// Returns whether it's requested that `wasm-component-ld` is built as part + /// of the sysroot. This is done either with the `extended` key in + /// `config.toml` or with the `tools` set. + fn build_wasm_component_ld(&self) -> bool { + if self.config.extended { + return true; + } + match &self.config.tools { + Some(set) => set.contains("wasm-component-ld"), + None => false, + } + } + /// Returns the root of the "rootfs" image that this target will be using, /// if one was configured. /// diff --git a/src/bootstrap/src/utils/change_tracker.rs b/src/bootstrap/src/utils/change_tracker.rs index 6a7c5c0f9b7..083418ed066 100644 --- a/src/bootstrap/src/utils/change_tracker.rs +++ b/src/bootstrap/src/utils/change_tracker.rs @@ -205,4 +205,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[ severity: ChangeSeverity::Warning, summary: "`debug-logging` option has been removed from the default `tools` profile.", }, + ChangeInfo { + change_id: 127866, + severity: ChangeSeverity::Info, + summary: "the `wasm-component-ld` tool is now built as part of `build.extended` and can be a member of `build.tools`", + }, ]; |
