FROMLIST: BACKPORT: 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: 62093296
Bug: 67506682
Change-Id: Iba2c053968206acf533fadab1eb34a743b5088ee
(am from https://patchwork.kernel.org/patch/10060327/)
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:
Sami Tolvanen 2017-06-16 12:52:57 -07:00
parent 475bdd7d35
commit 7bd125e57b
9 changed files with 52 additions and 7 deletions

View file

@ -366,7 +366,8 @@ is_mcounted_section_name(char const *const txtname)
strcmp(".softirqentry.text", txtname) == 0 ||
strcmp(".kprobes.text", txtname) == 0 ||
strcmp(".cpuidle.text", txtname) == 0 ||
strcmp(".text.unlikely", txtname) == 0;
(strncmp(".text.", txtname, 6) == 0 &&
strcmp(".text..ftrace", txtname) != 0);
}
/* 32 bit and 64 bit are very similar */