* [PATCH] kbuild: let object files depend on recordmcount instead of its sources
@ 2011-10-07 13:19 Uwe Kleine-König
2011-10-07 16:31 ` Steven Rostedt
2011-10-07 19:47 ` Uwe Kleine-König
0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2011-10-07 13:19 UTC (permalink / raw)
To: Steven Rostedt, Michal Marek; +Cc: linux-kernel, linux-kbuild
This has the upside that distributions only have to ship the recordmcount
binary to allow building modules instead of recordmcount and it's sources.
Make still notices that the object files need to be rebuilt when
recordmcount's sources change.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
scripts/Makefile.build | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index a0fd502..bc83e94 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -271,8 +271,7 @@ sub_cmd_record_mcount = \
if [ $(@) != "scripts/mod/empty.o" ]; then \
$(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \
fi;
-recordmcount_source := $(srctree)/scripts/recordmcount.c \
- $(srctree)/scripts/recordmcount.h
+recordmcount_exec := $(objtree)/scripts/recordmcount
else
sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
"$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
@@ -280,7 +279,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
"$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
"$(LD)" "$(NM)" "$(RM)" "$(MV)" \
"$(if $(part-of-module),1,0)" "$(@)";
-recordmcount_source := $(srctree)/scripts/recordmcount.pl
+recordmcount_exec := $(srctree)/scripts/recordmcount.pl
endif
cmd_record_mcount = \
if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
@@ -301,13 +300,13 @@ define rule_cc_o_c
endef
# Built-in and composite module parts
-$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
+$(obj)/%.o: $(src)/%.c $(recordmcount_exec) FORCE
$(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)
# Single-part modules are special since we need to mark them in $(MODVERDIR)
-$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
+$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_exec) FORCE
$(call cmd,force_checksrc)
$(call if_changed_rule,cc_o_c)
@{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
--
1.7.6.3
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: let object files depend on recordmcount instead of its sources
2011-10-07 13:19 [PATCH] kbuild: let object files depend on recordmcount instead of its sources Uwe Kleine-König
@ 2011-10-07 16:31 ` Steven Rostedt
2011-10-07 18:04 ` Uwe Kleine-König
2011-10-07 19:47 ` Uwe Kleine-König
1 sibling, 1 reply; 6+ messages in thread
From: Steven Rostedt @ 2011-10-07 16:31 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Michal Marek, linux-kernel, linux-kbuild
On Fri, 2011-10-07 at 15:19 +0200, Uwe Kleine-König wrote:
> This has the upside that distributions only have to ship the recordmcount
> binary to allow building modules instead of recordmcount and it's sources.
>
> Make still notices that the object files need to be rebuilt when
> recordmcount's sources change.
This doesn't work. Try it on a clean build:
HOSTCC scripts/basic/fixdep
GEN /home/rostedt/work/git/tmp/Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --silentoldconfig Kconfig
Using /home/rostedt/work/git/linux-rt.git as source for kernel
GEN /home/rostedt/work/git/tmp/Makefile
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL /home/rostedt/work/git/linux-rt.git/scripts/checksyscalls.sh
make[3]: *** No rule to make target `scripts/mod/empty.o', needed by `scripts/mod/elfconfig.h'. Stop.
make[2]: *** [scripts/mod] Error 2
make[1]: *** [scripts] Error 2
make: *** [sub-make] Error 2
-- Steve
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> scripts/Makefile.build | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index a0fd502..bc83e94 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -271,8 +271,7 @@ sub_cmd_record_mcount = \
> if [ $(@) != "scripts/mod/empty.o" ]; then \
> $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \
> fi;
> -recordmcount_source := $(srctree)/scripts/recordmcount.c \
> - $(srctree)/scripts/recordmcount.h
> +recordmcount_exec := $(objtree)/scripts/recordmcount
> else
> sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
> @@ -280,7 +279,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
> "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
> "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
> "$(if $(part-of-module),1,0)" "$(@)";
> -recordmcount_source := $(srctree)/scripts/recordmcount.pl
> +recordmcount_exec := $(srctree)/scripts/recordmcount.pl
> endif
> cmd_record_mcount = \
> if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
> @@ -301,13 +300,13 @@ define rule_cc_o_c
> endef
>
> # Built-in and composite module parts
> -$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
> +$(obj)/%.o: $(src)/%.c $(recordmcount_exec) FORCE
> $(call cmd,force_checksrc)
> $(call if_changed_rule,cc_o_c)
>
> # Single-part modules are special since we need to mark them in $(MODVERDIR)
>
> -$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
> +$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_exec) FORCE
> $(call cmd,force_checksrc)
> $(call if_changed_rule,cc_o_c)
> @{ echo $(@:.o=.ko); echo $@; } > $(MODVERDIR)/$(@F:.o=.mod)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: let object files depend on recordmcount instead of its sources
2011-10-07 16:31 ` Steven Rostedt
@ 2011-10-07 18:04 ` Uwe Kleine-König
2011-10-07 18:52 ` Steven Rostedt
0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2011-10-07 18:04 UTC (permalink / raw)
To: Steven Rostedt; +Cc: Michal Marek, linux-kernel, linux-kbuild
On Fri, Oct 07, 2011 at 12:31:33PM -0400, Steven Rostedt wrote:
> On Fri, 2011-10-07 at 15:19 +0200, Uwe Kleine-König wrote:
> > This has the upside that distributions only have to ship the recordmcount
> > binary to allow building modules instead of recordmcount and it's sources.
> >
> > Make still notices that the object files need to be rebuilt when
> > recordmcount's sources change.
>
> This doesn't work. Try it on a clean build:
>
> HOSTCC scripts/basic/fixdep
> GEN /home/rostedt/work/git/tmp/Makefile
> HOSTCC scripts/kconfig/conf.o
> SHIPPED scripts/kconfig/zconf.tab.c
> SHIPPED scripts/kconfig/lex.zconf.c
> SHIPPED scripts/kconfig/zconf.hash.c
> HOSTCC scripts/kconfig/zconf.tab.o
> HOSTLD scripts/kconfig/conf
> scripts/kconfig/conf --silentoldconfig Kconfig
> Using /home/rostedt/work/git/linux-rt.git as source for kernel
> GEN /home/rostedt/work/git/tmp/Makefile
> CHK include/linux/version.h
> UPD include/linux/version.h
> CHK include/generated/utsrelease.h
> UPD include/generated/utsrelease.h
> CC kernel/bounds.s
> GEN include/generated/bounds.h
> CC arch/x86/kernel/asm-offsets.s
> GEN include/generated/asm-offsets.h
> CALL /home/rostedt/work/git/linux-rt.git/scripts/checksyscalls.sh
> make[3]: *** No rule to make target `scripts/mod/empty.o', needed by `scripts/mod/elfconfig.h'. Stop.
> make[2]: *** [scripts/mod] Error 2
> make[1]: *** [scripts] Error 2
> make: *** [sub-make] Error 2
Works for me with 3ee72ca + my patch doing:
make -C /path/to/my/linux/src/dir defconfig O=$(pwd)
make -j 6
If you tell me your exact setup I'll try to reproduce and fix.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: let object files depend on recordmcount instead of its sources
2011-10-07 18:04 ` Uwe Kleine-König
@ 2011-10-07 18:52 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2011-10-07 18:52 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Michal Marek, linux-kernel, linux-kbuild
On Fri, 2011-10-07 at 20:04 +0200, Uwe Kleine-König wrote:
> Works for me with 3ee72ca + my patch doing:
>
> make -C /path/to/my/linux/src/dir defconfig O=$(pwd)
> make -j 6
>
> If you tell me your exact setup I'll try to reproduce and fix.
I just tried again with the same results. Here:
$ cd git
$ git clone nobackup/linus.git -s -l tmp.git
Cloning into tmp.git...
done.
$ cd tmp.git/
$ mkdir /tmp/build
$ patch -p1 < /tmp/rm.patch
patching file scripts/Makefile.build
$ make O=/tmp/build allyesconfig
HOSTCC scripts/basic/fixdep
GEN /tmp/build/Makefile
HOSTCC scripts/kconfig/conf.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/zconf.lex.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf --allyesconfig Kconfig
#
# configuration written to .config
#
$ make O=/tmp/build
GEN /tmp/build/Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
/home/pub/git/tmp.git/arch/x86/Makefile:81: stack protector enabled but
no compiler support
Using /home/pub/git/tmp.git as source for kernel
GEN /tmp/build/Makefile
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/generated/utsrelease.h
UPD include/generated/utsrelease.h
CC kernel/bounds.s
GEN include/generated/bounds.h
CC arch/x86/kernel/asm-offsets.s
GEN include/generated/asm-offsets.h
CALL /home/pub/git/tmp.git/scripts/checksyscalls.sh
HOSTCC scripts/genksyms/genksyms.o
SHIPPED scripts/genksyms/lex.lex.c
SHIPPED scripts/genksyms/keywords.hash.c
SHIPPED scripts/genksyms/parse.tab.h
HOSTCC scripts/genksyms/lex.lex.o
SHIPPED scripts/genksyms/parse.tab.c
HOSTCC scripts/genksyms/parse.tab.o
HOSTLD scripts/genksyms/genksyms
make[3]: *** No rule to make target `scripts/mod/empty.o', needed by
`scripts/mod/elfconfig.h'. Stop.
make[2]: *** [scripts/mod] Error 2
make[1]: *** [scripts] Error 2
make: *** [sub-make] Error 2
It needs to be a real clean repo, not a make clean.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: let object files depend on recordmcount instead of its sources
2011-10-07 13:19 [PATCH] kbuild: let object files depend on recordmcount instead of its sources Uwe Kleine-König
2011-10-07 16:31 ` Steven Rostedt
@ 2011-10-07 19:47 ` Uwe Kleine-König
2011-10-07 20:00 ` Steven Rostedt
1 sibling, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2011-10-07 19:47 UTC (permalink / raw)
To: Steven Rostedt, Michal Marek; +Cc: linux-kernel, linux-kbuild
Hello,
On Fri, Oct 07, 2011 at 03:19:21PM +0200, Uwe Kleine-König wrote:
> This has the upside that distributions only have to ship the recordmcount
> binary to allow building modules instead of recordmcount and it's sources.
>
> Make still notices that the object files need to be rebuilt when
> recordmcount's sources change.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> scripts/Makefile.build | 9 ++++-----
> 1 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index a0fd502..bc83e94 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -271,8 +271,7 @@ sub_cmd_record_mcount = \
> if [ $(@) != "scripts/mod/empty.o" ]; then \
> $(objtree)/scripts/recordmcount $(RECORDMCOUNT_FLAGS) "$(@)"; \
> fi;
> -recordmcount_source := $(srctree)/scripts/recordmcount.c \
> - $(srctree)/scripts/recordmcount.h
> +recordmcount_exec := $(objtree)/scripts/recordmcount
> else
> sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH)" \
> "$(if $(CONFIG_CPU_BIG_ENDIAN),big,little)" \
> @@ -280,7 +279,7 @@ sub_cmd_record_mcount = set -e ; perl $(srctree)/scripts/recordmcount.pl "$(ARCH
> "$(OBJDUMP)" "$(OBJCOPY)" "$(CC) $(KBUILD_CFLAGS)" \
> "$(LD)" "$(NM)" "$(RM)" "$(MV)" \
> "$(if $(part-of-module),1,0)" "$(@)";
> -recordmcount_source := $(srctree)/scripts/recordmcount.pl
> +recordmcount_exec := $(srctree)/scripts/recordmcount.pl
> endif
> cmd_record_mcount = \
> if [ "$(findstring -pg,$(_c_flags))" = "-pg" ]; then \
> @@ -301,13 +300,13 @@ define rule_cc_o_c
> endef
>
> # Built-in and composite module parts
> -$(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
> +$(obj)/%.o: $(src)/%.c $(recordmcount_exec) FORCE
> $(call cmd,force_checksrc)
> $(call if_changed_rule,cc_o_c)
I could reproduce the build failure Steve is seeing now (enabling
CONFIG_FUNCTION_TRACER helps, stupid me). I think the problem is that
with my change empty.o depends on recordmcount and in a way that I don't
understand recordmcount depends on empty.o. I wonder if it's possible to
get rid of the latter dependency?!
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] kbuild: let object files depend on recordmcount instead of its sources
2011-10-07 19:47 ` Uwe Kleine-König
@ 2011-10-07 20:00 ` Steven Rostedt
0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2011-10-07 20:00 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Michal Marek, linux-kernel, linux-kbuild
On Fri, 2011-10-07 at 21:47 +0200, Uwe Kleine-König wrote:
> I could reproduce the build failure Steve is seeing now (enabling
> CONFIG_FUNCTION_TRACER helps, stupid me). I think the problem is that
> with my change empty.o depends on recordmcount and in a way that I don't
> understand recordmcount depends on empty.o. I wonder if it's possible to
> get rid of the latter dependency?!
It may be possible but probably not worth it. When I stumbled on empty.o
I talked with some of the kbuild folks, and IIRC, it is pretty core to
the dependency structure. Changing it may break other things easily.
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-10-07 20:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-07 13:19 [PATCH] kbuild: let object files depend on recordmcount instead of its sources Uwe Kleine-König
2011-10-07 16:31 ` Steven Rostedt
2011-10-07 18:04 ` Uwe Kleine-König
2011-10-07 18:52 ` Steven Rostedt
2011-10-07 19:47 ` Uwe Kleine-König
2011-10-07 20:00 ` Steven Rostedt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®