lkml.org 
[lkml]   [2021]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 06/13] kbuild: reuse $(cmd_objtool) for cmd_cc_lto_link_modules
On Fri, Sep 03, 2021 at 09:39:14AM +0900, Masahiro Yamada wrote:
> On Wed, Sep 1, 2021 at 2:35 AM Kees Cook <keescook@chromium.org> wrote:
> >
> > On Tue, Aug 31, 2021 at 04:39:57PM +0900, Masahiro Yamada wrote:
> > > For CONFIG_LTO_CLANG=y, the objtool processing is not possible at the
> > > compilation, hence postponed by the link time.
> > >
> > > Reuse $(cmd_objtool) for CONFIG_LTO_CLANG=y by defining objtool-enabled
> > > properly.
> > >
> > > For CONFIG_LTO_CLANG=y:
> > >
> > > objtool-enabled is off for %.o compilation
> > > objtool-enabled is on for %.lto link
> > >
> > > For CONFIG_LTO_CLANG=n:
> > >
> > > objtool-enabled is on for %.o compilation
> > > (but, it depends on OBJECT_FILE_NON_STANDARD)
> > >
> > > Set part-of-module := y for %.lto.o to avoid repeating --module.
> > >
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > ---
> > >
> > > scripts/Makefile.build | 28 +++++++++++++++++-----------
> > > 1 file changed, 17 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> > > index 21b55f37a23f..afc906cd7256 100644
> > > --- a/scripts/Makefile.build
> > > +++ b/scripts/Makefile.build
> > > @@ -236,20 +236,26 @@ objtool_args = \
> > > $(if $(CONFIG_X86_SMAP), --uaccess) \
> > > $(if $(CONFIG_FTRACE_MCOUNT_USE_OBJTOOL), --mcount)
> > >
> > > -ifndef CONFIG_LTO_CLANG
> > > +cmd_objtool = $(if $(objtool-enabled), ; $(objtool) $(objtool_args) $@)
> > > +cmd_gen_objtooldep = $(if $(objtool-enabled), { echo ; echo '$@: $$(wildcard $(objtool))' ; } >> $(dot-target).cmd)
> > > +
> > > +endif # CONFIG_STACK_VALIDATION
> > > +
> > > +ifdef CONFIG_LTO_CLANG
> > > +
> > > +# Skip objtool for LLVM bitcode
> > > +$(obj)/%o: objtool-enabled :=
> >
> > Is this intentionally "%o" instead of "%.o"?
>
> Good catch.
>
> No, it is not intentional.
>
> I will fix "%o" to "%.o"

Ah-ha, okay, excellent. :) With that:

Reviewed-by: Kees Cook <keescook@chromium.org>

Thanks!

-Kees

>
>
> > (And it later overridden by the "%.lto.o" rule?
>
> No, opposite.
>
> While building %.lto.o, we want to set objtool-enabled.
> But, we want to cancel it for %.o
>
>
>
>
> --
> Best Regards
> Masahiro Yamada
>
> --
> You received this message because you are subscribed to the Google Groups "Clang Built Linux" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to clang-built-linux+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/clang-built-linux/CAK7LNATkducKiw8%3D%3Du4477JGfyb5vnvbp2gM2s9ndZ_8owXfeg%40mail.gmail.com.

--
Kees Cook

\
 
 \ /
  Last update: 2021-09-03 03:49    [W:0.074 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site