* [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S}
@ 2022-03-29 2:15 Masahiro Yamada
2022-03-29 2:15 ` [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly Masahiro Yamada
2022-03-29 18:17 ` [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Nick Desaulniers
0 siblings, 2 replies; 7+ messages in thread
From: Masahiro Yamada @ 2022-03-29 2:15 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Masahiro Yamada, Michal Marek, Nick Desaulniers
The genksyms command part in cmd_gensymtypes_{c,S} is duplicated.
Factor it out into the 'genksyms' macro.
For the readability, I slightly refactor the arguments to genksyms.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/Makefile.build | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 9717e6f6fb31..3f2985df4d60 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
$(obj)/%.i: $(src)/%.c FORCE
$(call if_changed_dep,cpp_i_c)
+genksyms = scripts/genksyms/genksyms \
+ $(if $(1), -T $(2)) \
+ $(if $(CONFIG_MODULE_REL_CRCS), -R) \
+ $(if $(KBUILD_PRESERVE), -p) \
+ -r $(or $(wildcard $(2:.symtypes=.symref), /dev/null))
+
# These mirror gensymtypes_S and co below, keep them in synch.
-cmd_gensymtypes_c = \
- $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
- scripts/genksyms/genksyms $(if $(1), -T $(2)) \
- $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
- $(if $(KBUILD_PRESERVE),-p) \
- -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
+cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
cmd_cc_symtypes_c = \
@@ -344,11 +345,7 @@ cmd_gensymtypes_S = \
$(CPP) $(a_flags) $< | \
grep "\<___EXPORT_SYMBOL\>" | \
sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
- $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
- scripts/genksyms/genksyms $(if $(1), -T $(2)) \
- $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
- $(if $(KBUILD_PRESERVE),-p) \
- -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
+ $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
cmd_cc_symtypes_S = \
--
2.32.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly
2022-03-29 2:15 [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Masahiro Yamada
@ 2022-03-29 2:15 ` Masahiro Yamada
2022-03-29 18:27 ` Nick Desaulniers
2022-03-29 18:17 ` [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Nick Desaulniers
1 sibling, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2022-03-29 2:15 UTC (permalink / raw)
To: linux-kbuild
Cc: linux-kernel, Masahiro Yamada, Michal Marek, Nick Desaulniers
Presumably, 'test -s $@ || rm -f $@' intends to remove the output when
the genksyms command fails.
It is unneeded because .DELETE_ON_ERROR automatically removes the output
on failure.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/Makefile.build | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 3f2985df4d60..974bb6435826 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -135,9 +135,7 @@ genksyms = scripts/genksyms/genksyms \
cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
-cmd_cc_symtypes_c = \
- $(call cmd_gensymtypes_c,true,$@) >/dev/null; \
- test -s $@ || rm -f $@
+ cmd_cc_symtypes_c = $(call cmd_gensymtypes_c,true,$@)
$(obj)/%.symtypes : $(src)/%.c FORCE
$(call cmd,cc_symtypes_c)
@@ -348,9 +346,7 @@ cmd_gensymtypes_S = \
$(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
-cmd_cc_symtypes_S = \
- $(call cmd_gensymtypes_S,true,$@) >/dev/null; \
- test -s $@ || rm -f $@
+ cmd_cc_symtypes_S = $(call cmd_gensymtypes_S,true,$@) >/dev/null
$(obj)/%.symtypes : $(src)/%.S FORCE
$(call cmd,cc_symtypes_S)
--
2.32.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S}
2022-03-29 2:15 [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Masahiro Yamada
2022-03-29 2:15 ` [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly Masahiro Yamada
@ 2022-03-29 18:17 ` Nick Desaulniers
2022-04-05 1:55 ` Masahiro Yamada
1 sibling, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2022-03-29 18:17 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel, Michal Marek
On Mon, Mar 28, 2022 at 7:15 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> The genksyms command part in cmd_gensymtypes_{c,S} is duplicated.
> Factor it out into the 'genksyms' macro.
>
> For the readability, I slightly refactor the arguments to genksyms.
Looks nicer, thanks for the patch!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> scripts/Makefile.build | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 9717e6f6fb31..3f2985df4d60 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
> $(obj)/%.i: $(src)/%.c FORCE
> $(call if_changed_dep,cpp_i_c)
>
> +genksyms = scripts/genksyms/genksyms \
> + $(if $(1), -T $(2)) \
> + $(if $(CONFIG_MODULE_REL_CRCS), -R) \
> + $(if $(KBUILD_PRESERVE), -p) \
> + -r $(or $(wildcard $(2:.symtypes=.symref), /dev/null))
> +
> # These mirror gensymtypes_S and co below, keep them in synch.
> -cmd_gensymtypes_c = \
> - $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
> - scripts/genksyms/genksyms $(if $(1), -T $(2)) \
> - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
> - $(if $(KBUILD_PRESERVE),-p) \
> - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
> +cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
>
> quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
> cmd_cc_symtypes_c = \
> @@ -344,11 +345,7 @@ cmd_gensymtypes_S = \
> $(CPP) $(a_flags) $< | \
> grep "\<___EXPORT_SYMBOL\>" | \
> sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
> - $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
> - scripts/genksyms/genksyms $(if $(1), -T $(2)) \
> - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
> - $(if $(KBUILD_PRESERVE),-p) \
> - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
> + $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
>
> quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
> cmd_cc_symtypes_S = \
> --
> 2.32.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly
2022-03-29 2:15 ` [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly Masahiro Yamada
@ 2022-03-29 18:27 ` Nick Desaulniers
2022-03-30 2:27 ` Masahiro Yamada
0 siblings, 1 reply; 7+ messages in thread
From: Nick Desaulniers @ 2022-03-29 18:27 UTC (permalink / raw)
To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel, Michal Marek
On Mon, Mar 28, 2022 at 7:15 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> Presumably, 'test -s $@ || rm -f $@' intends to remove the output when
> the genksyms command fails.
>
> It is unneeded because .DELETE_ON_ERROR automatically removes the output
> on failure.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> scripts/Makefile.build | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 3f2985df4d60..974bb6435826 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -135,9 +135,7 @@ genksyms = scripts/genksyms/genksyms \
> cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
>
> quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
> -cmd_cc_symtypes_c = \
> - $(call cmd_gensymtypes_c,true,$@) >/dev/null; \
> - test -s $@ || rm -f $@
> + cmd_cc_symtypes_c = $(call cmd_gensymtypes_c,true,$@)
Was it an accident that you removed the redirection of stdout to
/dev/null here, but not also below?
If quiet_modtag silences the output, perhaps the redirection should be
dropped below as well?
>
> $(obj)/%.symtypes : $(src)/%.c FORCE
> $(call cmd,cc_symtypes_c)
> @@ -348,9 +346,7 @@ cmd_gensymtypes_S = \
> $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
>
> quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
> -cmd_cc_symtypes_S = \
> - $(call cmd_gensymtypes_S,true,$@) >/dev/null; \
> - test -s $@ || rm -f $@
> + cmd_cc_symtypes_S = $(call cmd_gensymtypes_S,true,$@) >/dev/null
>
> $(obj)/%.symtypes : $(src)/%.S FORCE
> $(call cmd,cc_symtypes_S)
> --
> 2.32.0
>
--
Thanks,
~Nick Desaulniers
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly
2022-03-29 18:27 ` Nick Desaulniers
@ 2022-03-30 2:27 ` Masahiro Yamada
0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2022-03-30 2:27 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Michal Marek
On Wed, Mar 30, 2022 at 3:28 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Mon, Mar 28, 2022 at 7:15 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > Presumably, 'test -s $@ || rm -f $@' intends to remove the output when
> > the genksyms command fails.
> >
> > It is unneeded because .DELETE_ON_ERROR automatically removes the output
> > on failure.
> >
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> > scripts/Makefile.build | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index 3f2985df4d60..974bb6435826 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -135,9 +135,7 @@ genksyms = scripts/genksyms/genksyms \
> > cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
> >
> > quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
> > -cmd_cc_symtypes_c = \
> > - $(call cmd_gensymtypes_c,true,$@) >/dev/null; \
> > - test -s $@ || rm -f $@
> > + cmd_cc_symtypes_c = $(call cmd_gensymtypes_c,true,$@)
>
> Was it an accident that you removed the redirection of stdout to
> /dev/null here, but not also below?
It was an accident. I will fix it. Thanks.
> If quiet_modtag silences the output, perhaps the redirection should be
> dropped below as well?
>
> >
> > $(obj)/%.symtypes : $(src)/%.c FORCE
> > $(call cmd,cc_symtypes_c)
> > @@ -348,9 +346,7 @@ cmd_gensymtypes_S = \
> > $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
> >
> > quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
> > -cmd_cc_symtypes_S = \
> > - $(call cmd_gensymtypes_S,true,$@) >/dev/null; \
> > - test -s $@ || rm -f $@
> > + cmd_cc_symtypes_S = $(call cmd_gensymtypes_S,true,$@) >/dev/null
> >
> > $(obj)/%.symtypes : $(src)/%.S FORCE
> > $(call cmd,cc_symtypes_S)
> > --
> > 2.32.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S}
2022-03-29 18:17 ` [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Nick Desaulniers
@ 2022-04-05 1:55 ` Masahiro Yamada
2022-04-05 5:26 ` Masahiro Yamada
0 siblings, 1 reply; 7+ messages in thread
From: Masahiro Yamada @ 2022-04-05 1:55 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Michal Marek
On Wed, Mar 30, 2022 at 3:18 AM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Mon, Mar 28, 2022 at 7:15 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > The genksyms command part in cmd_gensymtypes_{c,S} is duplicated.
> > Factor it out into the 'genksyms' macro.
> >
> > For the readability, I slightly refactor the arguments to genksyms.
>
> Looks nicer, thanks for the patch!
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
> >
Applied to linux-kbuild.
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> > scripts/Makefile.build | 19 ++++++++-----------
> > 1 file changed, 8 insertions(+), 11 deletions(-)
> >
> > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > index 9717e6f6fb31..3f2985df4d60 100644
> > --- a/scripts/Makefile.build
> > +++ b/scripts/Makefile.build
> > @@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
> > $(obj)/%.i: $(src)/%.c FORCE
> > $(call if_changed_dep,cpp_i_c)
> >
> > +genksyms = scripts/genksyms/genksyms \
> > + $(if $(1), -T $(2)) \
> > + $(if $(CONFIG_MODULE_REL_CRCS), -R) \
> > + $(if $(KBUILD_PRESERVE), -p) \
> > + -r $(or $(wildcard $(2:.symtypes=.symref), /dev/null))
> > +
> > # These mirror gensymtypes_S and co below, keep them in synch.
> > -cmd_gensymtypes_c = \
> > - $(CPP) -D__GENKSYMS__ $(c_flags) $< | \
> > - scripts/genksyms/genksyms $(if $(1), -T $(2)) \
> > - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
> > - $(if $(KBUILD_PRESERVE),-p) \
> > - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
> > +cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
> >
> > quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@
> > cmd_cc_symtypes_c = \
> > @@ -344,11 +345,7 @@ cmd_gensymtypes_S = \
> > $(CPP) $(a_flags) $< | \
> > grep "\<___EXPORT_SYMBOL\>" | \
> > sed 's/.*___EXPORT_SYMBOL[[:space:]]*\([a-zA-Z0-9_]*\)[[:space:]]*,.*/EXPORT_SYMBOL(\1);/' ; } | \
> > - $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | \
> > - scripts/genksyms/genksyms $(if $(1), -T $(2)) \
> > - $(patsubst y,-R,$(CONFIG_MODULE_REL_CRCS)) \
> > - $(if $(KBUILD_PRESERVE),-p) \
> > - -r $(firstword $(wildcard $(2:.symtypes=.symref) /dev/null))
> > + $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms)
> >
> > quiet_cmd_cc_symtypes_S = SYM $(quiet_modtag) $@
> > cmd_cc_symtypes_S = \
> > --
> > 2.32.0
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S}
2022-04-05 1:55 ` Masahiro Yamada
@ 2022-04-05 5:26 ` Masahiro Yamada
0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2022-04-05 5:26 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Linux Kbuild mailing list, Linux Kernel Mailing List, Michal Marek
On Tue, Apr 5, 2022 at 10:55 AM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Wed, Mar 30, 2022 at 3:18 AM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > On Mon, Mar 28, 2022 at 7:15 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > >
> > > The genksyms command part in cmd_gensymtypes_{c,S} is duplicated.
> > > Factor it out into the 'genksyms' macro.
> > >
> > > For the readability, I slightly refactor the arguments to genksyms.
> >
> > Looks nicer, thanks for the patch!
> > Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
> >
> > >
>
> Applied to linux-kbuild.
No, this patch is wrong.
I will send v2 later.
>
>
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > ---
> > >
> > > scripts/Makefile.build | 19 ++++++++-----------
> > > 1 file changed, 8 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > > index 9717e6f6fb31..3f2985df4d60 100644
> > > --- a/scripts/Makefile.build
> > > +++ b/scripts/Makefile.build
> > > @@ -125,13 +125,14 @@ cmd_cpp_i_c = $(CPP) $(c_flags) -o $@ $<
> > > $(obj)/%.i: $(src)/%.c FORCE
> > > $(call if_changed_dep,cpp_i_c)
> > >
> > > +genksyms = scripts/genksyms/genksyms \
> > > + $(if $(1), -T $(2)) \
> > > + $(if $(CONFIG_MODULE_REL_CRCS), -R) \
> > > + $(if $(KBUILD_PRESERVE), -p) \
> > > + -r $(or $(wildcard $(2:.symtypes=.symref), /dev/null))
The position of the closing parenthesis was wrong.
-r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)
--
Best Regards
Masahiro Yamada
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-04-05 5:27 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-29 2:15 [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Masahiro Yamada
2022-03-29 2:15 ` [PATCH 2/2] kbuild: do not remove empty *.symtypes explicitly Masahiro Yamada
2022-03-29 18:27 ` Nick Desaulniers
2022-03-30 2:27 ` Masahiro Yamada
2022-03-29 18:17 ` [PATCH 1/2] kbuild: factor out genksyms command from cmd_gensymtypes_{c,S} Nick Desaulniers
2022-04-05 1:55 ` Masahiro Yamada
2022-04-05 5:26 ` Masahiro Yamada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.