Re: [PATCHv2 7/8] arm64: implement ftrace with regs

From: Torsten Duwe
Date: Fri Nov 15 2019 - 02:46:11 EST


On Fri, 15 Nov 2019 07:05:39 +0900
Itaru Kitayama <itaru.kitayama@xxxxxxxxx> wrote:

> Is this feature avail even when building kernel with Clang?

If your compiler can ...

[...]
> > compiler insert a configurable number of NOPs between the function
> > entry point and the usual prologue. This also ensures functions are
> > AAPCS compliant (e.g. disabling inter-procedural register
> > allocation).
> >
> > For example, with -fpatchable-function-entry=2, GCC 8.1.0 compiles
> > the following:
> >
> > | unsigned long bar(void);
> > |
> > | unsigned long foo(void)
> > | {
> > | return bar() + 1;
> > | }
> >
> > ... to:
> >
> > | <foo>:
> > | nop
> > | nop
> > | stp x29, x30, [sp, #-16]!

* insert e.g. 2 NOPs
* record all those locations in a section called
"patchable_function_entries"
* stick to the AAPCS

then: yes. So far I only implemented this for gcc.

Torsten