DTK: Should we build for arm64 architecture or arm64e?

It seems that binaries on the DTK are built for arm64e architecture, as you can see :

Code Block zsh
% lipo -info /bin/ls
Architectures in the fat file: /bin/ls are: x86_64 arm64e


However, when I try to build binaries for arm64e it doesn't seem to work. Take this sample program:
Code Block C
#include <stdio.h>
int main() {
printf("Hello ARM\n");
return 0;
}


Compiling it for either arm64 or arm64e works fine, but I can only run the arm64 version:

Code Block
% clang -arch arm64 main.c && ./a.out 
Hello ARM
% clang -arch arm64e main.c && ./a.out
zsh: killed     ./a.out


I don't know why the arm64e version is killed, I couldn't find anything suspicious in the logs.

Apple's docs don't seem to mention any differences between arm64 and arm64e, but since they build things for arm64e I assume that is what we should do too?

Accepted Reply

This session https://developer.apple.com/wwdc20/10686 mentions arm64e. I believe it requires special special boot arguments to work for non-Apple processes. They say that they're not ready for non-Apple developers to adopt it yet.

Replies

If you omit the architecture, it builds for arm64. So that's what I am sticking with for now.
This session https://developer.apple.com/wwdc20/10686 mentions arm64e. I believe it requires special special boot arguments to work for non-Apple processes. They say that they're not ready for non-Apple developers to adopt it yet.
Thanks for pointing me to the WWDC video!

It seems that the main difference between arm64 and arm64e is that the latter includes pointer authentication.

Apparently you can use the following command to enable arm64e binaries (after disabling SIP):
sudo nvram boot-args=-arm64e_preview_abi

(I haven't tried it yet myself)

The video also pointed to this guide (only talks about iOS though): https://developer.apple.com/documentation/security/preparing_your_app_to_work_with_pointer_authentication