trace: Use -mcount-record for dynamic ftrace

gcc 5 supports a new -mcount-record option to generate ftrace
tables directly. This avoids the need to run record_mcount
manually.

Use this option when available.

So far doesn't use -mcount-nop, which also exists now.

This is needed to make ftrace work with LTO because the
normal record-mcount script doesn't run over the link
time output.

It should also improve build times slightly in the general
case.
Link: http://lkml.kernel.org/r/20171127213423.27218-12-andi@firstfloor.org

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Andi Kleen 2017-11-27 13:34:13 -08:00 committed by Steven Rostedt (VMware)
parent 2824f50332
commit 96f60dfa58
1 changed files with 6 additions and 0 deletions

View File

@ -207,6 +207,11 @@ cmd_modversions_c = \
endif
ifdef CONFIG_FTRACE_MCOUNT_RECORD
# gcc 5 supports generating the mcount tables directly
ifneq ($(call cc-option,-mrecord-mcount,y),y)
KBUILD_CFLAGS += -mrecord-mcount
else
# else do it all manually
ifdef BUILD_C_RECORDMCOUNT
ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
RECORDMCOUNT_FLAGS = -w
@ -259,6 +264,7 @@ ifneq ($(RETPOLINE_CFLAGS),)
objtool_args += --retpoline
endif
endif
endif
ifdef CONFIG_MODVERSIONS