Re: [PATCH 3/3] [pending] kbuild: make forbid sharing objects among multiple modules

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

 



On Sun 13 Nov 2022 20:15:25 GMT, Masahiro Yamada wrote:
> 
>  *** This patch is applicable after all the warnings are fixed.
>  *** It may take a couple of development cycles.
> 
> Now that all the warnings are fixed, the warning can be promoted to
> an error.
> 
> Simplify the modules.builtin rule because modname always consists of
> a single word.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> ---

Reviewed-by: Nicolas Schier <nicolas@xxxxxxxxx>

> 
>  scripts/Makefile.build     | 6 ------
>  scripts/Makefile.lib       | 8 ++++----
>  scripts/Makefile.vmlinux_o | 5 +----
>  3 files changed, 5 insertions(+), 14 deletions(-)
> 
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 799df12b53f3..37cf88d076e8 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -222,10 +222,6 @@ endif
>  
>  cmd_check_local_export = $(srctree)/scripts/check-local-export $@
>  
> -ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),)
> -cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi)))
> -endif
> -
>  define rule_cc_o_c
>  	$(call cmd_and_fixdep,cc_o_c)
>  	$(call cmd,gen_ksymdeps)
> @@ -235,7 +231,6 @@ define rule_cc_o_c
>  	$(call cmd,gen_objtooldep)
>  	$(call cmd,gen_symversions_c)
>  	$(call cmd,record_mcount)
> -	$(call cmd,warn_shared_object)
>  endef
>  
>  define rule_as_o_S
> @@ -244,7 +239,6 @@ define rule_as_o_S
>  	$(call cmd,check_local_export)
>  	$(call cmd,gen_objtooldep)
>  	$(call cmd,gen_symversions_S)
> -	$(call cmd,warn_shared_object)
>  endef
>  
>  # Built-in and composite module parts
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 3aa384cec76b..d73bfe0fabda 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -106,13 +106,13 @@ endif
>  
>  # Finds the multi-part object the current object will be linked into.
>  # If the object belongs to two or more multi-part objects, list them all.
> -modname-multi = $(sort $(foreach m,$(multi-obj-ym),\
> +__modname-multi = $(sort $(foreach m,$(multi-obj-ym),\
>  		$(if $(filter $*.o, $(call suffix-search, $m, .o, -objs -y -m)),$(m:.o=))))
>  
> -__modname = $(or $(modname-multi),$(basetarget))
> +modname-multi = $(if $(word 2, $(__modname-multi)), $(error $(kbuild-file): $*.o is added to multiple modules: $(__modname-multi)))$(__modname-multi)
>  
> -modname = $(subst $(space),:,$(__modname))
> -modfile = $(addprefix $(obj)/,$(__modname))
> +modname = $(or $(modname-multi),$(basetarget))
> +modfile = $(addprefix $(obj)/,$(modname))
>  
>  # target with $(obj)/ and its suffix stripped
>  target-stem = $(basename $(patsubst $(obj)/%,%,$@))
> diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o
> index 0edfdb40364b..2faf4960aa7a 100644
> --- a/scripts/Makefile.vmlinux_o
> +++ b/scripts/Makefile.vmlinux_o
> @@ -74,13 +74,10 @@ modules.builtin.modinfo: vmlinux.o FORCE
>  # module.builtin
>  # ---------------------------------------------------------------------------
>  
> -# The second line aids cases where multiple modules share the same object.
> -
>  quiet_cmd_modules_builtin = GEN     $@
>        cmd_modules_builtin = \
>  	tr '\0' '\n' < $< | \
> -	sed -n 's/^[[:alnum:]:_]*\.file=//p' | \
> -	tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@
> +	sed -n 's@^[[:alnum:]:_]*\.file=\(.*\)@kernel/\1.ko@p' | uniq > $@
>  
>  targets += modules.builtin
>  modules.builtin: modules.builtin.modinfo FORCE
> -- 
> 2.34.1

-- 
epost|xmpp: nicolas@xxxxxxxxx          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux