-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support enable/disable sanitizers/profiler per target #78354
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
src/bootstrap/lib.rs
Outdated
@@ -543,7 +543,7 @@ impl Build { | |||
if self.config.backtrace { | |||
features.push_str(" backtrace"); | |||
} | |||
if self.config.profiler { | |||
if self.config.sanitizers_enabled(target) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is presumably meant to be profiler_enabled?
Please also squash commits. I'll want to do another read through I think, but I suspect this is good to go modulo the nit. |
10baa67
to
b989d46
Compare
ping from triage: |
Yes |
@bors r=Mark-Simulacrum |
📌 Commit b989d46 has been approved by |
🌲 The tree is currently closed for pull requests below priority 100, this pull request will be tested once the tree is reopened |
…as-schievink Rollup of 11 pull requests Successful merges: - rust-lang#78216 (Duration::zero() -> Duration::ZERO) - rust-lang#78354 (Support enable/disable sanitizers/profiler per target) - rust-lang#78417 (BTreeMap: split off most code of append) - rust-lang#78832 (look at assoc ct, check the type of nodes) - rust-lang#78873 (Add flags customizing behaviour of MIR inlining) - rust-lang#78899 (Support inlining diverging function calls) - rust-lang#78923 (Cleanup and comment intra-doc link pass) - rust-lang#78929 (rustc_target: Move target env "gnu" from `linux_base` to `linux_gnu_base`) - rust-lang#78930 (rustc_taret: Remove `TargetOptions::is_like_android`) - rust-lang#78942 (Fix typo in comment) - rust-lang#78947 (Ship llvm-cov through llvm-tools) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
PR #78354 broke the build for users of The PR copies the (commented out) Intuitively (especially because the Since I always build with I think the new target-specific settings, if not set, need to default to the non-specific setting. Workaround: I had to add a target-specific setting on each platform I test with (Linux, Windows, and MacOS). On Mac, for example, I added these two lines in my config.toml:
It's still building, but it looks like it finally started building the |
Yep, I agree that is the expected behavior. Would be happy to accept a PR fixing this, or if you can file an issue (just copying content in your note here) I can write a patch some time this week. |
I'll file an issue. I don't have time to work on it this week unfortunately. Thanks Mark! |
…k-Simulacrum fix handling the default config for profiler and sanitizers rust-lang#78354 don't handle the case that user don't add any target-specific config in `[target.*]` of `config.toml`: ```toml changelog-seen = 2 [llvm] link-shared = true [build] sanitizers = true profiler = true [install] [rust] [dist] ``` The previes code handle the default config in `Config::prase()`: ```rust target.sanitizers = cfg.sanitizers.unwrap_or(build.sanitizers.unwrap_or_default()); target.profiler = cfg.profiler.unwrap_or(build.profiler.unwrap_or_default()); config.target_config.insert(TargetSelection::from_user(&triple), target); ``` In this case, `toml.target` don't contain any target, so the above code won't execute. Instead, a default `Target` is insert in https://github.com/rust-lang/rust/blob/c919f490bbcd2b29b74016101f7ec71aaa24bdbb/src/bootstrap/sanity.rs#L162-L166 The default value for `bool` is false, hence the issue in rust-lang#79124 This fix change the type of `sanitizers` and `profiler` to `Option<bool>`, so the default value is `None`, and fallback config is handled in `Config::sanitizers_enabled` and `Config::profiler_enabled` fix rust-lang#79124 cc `@Mark-Simulacrum` `@richkadel`
This PR add options under
[target.*]
ofconfig.toml
which can enable or disable sanitizers/profiler runtime for corresponding target.If these options are empty, the global options under
[build]
will take effect.Fix #78329