You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
arc: Update PROFILE_HOOK to support Linux's ftrace
Ftrace is a Linux internal tracer which helps developers to find what
is going on inisde the kernel. The way this works is the _mcount
function call (placed at the start of every kernel function, produced
by the -pg switch in gcc), starts of pointing to a simple return in
the stack.
The ARCv2 ABI does not enable us to perform full function tracing (aka
ftrace_graph with entry and exit) due to the fact that the
blink (return address) is pushed first on the stack. However,
providing the location of blink in the current stack enables some
ftrace capabilities.
This patch updates the ARC's profile hook for Linux targets, by
providing two arguments to `_mcount` profile function. First argument
is blink value, and the second argument is the blink location in the
current function stack.
As PROFILE_HOOK is called in the expand, and the stack layout is known
after register allocation, we use an unspec to mark the mcount second
argument move which needs to be updated latter on.
gcc/
* config/arc/arc-protos.h (arc_get_arg_ptr): Declare.
(arc_profile_hook): Likewise.
* config/arc/arc.cc (arc_profile_hook): New function.
(arc_get_arg_ptr): Likewise.
* config/arc/arc.md (UNSPEC_ARC_MCOUNT): New define.
(mcount_stack): New pattern.
* config/arc/linux.h (PROFILE_HOOK): Update hook.
Signed-off-by: Claudiu Zissulescu <claziss@gmail.com>
0 commit comments