mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
@ 2011-04-26 17:06 Rabin Vincent
  2011-05-11 17:30 ` Rabin Vincent
  0 siblings, 1 reply; 5+ messages in thread
From: Rabin Vincent @ 2011-04-26 17:06 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kernel, linux-kbuild, Rabin Vincent

Fix building with KBUILD_NOCMDDEP=1, which currently does not work
because it does not build built-in.o with no dependencies:

  LD      fs/notify/built-in.o
ld: cannot find fs/notify/dnotify/built-in.o: No such file or directory
ld: cannot find fs/notify/inotify/built-in.o: No such file or directory
ld: cannot find fs/notify/fanotify/built-in.o: No such file or directory

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 scripts/Kbuild.include |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index ed2773e..fd31781 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -187,6 +187,10 @@ ifneq ($(KBUILD_NOCMDDEP),1)
 # User may override this check using make KBUILD_NOCMDDEP=1
 arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
+else
+# Ensure that files with no dependencies are built.
+built-check = $(filter $(origin cmd_$@), undefined)
+arg-check = $(if $(strip $(obj-y)),,$(built-check))
 endif
 
 # >'< substitution is for echo to work,
-- 
1.7.4.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
  2011-04-26 17:06 [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o Rabin Vincent
@ 2011-05-11 17:30 ` Rabin Vincent
  2011-05-12 13:33   ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Rabin Vincent @ 2011-05-11 17:30 UTC (permalink / raw)
  To: mmarek; +Cc: linux-kernel, linux-kbuild, Rabin Vincent

On Tue, Apr 26, 2011 at 22:36, Rabin Vincent <rabin@rab.in> wrote:
> Fix building with KBUILD_NOCMDDEP=1, which currently does not work
> because it does not build built-in.o with no dependencies:
>
>  LD      fs/notify/built-in.o
> ld: cannot find fs/notify/dnotify/built-in.o: No such file or directory
> ld: cannot find fs/notify/inotify/built-in.o: No such file or directory
> ld: cannot find fs/notify/fanotify/built-in.o: No such file or directory
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Any comments on this patch?  I found KBUILD_NOCMDDEP useful
when hunting down a bug that appeared only in a certain compiler
version.  Used it to build some files using one compiler and the rest
using the other.  It would be nice if it worked out of the box; it will
after this patch.

> ---
>  scripts/Kbuild.include |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index ed2773e..fd31781 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -187,6 +187,10 @@ ifneq ($(KBUILD_NOCMDDEP),1)
>  # User may override this check using make KBUILD_NOCMDDEP=1
>  arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
>                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
> +else
> +# Ensure that files with no dependencies are built.
> +built-check = $(filter $(origin cmd_$@), undefined)
> +arg-check = $(if $(strip $(obj-y)),,$(built-check))
>  endif
>
>  # >'< substitution is for echo to work,
> --
> 1.7.4.1
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
  2011-05-11 17:30 ` Rabin Vincent
@ 2011-05-12 13:33   ` Michal Marek
  2011-05-15 17:37     ` Rabin Vincent
  0 siblings, 1 reply; 5+ messages in thread
From: Michal Marek @ 2011-05-12 13:33 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: linux-kernel, linux-kbuild

On Wed, May 11, 2011 at 11:00:01PM +0530, Rabin Vincent wrote:
> On Tue, Apr 26, 2011 at 22:36, Rabin Vincent <rabin@rab.in> wrote:
> > Fix building with KBUILD_NOCMDDEP=1, which currently does not work
> > because it does not build built-in.o with no dependencies:
> >
> >  LD      fs/notify/built-in.o
> > ld: cannot find fs/notify/dnotify/built-in.o: No such file or directory
> > ld: cannot find fs/notify/inotify/built-in.o: No such file or directory
> > ld: cannot find fs/notify/fanotify/built-in.o: No such file or directory
> >
> > Signed-off-by: Rabin Vincent <rabin@rab.in>
> 
> Any comments on this patch?  I found KBUILD_NOCMDDEP useful
> when hunting down a bug that appeared only in a certain compiler
> version.  Used it to build some files using one compiler and the rest
> using the other.  It would be nice if it worked out of the box; it will
> after this patch.

OK, so you have a use case for it. I was about to ask if it wouldn't be
easier to drop this feature instead :).

> 
> > ---
> >  scripts/Kbuild.include |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> >
> > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> > index ed2773e..fd31781 100644
> > --- a/scripts/Kbuild.include
> > +++ b/scripts/Kbuild.include
> > @@ -187,6 +187,10 @@ ifneq ($(KBUILD_NOCMDDEP),1)
> >  # User may override this check using make KBUILD_NOCMDDEP=1
> >  arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
> >                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
> > +else
> > +# Ensure that files with no dependencies are built.
> > +built-check = $(filter $(origin cmd_$@), undefined)
> > +arg-check = $(if $(strip $(obj-y)),,$(built-check))
> >  endif

I'm not sure if this is the rigt way to fix it. Kbuild.include should
not care about obj-*. The problem is that arg-check is always empty with
KBUILD_NOCMDDEP and if there are no other dependencies, the target will
not be created, right? IMO we only need to make sure that during the
first make run, arg-check always expands to non-empty, even with
KBUILD_NOCMDDEP. So we can drop the $(obj-y) test and do it like this
(untested), can't we?

diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index c034dd7..be39cd1 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -197,6 +197,8 @@ ifneq ($(KBUILD_NOCMDDEP),1)
 # User may override this check using make KBUILD_NOCMDDEP=1
 arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
+else
+arg-check = $(if $(strip $(cmd_$@)),,1)
 endif
 
 # >'< substitution is for echo to work,


while at it, we should also add KBUILD_NOCMDDEP to
Documentation/kbuild/kbuild.txt.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
  2011-05-12 13:33   ` Michal Marek
