Skip to content

make target feature ABI check a hard error on ARM - #161280

Open
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:abi-required-target-feature-arm
Open

make target feature ABI check a hard error on ARM#161280
RalfJung wants to merge 1 commit into
rust-lang:mainfrom
RalfJung:abi-required-target-feature-arm

Conversation

@RalfJung

@RalfJung RalfJung commented Aug 18, 2026

Copy link
Copy Markdown
Member

With LLVM 24, we now (finally) get hard errors from the backend for "you want ABI X but the target features required for that ABI are missing", at least on the ARM backend:

error: <unknown>:0:0: in function _RNvXsc_Cs4Af2OiBEA1T_8minicoreiNtB5_3Add3add i32 (i32, i32): calling convention is hard-float, but floating-point registers are unavailable

That's not a pretty error, so let's make rust emit a hard error before we even get there -- just on ARM for now, matching LLVM. We have emitted a future-compat error for this since Rust 1.86 (#136147, #134794). I'm not making it a hard error everywhere since for other targets we are still figuring out the exact things we have to check, and it's better to do that without risking new hard errors.

For ARM, the exact check we are doing is:

  • every target must set llvm_floatabi to either "soft" or "hard"
  • on softfloat targets, no check is needed
  • on hardfloat targets, the "fpregs" target feature is required and the the "soft-float" target feature is forbidden

Since this is a new hard error, this probably requires FCP. I am not sure for which team -- @rust-lang/lang is often involved for target feature things, but this is mostly about rejecting invalid -C flags which are handled by t-compiler (@davidtwco @BoxyUwU).

Fixes #161276
Tracking issue #116344
Cc @TimNN

@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 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
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 15 candidates

@RalfJung RalfJung added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Aug 18, 2026
@RalfJung
RalfJung force-pushed the abi-required-target-feature-arm branch 2 times, most recently from ac3223c to ae04514 Compare August 18, 2026 09:31
@RalfJung

Copy link
Copy Markdown
Member Author

Pinging maintainers of affected targets
@rustbot ping arm-maintainers

@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Error: This team (arm-maintainers) cannot be pinged via this command; it may need to be added to triagebot.toml on the default branch.

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@RalfJung

Copy link
Copy Markdown
Member Author

@rust-bors

This comment has been minimized.

@RalfJung
RalfJung force-pushed the abi-required-target-feature-arm branch from ae04514 to b684a89 Compare August 18, 2026 16:30
@rustbot

rustbot commented Aug 18, 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.

@Skgland

Skgland commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

on hardfloat targets, the "fpregs" target feature is required

On the llvm pr adding the error there is a comment llvm/llvm-project#111334 (comment) arguing against this general requirement.
Arguing this should only error if hard-float and soft-float ABI disagree on a function signature.

@RalfJung

Copy link
Copy Markdown
Member Author

We've been emitting the warning without regard for which function signatures are actually used, and so far nobody complained about those warnings AFAIK. Doing this for function signatures would require completely overhauling the check we do (and that would be hard to do without impacting compile times). Also, since the underlying ABI of many types is not guaranteed, checking the function signature would expose internal rustc implementation details in a way where changing such details (which we are explicitly permitted to do any time) could lead to compilation failures, so a proper check here would require developing an entire new set of guarantees around which types are definitely not using float registers for their ABI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LLVM 24 rejects target feature / ABI mismatch that Rust only warns about

4 participants