Re: [PATCH 26/27] kbuild: stop generating *.symversions

From: Masahiro Yamada
Date: Thu Apr 28 2022 - 00:48:32 EST


On Thu, Apr 28, 2022 at 12:15 PM Nicolas Schier <nicolas@xxxxxxxxx> wrote:
>
> 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@xxxxxxxxxx>
> > ---
> >
> > 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?


You are right.
I was also thinking of doing this directly in genksyms.
I will do it in v2.

bash supports 'set -o pipefail', but I do not know how
to do it in other shells.

I am also thinking of switching over to SHELL=/bin/bash,
but we cannot rely on bash'ism here yet.

--
Best Regards
Masahiro Yamada