Skip to content
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

[SOL] Update SBF call ABI #91

Merged
merged 1 commit into from
Mar 13, 2024
Merged

Conversation

LucasSte
Copy link
Collaborator

@LucasSte LucasSte commented Mar 12, 2024

Problem

Since commit c981026, the Rust compiler does not allow targets to leak aggregate types to an external ABI. As a consequence, compiling a function extern fn foo(arg: [u8; 16]) for Solana would hit the assertion:

assert!(
matches!(&*cx.tcx.sess.target.arch, "wasm32" | "wasm64")
|| self.conv == Conv::PtxKernel,
"`PassMode::Direct` for aggregates only allowed on wasm and `extern \"ptx-kernel\"` fns\nProblematic type: {:#?}",
arg.layout,
);

Solution

I updated the SBF's ABI convention to use 64-bit registers when possible and pass arguments/returns indirectly if they are Rust aggregates.

@LucasSte LucasSte requested a review from dmakarov March 12, 2024 21:25
@LucasSte LucasSte marked this pull request as ready for review March 12, 2024 21:25
@LucasSte LucasSte merged commit 696ef74 into anza-xyz:solana-1.75.0 Mar 13, 2024
13 checks passed
@LucasSte LucasSte deleted the bug-fix branch March 13, 2024 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants