feat: add rust.rustflags and per target rustflags options to bootstrap.toml

This makes easy to persistently pass any flag to the compiler when
building rustc.
For example you can use a different linker by putting the following in
`bootstrap.toml`:
```toml
[rust]
rustflags = ["-Clinker=clang", "-Clink-arg=--ld-path=wild"]
```
This commit is contained in:
Karol Zwolak 2025-11-10 13:16:24 +01:00
parent 2c0f4860cc
commit 6e63c39467
6 changed files with 42 additions and 0 deletions

View file

@ -708,6 +708,12 @@
# desired in distributions, for example.
#rust.rpath = true
# Additional flags to pass to `rustc`.
# Takes precedence over bootstrap's own flags but not over per target rustflags nor env. vars. like RUSTFLAGS.
# Applies to all stages and targets.
#
#rust.rustflags = []
# Indicates whether symbols should be stripped using `-Cstrip=symbols`.
#rust.strip = false
@ -1013,6 +1019,12 @@
# and will override the same option under [rust] section. It only works on Unix platforms
#rpath = rust.rpath (bool)
# Additional flags to pass to `rustc`.
# Takes precedence over bootstrap's own flags and `rust.rustflags` but not over env. vars. like RUSTFLAGS.
# Applies to all stages.
#
#rustflags = rust.rustflags
# Force static or dynamic linkage of the standard library for this target. If
# this target is a host for rustc, this will also affect the linkage of the
# compiler itself. This is useful for building rustc on targets that normally