[RFC] better fix? (was: Re: [PATCH][GIT PULL] ftrace: Remove recursion between recordmcount and scripts/mod/empty)
diff mbox

Message ID 1287429206.16971.325.camel@gandalf.stny.rr.com
State New, archived
Headers show

Commit Message

Steven Rostedt Oct. 18, 2010, 7:13 p.m. UTC
None

Patch
diff mbox

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 9f2d5b4..86e360a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -210,11 +210,7 @@  endif
 
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
-# Due to recursion, we must skip the empty.o file
-#  TBD: Find a better way to do this.
-cmd_record_mcount = if [ $(@) != "scripts/mod/empty.o" ]; then			\
-			$(objtree)/scripts/recordmcount "$(@)";			\
-		    fi;
+cmd_record_mcount = $(objtree)/scripts/recordmcount "$(@)";
 else
 cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
 	"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
@@ -236,11 +232,26 @@  define rule_cc_o_c
 	mv -f $(dot-target).tmp $(dot-target).cmd
 endef
 
+define rule_cc_o_c_notrace
+	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
+	$(call echo-cmd,cc_o_c) $(cmd_cc_o_c);				  \
+	$(cmd_modversions)						  \
+	scripts/basic/fixdep $(depfile) $@ '$(call make-cmd,cc_o_c)' >    \
+	                                              $(dot-target).tmp;  \
+	rm -f $(depfile);						  \
+	mv -f $(dot-target).tmp $(dot-target).cmd
+endef
+
 # Built-in and composite module parts
 $(obj)/%.o: $(src)/%.c FORCE
 	$(call cmd,force_checksrc)
 	$(call if_changed_rule,cc_o_c)
 
+# Due to recursion, recordmcount must not be called on empty.o
+$(objtree)/scripts/mod/empty.o: $(srctree)/scripts/mod/empty.c
+	$(call cmd,force_checksrc)
+	$(call if_changed_rule,cc_o_c_notrace)
+
 # Single-part modules are special since we need to mark them in $(MODVERDIR)
 
 $(single-used-m): $(obj)/%.o: $(src)/%.c FORCE