Re: [patch 2/7] enable unit-at-a-time optimisations for gcc4

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

 



On Fri, Jan 06, 2006 at 02:02:57PM -0500, Jeff Garzik wrote:
> Arjan van de Ven wrote:
> >>Also why should we care so much for multi directory modules?
> >
> >
> >I suspect Jeff didn't mean it like that, but instead assumed that
> >multi-directory would be harder so that starting with single-directory
> >would be a good start...

The tricky part is to handle prerequisites correct.
I have made a very hackish version now and some observations.

- It is not easy to honour CFLAGS_<file.o> flags. And they will become
  used for all files
- If a single file is touched gcc will build all the source for the
  module. Not what you expect when touching a single file in fs/xfs/*
- needed to pass -nodefaultlibs to gcc to avoid linker errors - dunno
  why but it complained that it could not find -lgcc_s otherwise
- Gcc 3.4.4 at least compile the files individually, so not much seems
  gained.

Here is the changes so far...
This is not all all working, but I can compile xfs as a module with
this. But it recompiles everytime.

Do we really want this when it has the drawback that touching a single
file causes all of a module to be built?
It could be a <schrudder> CONFIG option....

	Sam


diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index c33e62b..aceab6b 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -281,16 +281,20 @@ endif
 #    <composite-object>-objs := <list of .o files>
 #  or
 #    <composite-object>-y    := <list of .o files>
-link_multi_deps =                     \
-$(filter $(addprefix $(obj)/,         \
-$($(subst $(obj)/,,$(@:.o=-objs)))    \
-$($(subst $(obj)/,,$(@:.o=-y)))), $^)
+find-src = $(foreach f, $1, $(wildcard $(f:.o=.c))) \
+           $(foreach f, $1, $(wildcard $(f:.o=.S)))
+
+link_multi_deps =  $(addprefix $(obj)/,         \
+                   $($(subst $(obj)/,,$(@:.o=-objs)))    \
+                   $($(subst $(obj)/,,$(@:.o=-y))))
  
 quiet_cmd_link_multi-y = LD      $@
 cmd_link_multi-y = $(LD) $(ld_flags) -r -o $@ $(link_multi_deps)
 
 quiet_cmd_link_multi-m = LD [M]  $@
-cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
+#cmd_link_multi-m = $(LD) $(ld_flags) $(LDFLAGS_MODULE) -o $@ $(link_multi_deps)
+cmd_link_multi-m = $(CC) -v -nodefaultlibs $(c_flags)  -Wl,-r -Wl,-melf_x86_64\
+                   -o $@ $(call find-src, $(link_multi_deps))
 
 # We would rather have a list of rules like
 # 	foo.o: $(foo-objs)
@@ -299,13 +303,12 @@ cmd_link_multi-m = $(LD) $(ld_flags) $(L
 $(multi-used-y) : %.o: $(multi-objs-y) FORCE
 	$(call if_changed,link_multi-y)
 
-$(multi-used-m) : %.o: $(multi-objs-m) FORCE
+$(multi-used-m) : % : $(call find-src,$(multi-objs-m)) FORCE
 	$(call if_changed,link_multi-m)
 	@{ echo $(@:.o=.ko); echo $(link_multi_deps); } > $(MODVERDIR)/$(@F:.o=.mod)
 
 targets += $(multi-used-y) $(multi-used-m)
 
-
 # Descending
 # ---------------------------------------------------------------------------
 


-
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