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

From: Steven Rostedt
Date: Mon Oct 18 2010 - 15:13:34 EST


On Mon, 2010-10-18 at 14:53 -0400, Steven Rostedt wrote:

Just calling attention to this...

> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 4db60b2..9f2d5b4 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -210,7 +210,11 @@ endif
>
> ifdef CONFIG_FTRACE_MCOUNT_RECORD
> ifdef BUILD_C_RECORDMCOUNT
> -cmd_record_mcount = $(objtree)/scripts/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;
> else
> cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
>

This is pretty much a hack, would adding a patch like the following be a
better idea?

-- Steve

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


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/