Re: Build system runs ld more often than needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 27, 2006 at 02:38:48PM +0200, Jean Delvare wrote:
> Hi Sam,
> 
> I have noticed the following problem:
> 
> khali@arrakis:~/src/linux-2.6.16-git> make modules
>   CHK     include/linux/version.h
>   Building modules, stage 2.
>   MODPOST
> khali@arrakis:~/src/linux-2.6.16-git> touch drivers/media/video/zoran_card.c 
> khali@arrakis:~/src/linux-2.6.16-git> make modules
>   CHK     include/linux/version.h
>   CC [M]  drivers/media/video/zoran_card.o
>   LD [M]  drivers/media/video/zr36067.o
>   LD [M]  drivers/media/video/msp3400.o
>   LD [M]  drivers/media/video/tuner.o
>   Building modules, stage 2.
>   MODPOST
>   LD [M]  drivers/media/video/msp3400.ko
>   LD [M]  drivers/media/video/tuner.ko
>   LD [M]  drivers/media/video/zr36067.ko
> khali@arrakis:~/src/linux-2.6.16-git>
> 
> See how unrelated modules are linked again?

This is an unfortunate side-effect. Following snippet from
scripts/Makfile.build explains it:

# We would rather have a list of rules like
# 	foo.o: $(foo-objs)
# but that's not so easy, so we rather make all composite objects depend
# on the set of all their parts
$(multi-used-y) : %.o: $(multi-objs-y) FORCE
	$(call if_changed,link_multi-y)

The problem is that we have no easy way to say that this specific
module depends on this list of .o files.
With make 3.81 this would be possible utilising $(eval ...),
but the benefit is too low to introduce such a dependency.

> 
> I investigated further and it seems to happen whenever a given Makefile
> has more than one composite object definition. In the case of
> drivers/media/video, the following composite objects are defined:
> 
> zoran-objs      :=	zr36120.o zr36120_i2c.o zr36120_mem.o
> zr36067-objs	:=	zoran_procfs.o zoran_device.o \
> 			zoran_driver.o zoran_card.o
> tuner-objs	:=	tuner-core.o tuner-types.o tuner-simple.o \
> 			mt20xx.o tda8290.o tea5767.o
> 
> msp3400-objs	:=	msp3400-driver.o msp3400-kthreads.o
> 
> I have the following enabled:
> 
> CONFIG_VIDEO_MSP3400=m
> CONFIG_VIDEO_ZORAN=m
> CONFIG_VIDEO_TUNER=m
> 
> So msp3400 and tuner are relinked whenever I make a change to the
> zr36067 driver.

You could do:
make drivers/media/video/zr36067.ko
to avoid linking the others.

But kbuild will unfortunately link to much modules for a normal build.

One day I may try to generate one big Makefile and then it could
be addressed but I have yet to find 'the' reason to invest time in that
task.

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux