Open glandium opened 5 months ago
@llvm/issue-subscribers-backend-aarch64
Author: Mike Hommey (glandium)
Indeed, that 0x80 is CPU_SUBTYPE_PTRAUTH_ABI
, per mach/machine.h
FWIW, this works using the fork over at https://github.com/apple/llvm-project:
% ~/src/apple-llvm-project/build/bin/clang -o foo.o -c foo.c --target=arm64e-apple-darwin -S -o - | rg ptrauth
.ptrauth_abi_version 0
% ~/src/apple-llvm-project/build/bin/clang -o foo.o -c foo.c --target=arm64e-apple-darwin
% ~/src/apple-llvm-project/build/bin/clang -o foo foo.o --target=arm64e-apple-darwin -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
Diffing this against the upstream llvm tree finds a bunch of ptrauth code. The rust issue mentioned above links to the initial RFC for this from 2019, and the https://github.com/apple/llvm-project/pull/14 "preview".
If someone had to create arm64e binaries for some reason, it's probably possible (but fiddly) to locally patch the ptrauth bits from the fork over there onto public upstream llvm.
I suppose the 0x80 caps is what indicates what Xcode clang produces is what ld calls "arm64e" vs. 0x00 indicating "arm64e.old".