I'm building my command line app, and noticed that all the binaries I create are of type arm64
.
However, all the bins that ship with macOS 11.4 are arm64e
.
i.e. running file
on my app built on an M1 MacBook shows:
Mach-O 64-bit executable arm64
Whereas, running file on the system xxd
app on the same machine shows:
Mach-O 64-bit executable arm64e
I've looked in Xcode and cannot see how to augment this, should Xcode not be building arm64e
? If so how can I achieve the same?
Here's a picture:
EDIT: I think the answer might be, the arm64e ABI is unstable and not in use for anyone but Apple?
The main difference between targeting arm64 and arm64e is ARMv8.3's Pointer Authentication Codes. Since the specific ABI hasn't stabilized, Apple is only using it for their own platform code since they can easily recompile the entire OS version with a different ABI by shipping a new OS whereas they can't really force all developers to start using a new ABI.
Despite this, you can compile for arm64e simply by choosing "other..." on the architectures drop down and typing in arm64e
. By default, macOS will refuse to run any non-Apple code that has the arm64e slice (since they want to prevent anyone from shipping arm64e code before the ABI is stable). You can, however, override this behavior and allow macOS to run non-Apple arm64e code by setting the arm64e_preview_abi
bootarg:
sudo nvram boot-args=-arm64e_preview_abi
Note that you will need to disable system integrity protection to do so. This bootarg is meant to allow developers to prepare their software to run with pointer authentication enabled and really not much else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With