mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
d6156e8fe5
This commit intends to fix an accidental regression from #70846. The goal of #70846 was to build compiler-builtins with a maximal number of CGUs to ensure that each module in the source corresponds to an object file. This high degree of control for compiler-builtins is desirable to ensure that there's at most one exported symbol per CGU, ideally enabling compiler-builtins to not conflict with the system libgcc as often. In #70846, however, only part of the compiler understands that compiler-builtins is built with many CGUs. The rest of the compiler thinks it's building with `sess.codegen_units()`. Notably the calculation of `sess.lto()` consults `sess.codegen_units()`, which when there's only one CGU it disables ThinLTO. This means that compiler-builtins is built without ThinLTO, which is quite harmful to performance! This is the root of the cause from #73135 where intrinsics were found to not be inlining trivial functions. The fix applied in this commit is to remove the special-casing of compiler-builtins in the compiler. Instead the build system is now responsible for special-casing compiler-builtins. It doesn't know exactly how many CGUs will be needed but it passes a large number that is assumed to be much greater than the number of source-level modules needed. After reading the various locations in the compiler source, this seemed like the best solution rather than adding more and more special casing in the compiler for compiler-builtins. Closes #73135
84 lines
2.9 KiB
TOML
84 lines
2.9 KiB
TOML
[workspace]
|
|
members = [
|
|
"src/bootstrap",
|
|
"src/rustc",
|
|
"src/libstd",
|
|
"src/libtest",
|
|
"src/librustc_codegen_llvm",
|
|
"src/tools/cargotest",
|
|
"src/tools/clippy",
|
|
"src/tools/compiletest",
|
|
"src/tools/error_index_generator",
|
|
"src/tools/linkchecker",
|
|
"src/tools/rustbook",
|
|
"src/tools/unstable-book-gen",
|
|
"src/tools/tidy",
|
|
"src/tools/build-manifest",
|
|
"src/tools/remote-test-client",
|
|
"src/tools/remote-test-server",
|
|
"src/tools/rust-installer",
|
|
"src/tools/cargo",
|
|
"src/tools/rustdoc",
|
|
"src/tools/rls",
|
|
"src/tools/rustfmt",
|
|
"src/tools/miri",
|
|
"src/tools/miri/cargo-miri",
|
|
"src/tools/rustdoc-themes",
|
|
"src/tools/unicode-table-generator",
|
|
"src/tools/expand-yaml-anchors",
|
|
]
|
|
exclude = [
|
|
"build",
|
|
# HACK(eddyb) This hardcodes the fact that our CI uses `/checkout/obj`.
|
|
"obj",
|
|
]
|
|
|
|
# These options are controlled from our rustc wrapper script, so turn them off
|
|
# here and have them controlled elsewhere.
|
|
[profile.dev]
|
|
debug = false
|
|
debug-assertions = false
|
|
[profile.test]
|
|
debug = false
|
|
debug-assertions = false
|
|
|
|
[profile.release.package.compiler_builtins]
|
|
# For compiler-builtins we always use a high number of codegen units.
|
|
# The goal here is to place every single intrinsic into its own object
|
|
# file to avoid symbol clashes with the system libgcc if possible. Note
|
|
# that this number doesn't actually produce this many object files, we
|
|
# just don't create more than this number of object files.
|
|
#
|
|
# It's a bit of a bummer that we have to pass this here, unfortunately.
|
|
# Ideally this would be specified through an env var to Cargo so Cargo
|
|
# knows how many CGUs are for this specific crate, but for now
|
|
# per-crate configuration isn't specifiable in the environment.
|
|
codegen-units = 10000
|
|
|
|
# We want the RLS to use the version of Cargo that we've got vendored in this
|
|
# repository to ensure that the same exact version of Cargo is used by both the
|
|
# RLS and the Cargo binary itself. The RLS depends on Cargo as a git repository
|
|
# so we use a `[patch]` here to override the github repository with our local
|
|
# vendored copy.
|
|
[patch."https://github.com/rust-lang/cargo"]
|
|
cargo = { path = "src/tools/cargo" }
|
|
|
|
[patch.crates-io]
|
|
# Similar to Cargo above we want the RLS to use a vendored version of `rustfmt`
|
|
# that we're shipping as well (to ensure that the rustfmt in RLS and the
|
|
# `rustfmt` executable are the same exact version).
|
|
rustfmt-nightly = { path = "src/tools/rustfmt" }
|
|
|
|
# See comments in `src/tools/rustc-workspace-hack/README.md` for what's going on
|
|
# here
|
|
rustc-workspace-hack = { path = 'src/tools/rustc-workspace-hack' }
|
|
|
|
# See comments in `tools/rustc-std-workspace-core/README.md` for what's going on
|
|
# here
|
|
rustc-std-workspace-core = { path = 'src/tools/rustc-std-workspace-core' }
|
|
rustc-std-workspace-alloc = { path = 'src/tools/rustc-std-workspace-alloc' }
|
|
rustc-std-workspace-std = { path = 'src/tools/rustc-std-workspace-std' }
|
|
|
|
[patch."https://github.com/rust-lang/rust-clippy"]
|
|
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
|