`rustc` (like Cargo) may take advantage of the jobserver at any time (e.g. for backend parallelism, or eventually frontend too). In the kernel, we call `rustc` with `-Ccodegen-units=1` (and `-Zthreads` is 1 so far), so we do not expect parallelism. However, in the upcoming Rust 1.76.0, a warning is emitted by `rustc` [1] when it cannot connect to the jobserver it was passed (in many cases, but not all: compiling and `--print sysroot` do, but `--version` does not). And given GNU Make always passes the jobserver in the environment variable (even when a line is deemed non-recursive), `rustc` will end up complaining about it (in particular in Make 4.3 where there is only the simple pipe jobserver style). One solution is to remove the jobserver from `MAKEFLAGS`. However, we can mark the lines with calls to `rustc` (and Cargo) as recursive, which looks simpler. This is being documented as a recommendation in `rustc` [2] and allows us to be ready for the time we may use parallelism inside `rustc` (potentially now, if a user passes `-Zthreads`). Thus do so. Similarly, do the same for `rustdoc` and `cargo` calls. Finally, there is one case that the solution does not cover, which is the `$(shell ...)` call we have. Thus, for that one, set an empty `MAKEFLAGS` environment variable.
Showing the changes to scripts (2 of 4 files). Show all
Unified · Split
| @@ -290,7 +290,7 @@ quiet_cmd_rustc_o_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ · 289 unmodified lines | ||
| 290 | 290 | cmd_rustc_o_rs = $(rust_common_cmd) --emit=obj=$@ $< |
| 291 | 291 | |
| 292 | 292 | $(obj)/%.o: $(src)/%.rs FORCE |
| 293 | − $(call if_changed_dep,rustc_o_rs) | |
| 293 | + +$(call if_changed_dep,rustc_o_rs) | |
| 294 | 294 | |
| 295 | 295 | quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ |
| 296 | 296 | cmd_rustc_rsi_rs = \ |
| @@ -298,19 +298,19 @@ quiet_cmd_rustc_rsi_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ · 1 unmodified line | ||
| 298 | 298 | command -v $(RUSTFMT) >/dev/null && $(RUSTFMT) $@ |
| 299 | 299 | |
| 300 | 300 | $(obj)/%.rsi: $(src)/%.rs FORCE |
| 301 | − $(call if_changed_dep,rustc_rsi_rs) | |
| 301 | + +$(call if_changed_dep,rustc_rsi_rs) | |
| 302 | 302 | |
| 303 | 303 | quiet_cmd_rustc_s_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ |
| 304 | 304 | cmd_rustc_s_rs = $(rust_common_cmd) --emit=asm=$@ $< |
| 305 | 305 | |
| 306 | 306 | $(obj)/%.s: $(src)/%.rs FORCE |
| 307 | − $(call if_changed_dep,rustc_s_rs) | |
| 307 | + +$(call if_changed_dep,rustc_s_rs) | |
| 308 | 308 | |
| 309 | 309 | quiet_cmd_rustc_ll_rs = $(RUSTC_OR_CLIPPY_QUIET) $(quiet_modtag) $@ |
| 310 | 310 | cmd_rustc_ll_rs = $(rust_common_cmd) --emit=llvm-ir=$@ $< |
| 311 | 311 | |
| 312 | 312 | $(obj)/%.ll: $(src)/%.rs FORCE |
| 313 | − $(call if_changed_dep,rustc_ll_rs) | |
| 313 | + +$(call if_changed_dep,rustc_ll_rs) | |
| 314 | 314 | |
| 315 | 315 | # Compile assembler sources (.S) |
| 316 | 316 | # --------------------------------------------------------------------------- |
| @@ -156,7 +156,7 @@ quiet_cmd_host-rust = HOSTRUSTC $@ · 155 unmodified lines | ||
| 156 | 156 | cmd_host-rust = \ |
| 157 | 157 | $(HOSTRUSTC) $(hostrust_flags) --emit=link=$@ $< |
| 158 | 158 | $(host-rust): $(obj)/%: $(src)/%.rs FORCE |
| 159 | − $(call if_changed_dep,host-rust) | |
| 159 | + +$(call if_changed_dep,host-rust) | |
| 160 | 160 | |
| 161 | 161 | targets += $(host-csingle) $(host-cmulti) $(host-cobjs) \ |
| 162 | 162 | $(host-cxxmulti) $(host-cxxobjs) $(host-rust) |