diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2019-11-25 12:28:11 -0800 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2019-11-25 15:16:43 -0800 |
commit | 90b8bc003caacd165dedbb9cafc32de10d610ea7 (patch) | |
tree | f86a5ef4ef6a9df855f5f72f6589c9fce94af41f /clang/lib/CodeGen/CGExpr.cpp | |
parent | 1b42cc0df160b2c741a258331e647472c370eb66 (diff) | |
download | bcm5719-llvm-90b8bc003caacd165dedbb9cafc32de10d610ea7.tar.gz bcm5719-llvm-90b8bc003caacd165dedbb9cafc32de10d610ea7.zip |
IRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail.
This has the main effect of causing target-cpu and target-features to be set
on __cfi_check_fail, causing the function to become ABI-compatible with other
functions in the case where these attributes affect ABI (e.g. reserve-x18).
Technically we only need to call SetLLVMFunctionAttributes to get the target-*
attributes set, but since we're creating a definition we probably ought to
call the ForDefinition function as well.
Fixes PR44094.
Differential Revision: https://reviews.llvm.org/D70692
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExpr.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp index 214378a966f..04c6504910b 100644 --- a/clang/lib/CodeGen/CGExpr.cpp +++ b/clang/lib/CodeGen/CGExpr.cpp @@ -3200,6 +3200,9 @@ void CodeGenFunction::EmitCfiCheckFail() { llvm::Function *F = llvm::Function::Create( llvm::FunctionType::get(VoidTy, {VoidPtrTy, VoidPtrTy}, false), llvm::GlobalValue::WeakODRLinkage, "__cfi_check_fail", &CGM.getModule()); + + CGM.SetLLVMFunctionAttributes(GlobalDecl(), FI, F); + CGM.SetLLVMFunctionAttributesForDefinition(nullptr, F); F->setVisibility(llvm::GlobalValue::HiddenVisibility); StartFunction(GlobalDecl(), CGM.getContext().VoidTy, F, FI, Args, |