Skip to content

Commit 0ec5600

Browse files
authored
Merge pull request #69339 from mikeash/swift-inspect-arm-strip
[swift-inspect] Compute ptrauth mask when building for plain ARM64.
2 parents 85b08cd + 8689cf8 commit 0ec5600

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tools/swift-inspect/Sources/SymbolicationShims/SymbolicationShims.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
#if defined(__APPLE__)
1414

15+
#include <mach/vm_param.h>
1516
#include <stdint.h>
1617
#include <ptrauth.h>
1718

@@ -26,6 +27,10 @@ struct Range {
2627
static inline uintptr_t GetPtrauthMask(void) {
2728
#if __has_feature(ptrauth_calls)
2829
return (uintptr_t)ptrauth_strip((void*)0x0007ffffffffffff, 0);
30+
#elif __arm64__ && __LP64__
31+
// Mask all bits above the top of MACH_VM_MAX_ADDRESS, which will
32+
// match the above ptrauth_strip.
33+
return (uintptr_t)~0ull >> __builtin_clzll(MACH_VM_MAX_ADDRESS);
2934
#else
3035
return (uintptr_t)~0ull;
3136
#endif

0 commit comments

Comments
 (0)