diff options
author | Manoj Gupta <manojgupta@google.com> | 2018-03-02 23:52:44 +0000 |
---|---|---|
committer | Manoj Gupta <manojgupta@google.com> | 2018-03-02 23:52:44 +0000 |
commit | 886b4505f2d71ec34aea8b3342914f7daee45db4 (patch) | |
tree | d7b784b99b935a544f93db31ba8cea2631e719c8 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | a4619d9944c7e54c421582c7dc592ae051d8bf51 (diff) | |
download | bcm5719-llvm-886b4505f2d71ec34aea8b3342914f7daee45db4.tar.gz bcm5719-llvm-886b4505f2d71ec34aea8b3342914f7daee45db4.zip |
Do not generate calls to fentry with __attribute__((no_instrument_function))
Summary:
Currently only calls to mcount were suppressed with
no_instrument_function attribute.
Linux kernel requires that calls to fentry should also not be
generated.
This is an extended fix for PR PR33515.
Reviewers: hfinkel, rengolin, srhines, rnk, rsmith, rjmccall, hans
Reviewed By: rjmccall
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D43995
llvm-svn: 326639
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 38c679abf6b..2f814a7165a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1016,10 +1016,12 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, // The attribute "counting-function" is set to mcount function name which is // architecture dependent. if (CGM.getCodeGenOpts().InstrumentForProfiling) { - if (CGM.getCodeGenOpts().CallFEntry) - Fn->addFnAttr("fentry-call", "true"); - else { - if (!CurFuncDecl || !CurFuncDecl->hasAttr<NoInstrumentFunctionAttr>()) { + // Calls to fentry/mcount should not be generated if function has + // the no_instrument_function attribute. + if (!CurFuncDecl || !CurFuncDecl->hasAttr<NoInstrumentFunctionAttr>()) { + if (CGM.getCodeGenOpts().CallFEntry) + Fn->addFnAttr("fentry-call", "true"); + else { Fn->addFnAttr("instrument-function-entry-inlined", getTarget().getMCountName()); } |