diff options
author | Manoj Gupta <manojgupta@google.com> | 2017-06-19 18:45:03 +0000 |
---|---|---|
committer | Manoj Gupta <manojgupta@google.com> | 2017-06-19 18:45:03 +0000 |
commit | 162b40a85006f76e916225a7433a8194ae13c53b (patch) | |
tree | f449896a2f7a83814cef393b7ec83eb199a25861 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 18b5d9268c4af16731574570eebc542d26bc4f15 (diff) | |
download | bcm5719-llvm-162b40a85006f76e916225a7433a8194ae13c53b.tar.gz bcm5719-llvm-162b40a85006f76e916225a7433a8194ae13c53b.zip |
[Clang] Handle interaction of -pg and no_instrument_function attribute.
Summary:
Disable generation of counting-function attribute if no_instrument_function
attribute is present in function.
Interaction between -pg and no_instrument_function is the desired behavior
and matches gcc as well.
This is required for fixing a crash in Linux kernel when function tracing
is enabled.
Fixes PR33515.
Reviewers: hfinkel, rengolin, srhines, hans
Reviewed By: hfinkel
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D34357
llvm-svn: 305728
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index ac1a1334f10..1a7797b37e1 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -887,8 +887,10 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, if (CGM.getCodeGenOpts().InstrumentForProfiling) { if (CGM.getCodeGenOpts().CallFEntry) Fn->addFnAttr("fentry-call", "true"); - else - Fn->addFnAttr("counting-function", getTarget().getMCountName()); + else { + if (!CurFuncDecl || !CurFuncDecl->hasAttr<NoInstrumentFunctionAttr>()) + Fn->addFnAttr("counting-function", getTarget().getMCountName()); + } } if (RetTy->isVoidType()) { |