Skip to content

Commit a61e704

Browse files
authored
Witness tables have special ptrauth requirements (#33876)
1 parent 084ff3d commit a61e704

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

stdlib/public/runtime/DynamicCast.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ id swift_dynamicCastMetatypeToObjectConditional(const Metadata *metatype);
145145

146146
// protocol _ObjectiveCBridgeable {
147147
struct _ObjectiveCBridgeableWitnessTable : WitnessTable {
148+
#define _protocolWitnessSignedPointer(n) \
149+
__ptrauth_swift_protocol_witness_function_pointer(SpecialPointerAuthDiscriminators::n##Discriminator) n
150+
148151
static_assert(WitnessTableFirstRequirementOffset == 1,
149152
"Witness table layout changed");
150153

@@ -153,14 +156,14 @@ struct _ObjectiveCBridgeableWitnessTable : WitnessTable {
153156

154157
// func _bridgeToObjectiveC() -> _ObjectiveCType
155158
SWIFT_CC(swift)
156-
HeapObject *(*bridgeToObjectiveC)(
159+
HeapObject *(*_protocolWitnessSignedPointer(bridgeToObjectiveC))(
157160
SWIFT_CONTEXT OpaqueValue *self, const Metadata *Self,
158161
const _ObjectiveCBridgeableWitnessTable *witnessTable);
159162

160163
// class func _forceBridgeFromObjectiveC(x: _ObjectiveCType,
161164
// inout result: Self?)
162165
SWIFT_CC(swift)
163-
void (*forceBridgeFromObjectiveC)(
166+
void (*_protocolWitnessSignedPointer(forceBridgeFromObjectiveC))(
164167
HeapObject *sourceValue,
165168
OpaqueValue *result,
166169
SWIFT_CONTEXT const Metadata *self,
@@ -170,7 +173,7 @@ struct _ObjectiveCBridgeableWitnessTable : WitnessTable {
170173
// class func _conditionallyBridgeFromObjectiveC(x: _ObjectiveCType,
171174
// inout result: Self?) -> Bool
172175
SWIFT_CC(swift)
173-
bool (*conditionallyBridgeFromObjectiveC)(
176+
bool (*_protocolWitnessSignedPointer(conditionallyBridgeFromObjectiveC))(
174177
HeapObject *sourceValue,
175178
OpaqueValue *result,
176179
SWIFT_CONTEXT const Metadata *self,

0 commit comments

Comments
 (0)