Skip to content

Commit

Permalink
[ffigen] Only use objc_msgSend variants on x64 (#836)
Browse files Browse the repository at this point in the history
`objc_msgSend_stret` and `objc_msgSend_fpret` are only available on x64, so just use the normal `objc_msgSend` on arm64.

We can only check the ABI at runtime, so for the stret and fpret variants we need to emit both the variant and the normal `objc_msgSend` function. Then we can decide which to use when the method is invoked at runtime.

This runtime check is complicated by the fact that `objc_msgSend_stret` has a different signature than `objc_msgSend` has for the same method. This is because `objc_msgSend_stret` takes a pointer to the return type as its first arg. If it wasn't for this signature difference we could just change the function name string we pass to `DynamicLibrary.lookup`.

Fixes #829
  • Loading branch information
liamappelbe authored Nov 29, 2023
1 parent 50b6a78 commit 1748715
Show file tree
Hide file tree
Showing 5 changed files with 2,226 additions and 530 deletions.
1 change: 1 addition & 0 deletions pkgs/ffigen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bindings to **not** be generated by default, since it may result in invalid
bindings if the compiler makes a wrong guess. A flag `--ignore-source-errors` (or yaml config `ignore-source-errors: true`)
must be passed to change this behaviour.
- __Breaking change__: Stop generating setters for global variables marked `const` in C.
- Fix objc_msgSend being used on arm64 platforms where it's not available.

## 10.0.0

Expand Down
Loading

0 comments on commit 1748715

Please sign in to comment.