-
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
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors #100552
Conversation
r? @estebank (rust-highfive has picked a reviewer for you, use r? to override) |
|
This comment was marked as resolved.
This comment was marked as resolved.
50d993a
to
667eb18
Compare
ping @estebank |
r? rust-lang/compiler |
cc @lqd as well, maybe you have time to review this. |
I do have some time and will take it from esteban/jack r? @lqd |
@@ -1159,6 +1201,7 @@ pub struct TargetOptions { | |||
/// Default linker flavor used if `-C linker-flavor` or `-C linker` are not passed | |||
/// on the command line. Defaults to `LinkerFlavor::Gcc`. | |||
pub linker_flavor: LinkerFlavor, | |||
linker_flavor_json: LinkerFlavorCli, |
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.
I assume all the _json
fields are named with this suffix as they refer to the json target specs ? Maybe it would be nice if they were named _cli
to match the CLI type ?
The naming is not super important, especially as I believe these fields are going to be temporary and refactored away soon enough.
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.
Yes, these fields are what is parsed directly from json specs.
They use the same LinkerFlavorCli
structure as command line options for simplicity, but they are semantically json.
If I understand correctly, some of the end goal was described in this comment of yours, and this PR represents a "temporary" state of things:
If you have some specific tasks in mind, I would like to help you with the refactorings. In particular, this PR's manual translations between the 2 representations are going to be error-prone (subtly forgetting an Is the above roughly correct and what you had in mind ? If that's the case, then r=me: this improves things towards the goal, will unblock all the other work, and we'll clean everything up and avoid the footguns soon. I'm not familiar with the tier 3 target @rustbot author |
Yes, I'd like to have the list of options in the end of that comment to become user-visible and stable in the end.
petrochenkov@53eca42 is pretty much ready modulo some cleanup.
In theory, 2 "syncs" after This PR keeps these 2 syncs, but delays one of them until The alternative to extra It may not be obvious from this PR, but the problem is that json fields cannot be converted on the fly individually, they need to be combined (e.g.
At the end of #85967 it pretty much turned into |
@rustbot ready |
Yeah this is what I was imagining as well, having separate Ok I'm convinced, let's land this and we can keep iterating. @bors r+ |
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (rust-lang#96827). This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.) The second commit does some light refactoring of internal linker flavors (applies changes from petrochenkov@53eca42 that don't require mass-editing target specs).
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (rust-lang#96827). This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.) The second commit does some light refactoring of internal linker flavors (applies changes from petrochenkov@53eca42 that don't require mass-editing target specs).
rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors I want to do some refactorings in `rustc_target` - merge `lld_flavor` and `linker_is_gnu` into `linker_flavor`, support combination gcc+lld (rust-lang#96827). This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces - `-Clinker-flavor` values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.) The second commit does some light refactoring of internal linker flavors (applies changes from petrochenkov@53eca42 that don't require mass-editing target specs).
@bors r- this has conflicts with a recently merged PR |
This comment was marked as resolved.
This comment was marked as resolved.
…-facing linker flavors
Remove one unstable user-facing linker flavor (l4-bender)
667eb18
to
a0e21ff
Compare
@bors r=lqd |
…llaumeGomez Rollup of 9 pull requests Successful merges: - rust-lang#97739 (Uplift the `let_underscore` lints from clippy into rustc.) - rust-lang#99583 (Add additional methods to the Demand type) - rust-lang#100147 (optimization of access level table construction) - rust-lang#100552 (rustc_target: Add a compatibility layer to separate internal and user-facing linker flavors) - rust-lang#100827 (Simplify MIR opt tests) - rust-lang#101166 (Generate error index with mdbook instead of raw HTML pages) - rust-lang#101294 (Fix rust-lang#100844 rebase accident) - rust-lang#101298 (rustdoc: remove unused CSS `#main-content > .since`) - rust-lang#101304 (Add autolabels for `A-query-system`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
rustc_target: Refactor internal linker flavors In accordance with the design from rust-lang#96827 (comment) `lld_flavor` and `linker_is_gnu` fields are removed from internal target specs, but still parsed from JSON specs using compatibility layer introduced in rust-lang#100552. r? `@lqd`
I want to do some refactorings in
rustc_target
- mergelld_flavor
andlinker_is_gnu
intolinker_flavor
, support combination gcc+lld (#96827).This PR adds some compatibility infra that makes that possible without making any changes to user-facing interfaces -
-Clinker-flavor
values and json target specs. (For json target specs this infra may eventually go away since they are not very stable.)The second commit does some light refactoring of internal linker flavors (applies changes from petrochenkov@53eca42 that don't require mass-editing target specs).