public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist
@ 2024-11-11 17:17 Masahiro Yamada
  2024-11-11 17:17 ` [PATCH 2/2] kbuild: remove support for single %.symtypes build rule Masahiro Yamada
  2024-11-14 10:56 ` [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Nicolas Schier
  0 siblings, 2 replies; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-11 17:17 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

There is no need to pass '-r /dev/null', which is no-op.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/Makefile.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 8f423a1faf50..36eae845a3e3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -110,7 +110,7 @@ $(obj)/%.i: $(obj)/%.c FORCE
 genksyms = scripts/genksyms/genksyms		\
 	$(if $(1), -T $(2))			\
 	$(if $(KBUILD_PRESERVE), -p)		\
-	-r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)
+	$(addprefix -r , $(wildcard $(2:.symtypes=.symref)))
 
 # These mirror gensymtypes_S and co below, keep them in synch.
 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
-- 
2.43.0


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

* [PATCH 2/2] kbuild: remove support for single %.symtypes build rule
  2024-11-11 17:17 [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Masahiro Yamada
@ 2024-11-11 17:17 ` Masahiro Yamada
  2024-11-14 10:57   ` Nicolas Schier
  2024-11-14 10:56 ` [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Nicolas Schier
  1 sibling, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2024-11-11 17:17 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

This rule is unnecessary because you can generate foo/bar.symtypes
as a side effect using:

  $ make KBUILD_SYMTYPES=1 foo/bar.o

While compiling *.o is slower than preprocessing, the impact is
negligible. I prioritize keeping the code simpler.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 Makefile               |  2 +-
 scripts/Makefile.build | 20 +++-----------------
 2 files changed, 4 insertions(+), 18 deletions(-)

diff --git a/Makefile b/Makefile
index 8dceb6830486..93fe5d2d6861 100644
--- a/Makefile
+++ b/Makefile
@@ -276,7 +276,7 @@ no-dot-config-targets := $(clean-targets) \
 			 outputmakefile rustavailable rustfmt rustfmtcheck
 no-sync-config-targets := $(no-dot-config-targets) %install modules_sign kernelrelease \
 			  image_name
-single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %.symtypes %/
+single-targets := %.a %.i %.ko %.lds %.ll %.lst %.mod %.o %.rsi %.s %/
 
 config-build	:=
 mixed-build	:=
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 36eae845a3e3..1a0d3078dac7 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -108,19 +108,13 @@ $(obj)/%.i: $(obj)/%.c FORCE
 	$(call if_changed_dep,cpp_i_c)
 
 genksyms = scripts/genksyms/genksyms		\
-	$(if $(1), -T $(2))			\
+	$(if $(KBUILD_SYMTYPES), -T $(@:.o=.symtypes))	\
 	$(if $(KBUILD_PRESERVE), -p)		\
-	$(addprefix -r , $(wildcard $(2:.symtypes=.symref)))
+	$(addprefix -r , $(wildcard $(@:.o=.symref)))
 
 # These mirror gensymtypes_S and co below, keep them in synch.
 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
-
-$(obj)/%.symtypes : $(obj)/%.c FORCE
-	$(call cmd,cc_symtypes_c)
-
 # LLVM assembly
 # Generate .ll files from .c
 quiet_cmd_cc_ll_c = CC $(quiet_modtag)  $@
@@ -158,8 +152,7 @@ ifdef CONFIG_MODVERSIONS
 
 gen_symversions =								\
 	if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then		\
-		$(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
-			>> $(dot-target).cmd;					\
+		$(cmd_gensymtypes_$1) >> $(dot-target).cmd;			\
 	fi
 
 cmd_gen_symversions_c =	$(call gen_symversions,c)
@@ -323,13 +316,6 @@ cmd_gensymtypes_S =                                                         \
      $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/EXPORT_SYMBOL(\1);/p' ; } | \
     $(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
-
-$(obj)/%.symtypes : $(obj)/%.S FORCE
-	$(call cmd,cc_symtypes_S)
-
-
 quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@
 cmd_cpp_s_S       = $(CPP) $(a_flags) -o $@ $<
 
-- 
2.43.0


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

* Re: [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist
  2024-11-11 17:17 [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Masahiro Yamada
  2024-11-11 17:17 ` [PATCH 2/2] kbuild: remove support for single %.symtypes build rule Masahiro Yamada
@ 2024-11-14 10:56 ` Nicolas Schier
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Schier @ 2024-11-14 10:56 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Nathan Chancellor, linux-kernel

On Tue, Nov 12, 2024 at 02:17:40AM +0900, Masahiro Yamada wrote:
> There is no need to pass '-r /dev/null', which is no-op.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/Makefile.build | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 8f423a1faf50..36eae845a3e3 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -110,7 +110,7 @@ $(obj)/%.i: $(obj)/%.c FORCE
>  genksyms = scripts/genksyms/genksyms		\
>  	$(if $(1), -T $(2))			\
>  	$(if $(KBUILD_PRESERVE), -p)		\
> -	-r $(or $(wildcard $(2:.symtypes=.symref)), /dev/null)
> +	$(addprefix -r , $(wildcard $(2:.symtypes=.symref)))
>  
>  # These mirror gensymtypes_S and co below, keep them in synch.
>  cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms)
> -- 
> 2.43.0
> 

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

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

* Re: [PATCH 2/2] kbuild: remove support for single %.symtypes build rule
  2024-11-11 17:17 ` [PATCH 2/2] kbuild: remove support for single %.symtypes build rule Masahiro Yamada
@ 2024-11-14 10:57   ` Nicolas Schier
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Schier @ 2024-11-14 10:57 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Nathan Chancellor, linux-kernel

On Tue, Nov 12, 2024 at 02:17:41AM +0900, Masahiro Yamada wrote:
> This rule is unnecessary because you can generate foo/bar.symtypes
> as a side effect using:
> 
>   $ make KBUILD_SYMTYPES=1 foo/bar.o
> 
> While compiling *.o is slower than preprocessing, the impact is
> negligible. I prioritize keeping the code simpler.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  Makefile               |  2 +-
>  scripts/Makefile.build | 20 +++-----------------
>  2 files changed, 4 insertions(+), 18 deletions(-)

thanks, looks good to me.

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

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

end of thread, other threads:[~2024-11-14 10:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 17:17 [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Masahiro Yamada
2024-11-11 17:17 ` [PATCH 2/2] kbuild: remove support for single %.symtypes build rule Masahiro Yamada
2024-11-14 10:57   ` Nicolas Schier
2024-11-14 10:56 ` [PATCH 1/2] kbuild: do not pass -r to genksyms when *.symref does not exist Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox