https://bugs.llvm.org/show_bug.cgi?id=33515
Bug ID: 33515
Summary: clang should not generate counting function for
functions with no_instrument_function attribute.
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: manojgu...@google.com
Reporter: manojgu...@google.com
CC: llvm-bugs@lists.llvm.org
When -pg is used, clang generates counting functions even for functions with
no_instrument_function attribute.
This results in a Linux kernel crash when function tracing is enabled in Chrome
OS.
GCC behavior is to not generate any counting functions with
no_instrument_function attribute.
Apparently, this is also desired in clang according to the comment in
SemaDeclAttr.cpp but the implementation is broken.
llvm/tools/clang/lib/Sema/SemaDeclAttr.cpp: case
AttributeList::AT_NoInstrumentFunction: // Interacts with -pg.
$ cat pg.c
__attribute__((no_instrument_function)) void foo()
{
}
$ clang pg.c -c -pg -target aarch64-unknown-linux-gnu
$ aarch64-linux-gnu-objdump -d pg.o
Disassembly of section .text:
00000000 <foo>:
0: e92d4800 push {fp, lr}
4: e1a0b00d mov fp, sp
8: ebfffffe bl 0 <_mcount> // _mcount should not be generated
c: e8bd8800 pop {fp, pc}
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs