kbuild/recordmcount: Add RECORDMCOUNT_WARN to warn about mcount callers
authorSteven Rostedt <srostedt@redhat.com>
Tue, 12 Apr 2011 22:59:10 +0000 (18:59 -0400)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 17 May 2011 14:41:49 +0000 (10:41 -0400)
When mcount is called in a section that ftrace will not modify it into
a nop, we want to warn about this. But not warn about this always. Now
if the user builds the kernel with the option RECORDMCOUNT_WARN=1 then
the build will warn about mcount callers that are ignored and will just
waste execution time.

Acked-by: Michal Marek <mmarek@suse.cz>
Cc: linux-kbuild@vger.kernel.org
Link: http://lkml.kernel.org/r/20110421023738.714956282@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Makefile
scripts/Makefile.build

index 41ea6fbec55a1edcdcd697510afcc417578b057c..e7d01adaf6929c2859572b0cc0205123da436cff 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1268,6 +1268,7 @@ help:
        @echo  '  make C=1   [targets] Check all c source with $$CHECK (sparse by default)'
        @echo  '  make C=2   [targets] Force check of all c source with $$CHECK'
        @echo  '  make W=1   [targets] Enable extra gcc checks'
+       @echo  '  make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
        @echo  ''
        @echo  'Execute "make" or "make all" to build all targets marked with [*] '
        @echo  'For further info see the ./README file'
index 7d3f9036eee23b81317c38af71a29b7b3d865c73..6165622c3e29ae4cb395a1182045a905b603d7f4 100644 (file)
@@ -244,13 +244,16 @@ endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
+ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
+  RECORDMCOUNT_FLAGS = -w
+endif
 # Due to recursion, we must skip empty.o.
 # The empty.o file is created in the make process in order to determine
 #  the target endianness and word size. It is made before all other C
 #  files, including recordmcount.
 sub_cmd_record_mcount =                                        \
        if [ $(@) != "scripts/mod/empty.o" ]; then      \
-               $(objtree)/scripts/recordmcount "$(@)"; \
+               $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)";   \
        fi;
 recordmcount_source := $(srctree)/scripts/recordmcount.c \
                    $(srctree)/scripts/recordmcount.h