Skip to content

Commit 54d8f93

Browse files
committed
[Apple Silicon] Use a correct isa mask on Apple Silicon without signed isas
1 parent 00a9c11 commit 54d8f93

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

stdlib/public/runtime/Private.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,22 @@ class TypeInfo {
9797
// out the proper includes from libobjc. The values MUST match the ones from
9898
// libobjc. Debug builds check these values against objc_debug_isa_class_mask
9999
// from libobjc.
100-
# if TARGET_OS_SIMULATOR
101-
// Simulators don't currently use isa masking, but we still want to emit
100+
# if TARGET_OS_SIMULATOR && __x86_64__
101+
// Simulators don't currently use isa masking on x86, but we still want to emit
102102
// swift_isaMask and the corresponding code in case that changes. libobjc's
103103
// mask has the bottom bits clear to include pointer alignment, match that
104104
// value here.
105105
# define SWIFT_ISA_MASK 0xfffffffffffffff8ULL
106106
# elif __arm64__
107-
# define SWIFT_ISA_MASK 0x0000000ffffffff8ULL
107+
# if __has_feature(ptrauth_calls)
108+
# define SWIFT_ISA_MASK 0x007ffffffffffff8ULL
109+
# else
110+
# if TARGET_OS_OSX
111+
# define SWIFT_ISA_MASK 0x00007ffffffffff8ULL
112+
# else
113+
# define SWIFT_ISA_MASK 0x0000000ffffffff8ULL
114+
# endif
115+
# endif
108116
# elif __x86_64__
109117
# define SWIFT_ISA_MASK 0x00007ffffffffff8ULL
110118
# else

0 commit comments

Comments
 (0)