Fix Hexagon ABI calling convention for small aggregates#151572
Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom Mar 12, 2026
Merged
Fix Hexagon ABI calling convention for small aggregates#151572rust-bors[bot] merged 2 commits intorust-lang:mainfrom
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
Conversation
Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches. The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair. This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.
Collaborator
Member
|
r? compiler |
Correct the handling of aggregate types in extern "C" functions to match the Hexagon ABI specification: - Aggregates up to 32 bits: passed/returned in a single register (R0) - Aggregates 33-64 bits: passed/returned in a register pair (R1:R0) - Aggregates > 64 bits: passed on stack via byval, returned via sret This fixes all tests/ui/abi/extern/ tests for Hexagon, including: - extern-pass-TwoU8s, extern-pass-TwoU16s, extern-pass-TwoU32s - extern-pass-TwoU64s, extern-pass-FiveU16s - extern-return-TwoU8s, extern-return-TwoU16s, extern-return-TwoU32s - extern-return-TwoU64s, extern-return-FiveU16s
Member
|
@rustbot reroll |
Contributor
Author
|
ping @SparrowLii |
Contributor
Author
|
Can I do a @rustbot reroll ... ? |
Contributor
Author
|
ping @jackh726 |
Contributor
|
r? me |
wesleywiser
approved these changes
Mar 12, 2026
Member
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Mar 12, 2026
…ywiser Fix Hexagon ABI calling convention for small aggregates Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches. The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair. This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 12, 2026
…uwer Rollup of 5 pull requests Successful merges: - #153751 (Detect existing turbofish on method calls to suppress useless suggestion) - #153780 (Remove `MTLock`) - #151194 (Fix wrong suggestion for returning async closure) - #151572 (Fix Hexagon ABI calling convention for small aggregates) - #153725 (Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability)
rust-bors bot
pushed a commit
that referenced
this pull request
Mar 12, 2026
…uwer Rollup of 5 pull requests Successful merges: - #153705 (Always generate generics in delegation that match trait in trait impl scenario) - #153751 (Detect existing turbofish on method calls to suppress useless suggestion) - #153780 (Remove `MTLock`) - #151572 (Fix Hexagon ABI calling convention for small aggregates) - #153725 (Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability)
github-actions bot
pushed a commit
to rust-lang/rustc-dev-guide
that referenced
this pull request
Mar 16, 2026
…uwer Rollup of 5 pull requests Successful merges: - rust-lang/rust#153705 (Always generate generics in delegation that match trait in trait impl scenario) - rust-lang/rust#153751 (Detect existing turbofish on method calls to suppress useless suggestion) - rust-lang/rust#153780 (Remove `MTLock`) - rust-lang/rust#151572 (Fix Hexagon ABI calling convention for small aggregates) - rust-lang/rust#153725 (Fix that `./x test --no-doc` actually keeps the same behaviour for backwards compatability)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small structs (<= 64 bits) were being passed with their fields split into separate arguments instead of being packed into register-sized chunks. This caused ABI mismatches.
The fix properly casts small aggregates to consecutive register-sized chunks using Uniform::consecutive(), matching the Hexagon C ABI where small structs are packed into R1:0 register pair.
This fixes tests like extern-pass-TwoU16s.rs and extern-pass-TwoU8s.rs.