OpenCloudOS-Kernel/arch/powerpc/tools
Naveen N Rao 0f71dcfb4a powerpc/ftrace: Add support for -fpatchable-function-entry
GCC v13.1 updated support for -fpatchable-function-entry on ppc64le to
emit nops after the local entry point, rather than before it. This
allows us to use this in the kernel for ftrace purposes. A new script is
added under arch/powerpc/tools/ to help detect if nops are emitted after
the function local entry point, or before the global entry point.

With -fpatchable-function-entry, we no longer have the profiling
instructions generated at function entry, so we only need to validate
the presence of two nops at the ftrace location in ftrace_init_nop(). We
patch the preceding instruction with 'mflr r0' to match the
-mprofile-kernel ABI for subsequent ftrace use.

This changes the profiling instructions used on ppc32. The default -pg
option emits an additional 'stw' instruction after 'mflr r0' and before
the branch to _mcount 'bl _mcount'. This is very similar to the original
-mprofile-kernel implementation on ppc64le, where an additional 'std'
instruction was used to save LR to its save location in the caller's
stackframe. Subsequently, this additional store was removed in later
compiler versions for performance reasons. The same reasons apply for
ppc32 so we only patch in a 'mflr r0'.

Signed-off-by: Naveen N Rao <naveen@kernel.org>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/68586d22981a2c3bb45f27a2b621173d10a7d092.1687166935.git.naveen@kernel.org
2023-08-22 00:09:06 +10:00
..
checkpatch.sh powerpc/tools: Remove 90 line limit in checkpatch script 2020-09-08 22:57:11 +10:00
gcc-check-fpatchable-function-entry.sh powerpc/ftrace: Add support for -fpatchable-function-entry 2023-08-22 00:09:06 +10:00
gcc-check-mprofile-kernel.sh powerpc/64: Use -mprofile-kernel for big endian ELFv2 kernels 2023-06-14 12:46:42 +10:00
head_check.sh powerpc/head_check: Fix shellcheck errors 2021-08-17 22:52:02 +10:00
relocs_check.sh powerpc: Move script to check relocations at compile time in scripts/ 2023-04-19 07:46:31 -07:00
unrel_branch_check.sh powerpc: unrel_branch_check.sh: enable the use of llvm-objdump v9, 10 or 11 2020-09-02 11:00:22 +10:00