lkml.org 
[lkml]   [2022]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 26/27] kbuild: stop generating *.symversions
On Mon 25 Apr 2022 04:08:10 GMT Masahiro Yamada wrote:
> Now *.symversions is unneeded. Clean up the Makefile and script.
>
> I will keep *.symversions in .gitignore and 'make clean' for a while
> to avoid flooding the output from 'git status'.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
>
> scripts/Makefile.build | 28 ++++------------------------
> scripts/link-vmlinux.sh | 19 -------------------
> 2 files changed, 4 insertions(+), 43 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index aadc16e04632..7f199b0a5170 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -170,12 +170,9 @@ ifdef CONFIG_MODVERSIONS
> # to the kernel and/or modules at the end.
> gen_symversions = \
> if $(NM) $@ 2>/dev/null | grep -q __ksymtab; then \
> - $(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> - > $@.symversions; \
> echo >> $(dot-target).cmd ; \
> - sed 's/\(.*\) = \(.*\);/$(pound)\1=\2/' $@.symversions >> $(dot-target).cmd ; \
> - else \
> - rm -f $@.symversions; \
> + $(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) | \
> + sed 's/\(.*\) = \(.*\);/$(pound)\1=\2/' >> $(dot-target).cmd ; \

I was wondering, whether we should integrate the 'sed' part into
genksyms and make it output the lines as we need them.
If genksyms fails, we now don't see any error code and make will
silently continue as the pipe hides genksyms' exit code, right?

> fi
>
> cmd_gen_symversions_c = $(call gen_symversions,c)
> @@ -391,17 +388,6 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 $(objtree)/scripts/asn1_compiler
> $(subdir-builtin): $(obj)/%/built-in.a: $(obj)/% ;
> $(subdir-modorder): $(obj)/%/modules.order: $(obj)/% ;
>
> -# combine symversions for later processing
> -ifeq ($(CONFIG_LTO_CLANG) $(CONFIG_MODVERSIONS),y y)
> - cmd_update_lto_symversions = \
> - rm -f $@.symversions \
> - $(foreach n, $(filter-out FORCE,$^), \
> - $(if $(shell test -s $(n).symversions && echo y), \
> - ; cat $(n).symversions >> $@.symversions))
> -else
> - cmd_update_lto_symversions = echo >/dev/null
> -endif
> -
> #
> # Rule to compile a set of .o files into one .a file (without symbol table)
> #
> @@ -409,11 +395,8 @@ endif
> quiet_cmd_ar_builtin = AR $@
> cmd_ar_builtin = rm -f $@; $(AR) cDPrST $@ $(real-prereqs)
>
> -quiet_cmd_ar_and_symver = AR $@
> - cmd_ar_and_symver = $(cmd_update_lto_symversions); $(cmd_ar_builtin)
> -
> $(obj)/built-in.a: $(real-obj-y) FORCE
> - $(call if_changed,ar_and_symver)
> + $(call if_changed,ar_builtin)
>
> #
> # Rule to create modules.order file
> @@ -433,16 +416,13 @@ $(obj)/modules.order: $(obj-m) FORCE
> #
> # Rule to compile a set of .o files into one .a file (with symbol table)
> #
> -quiet_cmd_ar_lib = AR $@
> - cmd_ar_lib = $(cmd_update_lto_symversions); $(cmd_ar)
>
> $(obj)/lib.a: $(lib-y) FORCE
> - $(call if_changed,ar_lib)
> + $(call if_changed,ar)
>
> ifneq ($(CONFIG_LTO_CLANG)$(CONFIG_X86_KERNEL_IBT),)
> quiet_cmd_link_multi-m = AR [M] $@
> cmd_link_multi-m = \
> - $(cmd_update_lto_symversions); \
> rm -f $@; \
> $(AR) cDPrsT $@ @$(patsubst %.o,%.mod,$@)
> else
> diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
> index 66a115f204eb..e2900d3bd215 100755
> --- a/scripts/link-vmlinux.sh
> +++ b/scripts/link-vmlinux.sh
> @@ -56,20 +56,6 @@ gen_initcalls()
> > .tmp_initcalls.lds
> }
>
> -# If CONFIG_LTO_CLANG is selected, collect generated symbol versions into
> -# .tmp_symversions.lds
> -gen_symversions()
> -{
> - info GEN .tmp_symversions.lds
> - rm -f .tmp_symversions.lds
> -
> - for o in ${KBUILD_VMLINUX_OBJS} ${KBUILD_VMLINUX_LIBS}; do
> - if [ -f ${o}.symversions ]; then
> - cat ${o}.symversions >> .tmp_symversions.lds
> - fi
> - done
> -}
> -
> # Link of vmlinux.o used for section mismatch analysis
> # ${1} output file
> modpost_link()
> @@ -88,10 +74,6 @@ modpost_link()
> gen_initcalls
> lds="-T .tmp_initcalls.lds"
>
> - if is_enabled CONFIG_MODVERSIONS; then
> - gen_symversions
> - fi
> -
> # This might take a while, so indicate that we're doing
> # an LTO link
> info LTO ${1}
> @@ -306,7 +288,6 @@ cleanup()
> rm -f .btf.*
> rm -f .tmp_System.map
> rm -f .tmp_initcalls.lds
> - rm -f .tmp_symversions.lds
> rm -f .tmp_vmlinux*
> rm -f System.map
> rm -f vmlinux
> --
> 2.32.0

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

\
 
 \ /
  Last update: 2022-04-28 05:21    [W:0.632 / U:0.636 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site