ANDROID: kbuild: fix dynamic ftrace with clang LTO

With CONFIG_LTO_CLANG enabled, LLVM IR won't be compiled into object
files until modpost_link. This change postpones calls to recordmcount
until after this step.

In order to exclude ftrace_process_locs from inspection, we add a new
code section .text..ftrace, which we tell recordmcount to ignore, and
a __norecordmcount attribute for moving functions to this section.

Bug: 145210207
Change-Id: Ib77f7c431fce54243c46d584b55761ed2342965c
Signed-off-by: Sami Tolvanen <[email protected]>
This commit is contained in:
Sami Tolvanen 2019-05-08 13:53:41 -07:00
commit d671af5fd7
9 changed files with 52 additions and 5 deletions

View file

@ -590,7 +590,7 @@ config LTO_CLANG
bool "Use Clang's Link Time Optimization (LTO) (EXPERIMENTAL)"
depends on ARCH_SUPPORTS_LTO_CLANG
depends on !KASAN
depends on !FTRACE_MCOUNT_RECORD
depends on !FTRACE_MCOUNT_RECORD || HAVE_C_RECORDMCOUNT
depends on CC_IS_CLANG && CLANG_VERSION >= 100000 && LD_IS_LLD
select LTO
help