File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,11 @@ namespace irgen {
82
82
clang::PointerAuthQualifier pointerAuthQual,
83
83
llvm::Value *storageAddress);
84
84
85
+ static PointerAuthInfo emit (IRGenFunction &IGF,
86
+ const PointerAuthSchema &schema,
87
+ llvm::Value *storageAddress,
88
+ llvm::ConstantInt *otherDiscriminator);
89
+
85
90
static PointerAuthInfo forFunctionPointer (IRGenModule &IGM,
86
91
CanSILFunctionType fnType);
87
92
Original file line number Diff line number Diff line change @@ -265,6 +265,33 @@ PointerAuthInfo::emit(IRGenFunction &IGF,
265
265
return PointerAuthInfo (key, discriminator);
266
266
}
267
267
268
+ PointerAuthInfo PointerAuthInfo::emit (IRGenFunction &IGF,
269
+ const PointerAuthSchema &schema,
270
+ llvm::Value *storageAddress,
271
+ llvm::ConstantInt *otherDiscriminator) {
272
+ if (!schema)
273
+ return PointerAuthInfo ();
274
+
275
+ unsigned key = schema.getKey ();
276
+
277
+ llvm::Value *discriminator = otherDiscriminator;
278
+
279
+ // Factor in the address.
280
+ if (schema.isAddressDiscriminated ()) {
281
+ assert (storageAddress &&
282
+ " no storage address for address-discriminated schema" );
283
+
284
+ if (!otherDiscriminator->isZero ()) {
285
+ discriminator = emitPointerAuthBlend (IGF, storageAddress, discriminator);
286
+ } else {
287
+ discriminator =
288
+ IGF.Builder .CreatePtrToInt (storageAddress, IGF.IGM .Int64Ty );
289
+ }
290
+ }
291
+
292
+ return PointerAuthInfo (key, discriminator);
293
+ }
294
+
268
295
llvm::ConstantInt *
269
296
PointerAuthInfo::getOtherDiscriminator (IRGenModule &IGM,
270
297
const PointerAuthSchema &schema,
You can’t perform that action at this time.
0 commit comments