From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403837AbgFXV3J (ORCPT ); Wed, 24 Jun 2020 17:29:09 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA67DC0613ED for ; Wed, 24 Jun 2020 14:29:09 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id t6so2095490pgq.1 for ; Wed, 24 Jun 2020 14:29:09 -0700 (PDT) Date: Wed, 24 Jun 2020 14:29:02 -0700 From: Sami Tolvanen Subject: Re: [PATCH 02/22] kbuild: add support for Clang LTO Message-ID: <20200624212902.GA26253@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200624203200.78870-3-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kbuild-owner@vger.kernel.org List-ID: To: Nick Desaulniers Cc: Masahiro Yamada , Will Deacon , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , clang-built-linux , Kernel Hardening , linux-arch , Linux ARM , Linux Kbuild mailing list , LKML , linux-pci@vger.kernel.org, "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" On Wed, Jun 24, 2020 at 01:53:52PM -0700, Nick Desaulniers wrote: > On Wed, Jun 24, 2020 at 1:32 PM Sami Tolvanen wrote: > > > > diff --git a/Makefile b/Makefile > > index ac2c61c37a73..0c7fe6fb2143 100644 > > --- a/Makefile > > +++ b/Makefile > > @@ -886,6 +886,22 @@ KBUILD_CFLAGS += $(CC_FLAGS_SCS) > > export CC_FLAGS_SCS > > endif > > > > +ifdef CONFIG_LTO_CLANG > > +ifdef CONFIG_THINLTO > > +CC_FLAGS_LTO_CLANG := -flto=thin $(call cc-option, -fsplit-lto-unit) > > The kconfig change gates this on clang-11; do we still need the > cc-option check here, or can we hardcode the use of -fsplit-lto-unit? > Playing with the flag in godbolt, it looks like clang-8 had support > for this flag. True, we don't need cc-option here anymore. I'll remove it, thanks. > > +KBUILD_LDFLAGS += --thinlto-cache-dir=.thinlto-cache > > It might be nice to have `make distclean` or even `make clean` scrub > the .thinlto-cache? Also, I verified that the `.gitignore` rule for > `.*` properly ignores this dir. Sure, distclean sounds appropriate to me. Sami