From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53ACEC433F5 for ; Fri, 3 Sep 2021 00:40:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 27A9F60F90 for ; Fri, 3 Sep 2021 00:40:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345689AbhICAlN (ORCPT ); Thu, 2 Sep 2021 20:41:13 -0400 Received: from conssluserg-02.nifty.com ([210.131.2.81]:30496 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238860AbhICAlL (ORCPT ); Thu, 2 Sep 2021 20:41:11 -0400 Received: from mail-pg1-f178.google.com (mail-pg1-f178.google.com [209.85.215.178]) (authenticated) by conssluserg-02.nifty.com with ESMTP id 1830dpfU020723; Fri, 3 Sep 2021 09:39:51 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com 1830dpfU020723 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1630629592; bh=1Y6XFgB9/D7mjEiysoImroDcHiCWsyF8Liocy0ZJmiw=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=l29+RcAmQyS/huREVYv7UUXZT0hnO9UqzEujgTND96AUt5CRF/JlgQi+Xsjvocrd1 N6xe77cP39v3f6RoWjEKH4kKSk973gCgM2eKAXIalYoyGR/08SzEn/mJp4DIrXF4yp HpbpnICOoy9knu0z5JmiQuLwvBejcN7ED/s4hKhpDrf2i0l3duAdHHYelsIq58JKqF xHIVYANXkwIZ3wgFvabcR3o9yiWysEV3qxqBW/RMRtshdoS+eHc/5dUqltJSDrcaQa DbV0odkBPqvTflQBGE9tLBXTu0FkxgaxbZspIxZuuPYrjZbfQHgSxONj+YN2PtTCyq 2DxUAjLnWmIHw== X-Nifty-SrcIP: [209.85.215.178] Received: by mail-pg1-f178.google.com with SMTP id e7so3836973pgk.2; Thu, 02 Sep 2021 17:39:51 -0700 (PDT) X-Gm-Message-State: AOAM533uGroDCCyUTEmU+kT+cRdSyzKhm+nUsMxRzuLMr885fVZXgGH5 YNW4SzdMsERsTLtewnoZsT2WloPc7kgE5plk/es= X-Google-Smtp-Source: ABdhPJwzGYK4C5mlWmXEBMlp5fYhPEu8sKt5Gfs99DD7/XU6ShATFMOMttNOuk1lZQhNUYUZGpV1RJS5uaqcmAdlGv0= X-Received: by 2002:a63:d40a:: with SMTP id a10mr1047510pgh.7.1630629590936; Thu, 02 Sep 2021 17:39:50 -0700 (PDT) MIME-Version: 1.0 References: <20210831074004.3195284-1-masahiroy@kernel.org> <20210831074004.3195284-7-masahiroy@kernel.org> <202108311034.D4B1410@keescook> In-Reply-To: <202108311034.D4B1410@keescook> From: Masahiro Yamada Date: Fri, 3 Sep 2021 09:39:14 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 06/13] kbuild: reuse $(cmd_objtool) for cmd_cc_lto_link_modules To: Kees Cook Cc: Linux Kbuild mailing list , Michal Marek , Nathan Chancellor , Nick Desaulniers , clang-built-linux , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 1, 2021 at 2:35 AM Kees Cook 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 > > --- > > > > 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" > (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