public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Use -mcount-record for dynamic ftrace
@ 2015-04-13  0:54 Andi Kleen
  2015-04-13 19:32 ` Steven Rostedt
  0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2015-04-13  0:54 UTC (permalink / raw)
  To: rostedt; +Cc: linux-kernel, linux-kbuild, mmarek, Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

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.

It also has a -mcount-nop option to generate the mcount calls
as nops. So far that is not implemented, but it could be used
to optimize patching at boot up.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 scripts/Makefile.build | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 01df30a..f258e9b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -210,6 +210,11 @@ cmd_modversions =								\
 	fi;
 endif
 
+# 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 CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
 ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
@@ -240,6 +245,7 @@ cmd_record_mcount =						\
 		$(sub_cmd_record_mcount)			\
 	fi;
 endif
+endif
 
 define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
-- 
2.3.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-04-14 13:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-13  0:54 [PATCH] Use -mcount-record for dynamic ftrace Andi Kleen
2015-04-13 19:32 ` Steven Rostedt
2015-04-13 21:55   ` Andi Kleen
2015-04-13 22:03     ` Steven Rostedt
2015-04-13 22:54       ` Andi Kleen
2015-04-14  0:26         ` Steven Rostedt
2015-04-14  6:19   ` Kalle Valo
2015-04-14 13:07     ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox