Skip to content

Commit 6aa5833

Browse files
committed
Remove default pointer auth info for c function pointers
1 parent 01154c6 commit 6aa5833

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/IRGen/GenCall.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5030,16 +5030,23 @@ Callee irgen::getSwiftFunctionPointerCallee(
50305030
return Callee(std::move(calleeInfo), fn, dataPtr);
50315031
}
50325032

5033-
Callee irgen::getCFunctionPointerCallee(IRGenFunction &IGF,
5034-
llvm::Value *fnPtr,
5033+
Callee irgen::getCFunctionPointerCallee(IRGenFunction &IGF, llvm::Value *fnPtr,
50355034
CalleeInfo &&calleeInfo) {
50365035
auto sig = emitCastOfFunctionPointer(IGF, fnPtr, calleeInfo.OrigFnType);
5037-
auto authInfo =
5038-
PointerAuthInfo::forFunctionPointer(IGF.IGM, calleeInfo.OrigFnType);
50395036

5040-
auto fn = FunctionPointer::createSigned(FunctionPointer::Kind::Function,
5041-
fnPtr, authInfo, sig);
5037+
if (!IGF.getSILModule()
5038+
.getOptions()
5039+
.EnableImportPtrauthFieldFunctionPointers) {
5040+
auto sig = emitCastOfFunctionPointer(IGF, fnPtr, calleeInfo.OrigFnType);
5041+
auto authInfo =
5042+
PointerAuthInfo::forFunctionPointer(IGF.IGM, calleeInfo.OrigFnType);
50425043

5044+
auto fn = FunctionPointer::createSigned(FunctionPointer::Kind::Function,
5045+
fnPtr, authInfo, sig);
5046+
return Callee(std::move(calleeInfo), fn);
5047+
}
5048+
auto fn = FunctionPointer::createUnsigned(FunctionPointer::Kind::Function,
5049+
fnPtr, sig);
50435050
return Callee(std::move(calleeInfo), fn);
50445051
}
50455052

0 commit comments

Comments
 (0)