Add support for the AAPCS64 calling convention #1468
Merged
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.
This change adds support for the AAPCS64 calling convention, targeting Linux and macOS AARCH64 systems.
This was developed on a macOS target, which has "looser", Apple specific, alignment requirements than the base standard used by Linux.
Support for the latter has only been tested against a QEMU VM running Arch Linux ARM, so tests against actual hardware would be appreciated.
In general my use-case is pretty simple, so there might be bugs with more complex function signatures. I've added two tests for stack spilling and alignment differences to at least catch rudimentary errors here, but again, tests against more complex libraries would be appreciated.
Reading over the Windows Overview of ARM64 ABI conventions suggests, that there are no relevant modifications to the base convention as with Linux. Thus this change might be compatible with Windows as well. I did not enable it for Windows as I could not test this.
Small example of a Raylib binding running on macOS (M1)
main.janet
stav/ffi/raylib.janet