IRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail.
authorPeter Collingbourne <peter@pcc.me.uk>
Mon, 25 Nov 2019 20:28:11 +0000 (12:28 -0800)
committerPeter Collingbourne <peter@pcc.me.uk>
Mon, 25 Nov 2019 23:16:43 +0000 (15:16 -0800)
commit90b8bc003caacd165dedbb9cafc32de10d610ea7
treef86a5ef4ef6a9df855f5f72f6589c9fce94af41f
parent1b42cc0df160b2c741a258331e647472c370eb66
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
clang/lib/CodeGen/CGExpr.cpp
clang/test/CodeGen/cfi-check-fail-attrs.c [new file with mode: 0644]