Skip to content

LLVMMergeFunctions: Must not merge function calls to objc_sendMsg$... #42116

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/LLVMPasses/LLVMMergeFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,16 @@ static bool isCalleeOperand(const CallInst *CI, unsigned opIdx) {
static bool canParameterizeCallOperand(const CallInst *CI, unsigned opIdx) {
if (CI->isInlineAsm())
return false;
if (Function *Callee = CI->getCalledFunction()) {

Function *Callee = CI->getCalledOperand() ?
dyn_cast_or_null<Function>(CI->getCalledOperand()->stripPointerCasts()) :
nullptr;
if (Callee) {
if (Callee->isIntrinsic())
return false;
// objc_msgSend stubs must be called, and can't have their address taken.
if (Callee->getName().startswith("objc_msgSend$"))
return false;
}
if (isCalleeOperand(CI, opIdx) &&
CI->getOperandBundle(LLVMContext::OB_ptrauth).hasValue()) {
Expand Down