Skip to content

add target feature ABI checks for SPARC - #160562

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:sparc
Open

add target feature ABI checks for SPARC#160562
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:sparc

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 5, 2026

Copy link
Copy Markdown
Member

@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 5, 2026
@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

r? @fee1-dead

rustbot has assigned @fee1-dead.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@RalfJung

RalfJung commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

Ah, the sparc-unknown-linux-gnu target enables v8plus... that's a bit surprising given that I was told that the ABI isn't actually implemented in LLVM yet?
This is also a tier 3 target without a listed target maintainer, so I feel inclined to just remove the target feature from the target spec.

Comment thread compiler/rustc_target/src/target_features.rs Outdated
Comment thread compiler/rustc_target/src/target_features.rs
VecDefault = "vec-default",
VecExtAbi = "vec-extabi",
X32 = "x32",
V8Plus = "v8plus",

@RalfJung RalfJung Aug 5, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need any kind of process for a new cfg value here?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-log-analyzer

This comment has been minimized.

@fee1-dead

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned chenyukang and unassigned fee1-dead Aug 9, 2026
@chenyukang

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned hanna-kruppe and unassigned chenyukang Aug 10, 2026
@hanna-kruppe

Copy link
Copy Markdown
Contributor

I don't really know anything about SPARC nor have I touched the compiler machinery for these checks yet. Maybe one of the people pinged earlier wants to take this? If not, I guess that's my chance to learn some more funny cursed trivia, but it'll take a while.

@RalfJung RalfJung added the S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. label Aug 16, 2026
@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

These commits modify compiler targets.
(See the Target Tier Policy.)

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung

RalfJung commented Aug 26, 2026

Copy link
Copy Markdown
Member Author

@hanna-kruppe MCP finished, now only the review is left.

Or maybe one of the folks reading along could do that (@workingjubilee @tgross35 ?)

One point that was not fully resolved in the MCP is "v8plus" vs "v8+" for the cfg(target_abi) value. I don't really care either way, it seems hardly anyone else cares either. The only person that expressed a preference was @tgross35 who preferred "v8+". Do the target maintainers have an opinion?

@jonathanpallant

Copy link
Copy Markdown
Contributor

AFAIK this only applies to sparc-unknown-linux-gnu right? There is no target maintainer, nor platform docs page. So I think you can do whatever you like.

@RalfJung

Copy link
Copy Markdown
Member Author

Oh, right.

@RalfJung

Copy link
Copy Markdown
Member Author

We're going with "v8plus": #t-compiler/major changes > Expose `target_abi = "v8plus"` on sparc-… compiler-team#1028 @ 💬.

This PR is ready then :)

@RalfJung

Copy link
Copy Markdown
Member Author

r? @tgross35

@rustbot rustbot assigned tgross35 and unassigned hanna-kruppe Aug 27, 2026
@rustbot

rustbot commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

tgross35 is currently at their maximum review capacity.
They may take a while to respond.

Comment on lines +1466 to +1480
match self.rustc_abi {
None => FeatureConstraints {
required: &[],
incompatible: &["soft-float", "v8plus"],
},
Some(RustcAbi::SparcV8Plus) => {
FeatureConstraints { required: &["v8plus"], incompatible: &["soft-float"] }
}
_ => unreachable!(),
}
}
Arch::Sparc64 => {
// We currently don't have a soft-float target for SPARC64.
// v8plus is for 32bit SPARC only.
FeatureConstraints { required: &[], incompatible: &["soft-float", "v8plus"] }

@tgross35 tgross35 Aug 27, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the incompatible list make these target modifiers and prevent linking? I'm not sure whether that is something we should be testing.

View changes since the review

@RalfJung RalfJung Aug 27, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This system predates target modifiers so it is currently unrelated (though I am trying to marry them in #160593).

What this does is emit a warning whenever these target features are enabled via -Ctarget-feature or even implicitly via -Ctarget-cpu (with a note that this warning will become a hard error eventually). It also causes a hard error when they are enabled via #[target_feature].

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, LGTM!

@bors r+

View changes since this review

@rust-bors

rust-bors Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

📌 Commit e7cadc3 has been approved by tgross35

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 27, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #158609 (Update sccache to 0.16.0)
 - #150075 (Implement clamp_to)
 - #159103 (fix(reborrow): recursive implementation)
 - #160562 (add target feature ABI checks for SPARC)
 - #160848 (std: avoid aliasing violations when wrapping opaque C types)
 - #161421 (Include startup crt objects on WASI for more outputs)
 - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order)
 - #161862 (Put data segment in specified section with link_section on wasm)
 - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations)
 - #161456 (reduce perf impact of scalar size checks)
 - #161528 (Add regression test to ensure optimal compilation)
 - #161666 (Print vendor instructions in `x vendor`)
 - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers)
 - #161828 (Never type after-stabilization cleanup)
 - #161859 (Do not optimize MIR for comptime ConstFns)
 - #161860 (atomicptr.rs test: remove unused import)
 - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods)
 - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`)
 - #161889 (Add link to ownership section in ptr::read docs)
 - #161890 (rustdoc: some clarifying comments)
 - #161891 (Mark `extern_item_impls` feature as incomplete)

Failed merges:

 - #161702 (Use `drop_guard` in some places in {core,alloc,std})
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 28, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
…uwer

Rollup of 21 pull requests

Successful merges:

 - #150075 (Implement clamp_to)
 - #159103 (fix(reborrow): recursive implementation)
 - #160562 (add target feature ABI checks for SPARC)
 - #160848 (std: avoid aliasing violations when wrapping opaque C types)
 - #161421 (Include startup crt objects on WASI for more outputs)
 - #161805 (Prefer ambiguous candidates when deduplicating traits in scope, so `ambiguous_glob_imported_traits` doesn't depend on import order)
 - #161862 (Put data segment in specified section with link_section on wasm)
 - #161866 (delegation: add tests fixating behavior of delegating to default trait implementations)
 - #157218 (Track items behind `cfg_select` in the same way we do for `cfg`)
 - #161456 (reduce perf impact of scalar size checks)
 - #161528 (Add regression test to ensure optimal compilation)
 - #161666 (Print vendor instructions in `x vendor`)
 - #161730 (Improve type mismatch annotation for lets with block-wrapped initializers)
 - #161828 (Never type after-stabilization cleanup)
 - #161859 (Do not optimize MIR for comptime ConstFns)
 - #161860 (atomicptr.rs test: remove unused import)
 - #161870 (bind to [::1] instead of 127.0.0.1 in documentation examples for v6 UDP methods)
 - #161876 (rustdoc: Correctly handle when a macro generates multiple items in `--generate-macro-expansion`)
 - #161889 (Add link to ownership section in ptr::read docs)
 - #161890 (rustdoc: some clarifying comments)
 - #161891 (Mark `extern_item_impls` feature as incomplete)

Failed merges:

 - #161702 (Use `drop_guard` in some places in {core,alloc,std})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing target feature ABI checks for Sparc64

10 participants