mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: Arjan van de Ven <arjan@infradead.org>,
	linux-kernel@vger.kernel.org, akpm@osdl.org, mingo@elte.hu
Subject: Re: [patch 2/7]  enable unit-at-a-time optimisations for gcc4
Date: Sat, 7 Jan 2006 00:56:01 +0100	[thread overview]
Message-ID: <20060106235601.GA26268@mars.ravnborg.org> (raw)
In-Reply-To: <43BEBEE1.6060500@pobox.com>

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
 # ---------------------------------------------------------------------------
 



  reply	other threads:[~2006-01-06 23:56 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-06 10:37 [patch 1/7] Make __always_inline actually force always inlining Arjan van de Ven
2006-01-06 10:38 ` [patch 2/7] enable unit-at-a-time optimisations for gcc4 Arjan van de Ven
2006-01-06 17:18   ` Jeff Garzik
2006-01-06 18:48     ` Sam Ravnborg
2006-01-06 19:00       ` Arjan van de Ven
2006-01-06 19:02         ` Jeff Garzik
2006-01-06 23:56           ` Sam Ravnborg [this message]
2006-01-07  0:05       ` Andi Kleen
2006-01-07  0:20         ` Matt Mackall
2006-01-07  1:11           ` Andi Kleen
2006-01-07  8:47         ` Sam Ravnborg
2006-01-07  9:07   ` Andrew Morton
2006-01-07 10:03     ` Sam Ravnborg
2006-01-07 10:13       ` Andrew Morton
2006-01-07 12:00         ` Sam Ravnborg
2006-01-06 10:39 ` [patch 3/7] mark several functions __always_inline Arjan van de Ven
2006-01-06 10:41 ` [patch 4/7] Mark some key VFS functions as __always_inline Arjan van de Ven
2006-01-06 10:50   ` Al Viro
2006-01-06 10:42 ` [patch 5/7] uninline capable() Arjan van de Ven
2006-01-06 11:18   ` Michael Buesch
2006-01-06 11:22     ` Arjan van de Ven
2006-01-06 11:26       ` Michael Buesch
2006-01-08  5:51         ` [PATCH 1/4] move capable() to capability.h Randy.Dunlap
2006-01-08  7:45           ` Valdis.Kletnieks
2006-01-08 13:48             ` Randy.Dunlap
2006-01-08 18:02             ` Tim Schmielau
2006-01-09  1:55               ` Randy.Dunlap
2006-01-08 18:15           ` Tim Schmielau
2006-01-08 19:03             ` Andrew Morton
2006-01-08 17:19     ` [patch 5/7] uninline capable() Tim Schmielau
2006-01-07  0:28   ` Matt Mackall
2006-01-06 10:43 ` [patch 6/7] Unlinline a bunch of other functions Arjan van de Ven
2006-01-06 12:11   ` [PATCH] pktcdvd: Un-inline some functions Peter Osterlund
2006-01-06 17:29   ` [patch 6/7] Unlinline a bunch of other functions Jeff Garzik
2006-01-07  6:28   ` Andrew Morton
2006-01-06 10:45 ` [patch 7/7] Make "inline" no longer mandatory for gcc 4.x Arjan van de Ven
2006-01-06 17:31   ` Jeff Garzik
2006-01-06 19:35     ` Arjan van de Ven
2006-01-07  6:33       ` Andrew Morton
2006-01-07  8:34         ` Arjan van de Ven
2006-01-07 19:05   ` Kurt Wall
2006-01-07 19:10     ` Arjan van de Ven
2006-01-07 19:44     ` Arjan van de Ven
2006-01-07 22:13       ` Kurt Wall
2006-01-08  3:16       ` Kurt Wall
2006-01-08  3:56         ` Mitchell Blank Jr
2006-01-08  7:14           ` Kurt Wall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060106235601.GA26268@mars.ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=akpm@osdl.org \
    --cc=arjan@infradead.org \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®