@ 2011-05-15 17:37     ` Rabin Vincent
  2011-05-16 14:44       ` Michal Marek
  0 siblings, 1 reply; 5+ messages in thread
From: Rabin Vincent @ 2011-05-15 17:37 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel, linux-kbuild

On Thu, May 12, 2011 at 19:03, Michal Marek <mmarek@suse.cz> wrote:
> I'm not sure if this is the rigt way to fix it. Kbuild.include should
> not care about obj-*. The problem is that arg-check is always empty with
> KBUILD_NOCMDDEP and if there are no other dependencies, the target will
> not be created, right? IMO we only need to make sure that during the
> first make run, arg-check always expands to non-empty, even with
> KBUILD_NOCMDDEP. So we can drop the $(obj-y) test and do it like this
> (untested), can't we?
>
> diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> index c034dd7..be39cd1 100644
> --- a/scripts/Kbuild.include
> +++ b/scripts/Kbuild.include
> @@ -197,6 +197,8 @@ ifneq ($(KBUILD_NOCMDDEP),1)
>  # User may override this check using make KBUILD_NOCMDDEP=1
>  arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
>                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
> +else
> +arg-check = $(if $(strip $(cmd_$@)),,1)
>  endif
>
>  # >'< substitution is for echo to work,

This works for me, thanks.

Tested-by: Rabin Vincent <rabin@rab.in>

> while at it, we should also add KBUILD_NOCMDDEP to
> Documentation/kbuild/kbuild.txt.

I will try to write up something for this.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o
  2011-05-15 17:37     ` Rabin Vincent
@ 2011-05-16 14:44       ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2011-05-16 14:44 UTC (permalink / raw)
  To: Rabin Vincent; +Cc: linux-kernel, linux-kbuild

On Sun, May 15, 2011 at 11:07:19PM +0530, Rabin Vincent wrote:
> On Thu, May 12, 2011 at 19:03, Michal Marek <mmarek@suse.cz> wrote:
> > I'm not sure if this is the rigt way to fix it. Kbuild.include should
> > not care about obj-*. The problem is that arg-check is always empty with
> > KBUILD_NOCMDDEP and if there are no other dependencies, the target will
> > not be created, right? IMO we only need to make sure that during the
> > first make run, arg-check always expands to non-empty, even with
> > KBUILD_NOCMDDEP. So we can drop the $(obj-y) test and do it like this
> > (untested), can't we?
> >
> > diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
> > index c034dd7..be39cd1 100644
> > --- a/scripts/Kbuild.include
> > +++ b/scripts/Kbuild.include
> > @@ -197,6 +197,8 @@ ifneq ($(KBUILD_NOCMDDEP),1)
> >  # User may override this check using make KBUILD_NOCMDDEP=1
> >  arg-check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \
> >                     $(filter-out $(cmd_$@),   $(cmd_$(1))) )
> > +else
> > +arg-check = $(if $(strip $(cmd_$@)),,1)
> >  endif
> >
> >  # >'< substitution is for echo to work,
> 
> This works for me, thanks.
> 
> Tested-by: Rabin Vincent <rabin@rab.in>

Thanks, pushed to kbuild-2.6.git#kbuild.

Michal

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-16 14:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-26 17:06 [PATCH] kbuild: make KBUILD_NOCMDDEP=1 handle empty built-in.o Rabin Vincent
2011-05-11 17:30 ` Rabin Vincent
2011-05-12 13:33   ` Michal Marek
2011-05-15 17:37     ` Rabin Vincent
2011-05-16 14:44       ` Michal Marek

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®