Skip to content

fix(riscv64): implement fixed-parameter and return-saving calling convention#13826

Open
gounthar wants to merge 1 commit into
oracle:masterfrom
gounthar:fix/riscv64-llvm-calling-convention
Open

fix(riscv64): implement fixed-parameter and return-saving calling convention#13826
gounthar wants to merge 1 commit into
oracle:masterfrom
gounthar:fix/riscv64-llvm-calling-convention

Conversation

@gounthar

Copy link
Copy Markdown

Summary

Master restored the LLVM backend with a riscv64 target, but SubstrateRISCV64RegisterConfig.getCallingConvention still throws "Fixed parameter assignments and return saving are not yet supported on this platform" for custom-ABI calls. The first foreign call during image generation (throwNewNullPointerException) trips it, so native-image cannot get past "Compiling methods" on riscv64.

This implements the fixed-parameter-assignment and return-saving path for riscv64, mirroring the existing AArch64 register config: the return-buffer placeholder parameter is parked in x28 (t3) where AArch64 uses r8, and custom-ABI parameters are assigned to their fixed register/stack locations. The standard-ABI path is unchanged in behaviour, only moved under the !type.customABI() branch.

Related Issues

Part of reviving the riscv64 LLVM backend, discussed in #13351.

Testing

Built substratevm for linux-riscv64 on a Banana Pi F3 (SpaceMiT K1) and ran native-image on a HelloWorld with --tool:llvm-backend --no-fallback. Before this change the build aborted in getCallingConvention at the first foreign call; after it, the build proceeds through all method compilation. The image does not yet link on riscv64 due to a separate, independent issue (the in-process object reader still uses the LLVM 13 bytedeco preset against LLVM 20.1.4 objects, discussed in #13351).

Documentation

No documentation changes needed.

Contributor Checklist

  • I have read the contribution guide.
  • I have the right to contribute the submitted material under the project terms.
  • I have updated tests and documentation where appropriate.
  • If I used a coding assistant, I remain responsible for the entire contribution and have reviewed it accordingly.

…vention

Master restored the LLVM backend with a riscv64 target, but
SubstrateRISCV64RegisterConfig.getCallingConvention still threw for
fixed parameter assignments and return saving. Port the implementation
(return-buffer placeholder in x28, custom-ABI parameter assignment),
mirroring the AArch64 register config.
@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant