[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202108182005.AD31690E@keescook>
Date: Wed, 18 Aug 2021 20:06:00 -0700
From: Kees Cook <keescook@...omium.org>
To: Masahiro Yamada <masahiroy@...nel.org>
Cc: linux-kbuild@...r.kernel.org,
Sami Tolvanen <samitolvanen@...gle.com>,
linux-kernel@...r.kernel.org,
Michal Marek <michal.lkml@...kovi.net>,
Nathan Chancellor <nathan@...nel.org>,
Nick Desaulniers <ndesaulniers@...gle.com>,
clang-built-linux@...glegroups.com
Subject: Re: [PATCH 12/13] kbuild: merge cmd_modversions_c and
cmd_modversions_S
On Thu, Aug 19, 2021 at 09:57:43AM +0900, Masahiro Yamada wrote:
> Now cmd_modversions_c and cmd_modversions_S are similar.
>
> The latter uses $(OBJDUMP) -h, but it can be replaced with $(NM).
>
> $(NM) works for both ELF and LLVM bitcode (if $(NM) is llvm-nm).
>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
Ah yeah. That's nice consolidation.
Reviewed-by: Kees Cook <keescook@...omium.org>
-Kees
> ---
>
> scripts/Makefile.build | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 874e84a1f3fc..97392c26ebd7 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -166,13 +166,16 @@ ifdef CONFIG_MODVERSIONS
>
> # Generate .o.symversions files for each .o with exported symbols, and link these
> # to the kernel and/or modules at the end.
> -cmd_modversions_c = \
> +cmd_modversions = \
> if $(NM) $@ 2>/dev/null | grep -q __ksymtab; then \
> - $(call cmd_gensymtypes_c,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> + $(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> > $@...mversions; \
> else \
> rm -f $@...mversions; \
> fi;
> +
> +cmd_modversions_c = $(call cmd_modversions,c)
> +
> endif
>
> ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
> @@ -327,14 +330,8 @@ ifdef CONFIG_ASM_MODVERSIONS
>
> # versioning matches the C process described above, with difference that
> # we parse asm-prototypes.h C header to get function definitions.
> +cmd_modversions_S = $(call cmd_modversions,S)
>
> -cmd_modversions_S = \
> - if $(OBJDUMP) -h $@ | grep -q __ksymtab; then \
> - $(call cmd_gensymtypes_S,$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \
> - > $@...mversions; \
> - else \
> - rm -rf $@...mversions; \
> - fi
> endif
>
> $(obj)/%.o: $(src)/%.S $(objtool_dep) FORCE
> --
> 2.30.2
>
--
Kees Cook
Powered by blists - more mailing lists