Skip to content

Commit

Permalink
Rollup merge of #92516 - Kobzol:bootstrap-symbol-mangling, r=Mark-Sim…
Browse files Browse the repository at this point in the history
…ulacrum

Do not use deprecated -Zsymbol-mangling-version in bootstrap

`-Zsymbol-mangling-version` now produces warnings unconditionally. So if you want to use legacy mangling for the compiler (`new-symbol-mangling = false` in `config.toml`), the build is now littered with warnings.

However, with this change, stage 1 `std` doesn't compile:
```
error: `-C symbol-mangling-version=legacy` requires `-Z unstable-options`
```
Even after the bootstrap compiler is updated and it will support `-Csymbol-mangling-version`, the bootstrap code would either need to use `-Z` for the legacy mangling or use `-C` in combination with `-Z unstable-options` (because `-C` + legacy is not allowed without the unstable options). Should we just add `-Z unstable-options` to `std` compilation to resolve this?

Btw I use legacy mangling because the new mangling is not supported by [Hotspot](https://github.com/KDAB/hotspot).
  • Loading branch information
matthiaskrgr authored Jan 4, 2022
2 parents b9694a1 + e266cb9 commit e1a7743
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,10 +988,20 @@ impl<'a> Builder<'a> {
}
};

if use_new_symbol_mangling {
rustflags.arg("-Zsymbol-mangling-version=v0");
// cfg(bootstrap) -- drop the compiler.stage == 0 branch.
if compiler.stage == 0 {
if use_new_symbol_mangling {
rustflags.arg("-Zsymbol-mangling-version=v0");
} else {
rustflags.arg("-Zsymbol-mangling-version=legacy");
}
} else {
rustflags.arg("-Zsymbol-mangling-version=legacy");
if use_new_symbol_mangling {
rustflags.arg("-Csymbol-mangling-version=v0");
} else {
rustflags.arg("-Csymbol-mangling-version=legacy");
rustflags.arg("-Zunstable-options");
}
}

// FIXME: It might be better to use the same value for both `RUSTFLAGS` and `RUSTDOCFLAGS`,
Expand Down

0 comments on commit e1a7743

Please sign in to comment.