binaryninja-api icon indicating copy to clipboard operation
binaryninja-api copied to clipboard

Swift calling conventions

Open comex opened this issue 3 years ago • 0 comments

What is the feature you'd like to have? Swift has a custom calling convention on x86-64 and arm64 with some differences from the platform's standard one.

Some of these differences can be modeled using Binary Ninja's BNCustomCallingConvention API: e.g., x20 is used for self and can be treated as another integer argument. Others cannot: e.g., Swift uses up to 4 registers for integer return values (x0 through x3), plus a fifth for error values (x21), whereas BNCustomCallingConvention seems to support at most two integer return registers.

In any case, since Swift code is becoming quite common on Apple platforms, it would be nice if Binary Ninja supported Swift calling conventions out of the box.

comex avatar Feb 19 '23 06:02 comex