rust icon indicating copy to clipboard operation
rust copied to clipboard

[bootstrap] Move the `split-debuginfo` setting to the per-target section

Open TimNN opened this issue 4 months ago • 16 comments

As described in #112406, bootstrap currently applies the global split-debuginfo setting to all artifacts, irrespective of their target triple.

This doesn't cause problems when the "build" triple defaults split-debuginfo to off (as is the case on Linux, for example).

However, when the "build" triple has split-debuginfo enabled and additional target triples are configured, then artifacts for the additional triples will also be built with split-debuginfo (despite not necessarily supporting split-debuginfo).

#112406 mentions riscv32imc-unknown-none-elf as one target where this happens, and I've run into this with Wasm as well.

This PR does not implement @ehuss's suggestion that "bootstrap not try to guess how to configure split-debuginfo, and instead use cargo profiles to set it", because that seemed like a lot more significant change.


After this PR, anyone explicitly setting rust.split-debuginfo should update their configuration to specify the setting in the target.<triple> section, though rust.split-debuginfo will still be honored for the "build" triple for now.

This PR changes the behavior when rust.split-debuginfo was not explicitly set and bootstrap is configured to cross-compile to a triple that has a different split-debuginfo than the "build" triple.


If there's a reasonable way to add additional tests for this, please let me know (I didn't find any tests checking cargo arguments in builder/tests.rs).

TimNN avatar Feb 28 '24 17:02 TimNN

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum. They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

rustbot avatar Feb 28 '24 17:02 rustbot

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

This PR modifies config.example.toml.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

rustbot avatar Feb 28 '24 17:02 rustbot

@rustbot author

TimNN avatar Feb 28 '24 18:02 TimNN

@rustbot ready

TimNN avatar Feb 28 '24 19:02 TimNN

:umbrella: The latest upstream changes (presumably #122113) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Mar 07 '24 05:03 bors

@ehuss can you say more about Cargo's automatic detection?

I would suggest that bootstrap not try to guess how to configure split-debuginfo, and instead use cargo profiles to set it. Cargo already dynamically detects if split-debuginfo is supported on the platform.

In particular it looks like we set -Zunstable-options in some cases if we don't think it's already stable, my assumption is that Cargo wouldn't do that, right? So until this is stable everywhere we would still need this custom support.

r=me on the changes here in general though

Mark-Simulacrum avatar Mar 09 '24 14:03 Mark-Simulacrum

Cargo uses rustc --print=split-debuginfo to determine what options are supported.

Indeed, it looks like --print=split-debuginfo does not take -Zunstable-options into consideration in its output.

ehuss avatar Mar 09 '24 15:03 ehuss

Rebased. @rustbot ready

TimNN avatar Mar 09 '24 17:03 TimNN

@bors r+

Mark-Simulacrum avatar Mar 09 '24 17:03 Mark-Simulacrum

:pushpin: Commit 93a807f87127b18a69ba2572269efb282741ceac has been approved by Mark-Simulacrum

It is now in the queue for this repository.

bors avatar Mar 09 '24 17:03 bors

:umbrella: The latest upstream changes (presumably #122331) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Mar 11 '24 12:03 bors

Rebased. @rustbot ready

TimNN avatar Mar 11 '24 12:03 TimNN

:umbrella: The latest upstream changes (presumably #122338) made this pull request unmergeable. Please resolve the merge conflicts.

bors avatar Mar 11 '24 19:03 bors

Rebased again.

TimNN avatar Mar 11 '24 19:03 TimNN

@bors r=Mark-Simulacrum,onur-ozkan

onur-ozkan avatar Mar 11 '24 20:03 onur-ozkan

:pushpin: Commit 0e354c98a82df53df04e49c5d0f7107c03482d42 has been approved by Mark-Simulacrum,onur-ozkan

It is now in the queue for this repository.

bors avatar Mar 11 '24 20:03 bors