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=-4.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FSL_HELO_FAKE, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 BE32AC433E2 for ; Tue, 8 Sep 2020 17:04:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52BB7207DE for ; Tue, 8 Sep 2020 17:04:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="mnzU7DaQ"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="pKJ8j7uK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 52BB7207DE Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=bD/qSKMcA1+YCjLgW0u5PrIzjN0SiIMNyM6qNY/EL+E=; b=mnzU7DaQJ7LwrhSpU/Ur6RRrL nGU4g+BTFb5acyDaJwvwBzS1PCoXSAjPBp5sUg5LFDalmZjXpmV/bYZa7jxg3EjDUNgu4+tg/0e+A NFwGGb3KfVQFwvXyC41pleG5VlxSlM9kz5Oiv30U1u4jQgUulwP833k1IDMSvmCkFvKiXH94i9fv8 LF+XDmd6acjl8wOsaCj3RzuQPInqy46rLcBZXS4B9owC9kc+dxcbCBIaisEQwaXsN4107uLWnBWUc q1excWCy3ZlsvUo95T5TsQkLORtrENY9xuK72gAVQ2WF4ULU9CCAXfpE3MfPo8muxtAWqJRJFDEfX 1bJllWWnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFh1R-0001pS-F9; Tue, 08 Sep 2020 17:03:09 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kFh1O-0001o4-Jq for linux-arm-kernel@lists.infradead.org; Tue, 08 Sep 2020 17:03:07 +0000 Received: by mail-pf1-x442.google.com with SMTP id b124so11444246pfg.13 for ; Tue, 08 Sep 2020 10:03:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TS+pFAf+gXvyICCIZ7exDi0/Gxg54q8UJXDvRO7l168=; b=pKJ8j7uKJcb7uVWaQ5j/SnvkaAx4KCY55KCie8OQaygCpy1OPF8cDgeNH1qrPaLMvG 8srfgOOgbosqJmTceeQvjWZChA+6j/LEIRcay7cMsXtBzLKxqoBwUcyD/WziBOgMhTht H95mhfOyXrIvUmREbH1YWzNRx8qhfoLUnK6vxg72nBJz4Zsryt8ZJJ5SgRHKxhMkN6NG dtOewrVFqRwrzOeM6o0lzzlRd9V3/io+BfvvategCuZpFKOLhdC7d/WJPglYjH7skxA9 mFBhEsZ3kh8WuUPDicHPjHktAGiGpoaEUWzf67bzqCSOGx192KG66jA3O0NwWTFIar6q WtYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TS+pFAf+gXvyICCIZ7exDi0/Gxg54q8UJXDvRO7l168=; b=nHtvJOgWqUCN6b94RoSH8PgWHfOqk0SlpRRYxGQ9kUw2UrYdQmjq5WH+/QL2ydWE5H cd3GPJgL74vhroGUIHhPz9GwI0ZvWThk//KhBDv3yXpJvpS+RESumKFlXN4InQ3bZElR qm+mYYfmfWzQSxjAWqxf/VqWhZZ2/CHBdsStsKoL5zVjelOhgpGu7mzJK9nKHTvg4Ifg mTfX70Gx3veMQDPCyh0ZcjfUtv/RXCXPps7mKoGT5E/49LCfxSgyGHEtRd0i+lblxlqD Pqb3IXNDzQC19j/q72tXL5yYQZA1IIseqW+QkszoI+Vd+hlHm+zayOwB5I7Qz0om26M3 jhog== X-Gm-Message-State: AOAM530xDBdOWb9FmbB/Y4uF6vLoDPE/kMogM3UmfH0r6Sf6q0Z/4Fpa G1niXmgIOf1rRjJz75SEoBjd0A== X-Google-Smtp-Source: ABdhPJypTa9m8baYyH7KtZLmA6Dhp5bWpLPg7YpbRm1G9HK65/WnGTkmsSsfgelDtI+oA1WrmQRR/g== X-Received: by 2002:a17:902:d714:b029:d0:cbe1:e738 with SMTP id w20-20020a170902d714b02900d0cbe1e738mr2106530ply.19.1599584582581; Tue, 08 Sep 2020 10:03:02 -0700 (PDT) Received: from google.com ([2620:15c:201:2:f693:9fff:fef4:1b6d]) by smtp.gmail.com with ESMTPSA id t15sm19413909pfl.175.2020.09.08.10.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 10:03:01 -0700 (PDT) Date: Tue, 8 Sep 2020 10:02:56 -0700 From: Sami Tolvanen To: Kees Cook Subject: Re: [PATCH v2 09/28] kbuild: add support for Clang LTO Message-ID: <20200908170256.GA2743468@google.com> References: <20200624203200.78870-1-samitolvanen@google.com> <20200903203053.3411268-1-samitolvanen@google.com> <20200903203053.3411268-10-samitolvanen@google.com> <202009031504.07098D6F8@keescook> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <202009031504.07098D6F8@keescook> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200908_130306_713985_FDA81EA9 X-CRM114-Status: GOOD ( 29.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, x86@kernel.org, "Paul E. McKenney" , kernel-hardening@lists.openwall.com, Peter Zijlstra , Greg Kroah-Hartman , Masahiro Yamada , linux-kbuild@vger.kernel.org, Nick Desaulniers , linux-kernel@vger.kernel.org, Steven Rostedt , clang-built-linux@googlegroups.com, linux-pci@vger.kernel.org, Will Deacon , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Sep 03, 2020 at 03:08:59PM -0700, Kees Cook wrote: > On Thu, Sep 03, 2020 at 01:30:34PM -0700, Sami Tolvanen wrote: > > This change adds build system support for Clang's Link Time > > Optimization (LTO). With -flto, instead of ELF object files, Clang > > produces LLVM bitcode, which is compiled into native code at link > > time, allowing the final binary to be optimized globally. For more > > details, see: > > > > https://llvm.org/docs/LinkTimeOptimization.html > > > > The Kconfig option CONFIG_LTO_CLANG is implemented as a choice, > > which defaults to LTO being disabled. To use LTO, the architecture > > must select ARCH_SUPPORTS_LTO_CLANG and support: > > > > - compiling with Clang, > > - compiling inline assembly with Clang's integrated assembler, > > - and linking with LLD. > > > > While using full LTO results in the best runtime performance, the > > compilation is not scalable in time or memory. CONFIG_THINLTO > > enables ThinLTO, which allows parallel optimization and faster > > incremental builds. ThinLTO is used by default if the architecture > > also selects ARCH_SUPPORTS_THINLTO: > > > > https://clang.llvm.org/docs/ThinLTO.html > > > > To enable LTO, LLVM tools must be used to handle bitcode files. The > > easiest way is to pass the LLVM=1 option to make: > > > > $ make LLVM=1 defconfig > > $ scripts/config -e LTO_CLANG > > $ make LLVM=1 > > > > Alternatively, at least the following LLVM tools must be used: > > > > CC=clang LD=ld.lld AR=llvm-ar NM=llvm-nm > > > > To prepare for LTO support with other compilers, common parts are > > gated behind the CONFIG_LTO option, and LTO can be disabled for > > specific files by filtering out CC_FLAGS_LTO. > > > > Note that support for DYNAMIC_FTRACE and MODVERSIONS are added in > > follow-up patches. > > > > Signed-off-by: Sami Tolvanen > > I remain crazy excited about being able to use this in upstream. :) > > The only suggestion I have here, if it might help with clarity, would be > to remove DISABLE_LTO globally as a separate patch, since it's entirely > unused in the kernel right now. This series removes it as it goes, which > I think is fine, but it might cause some reviewers to ponder "what's > this DISABLE_LTO thing? Don't we need that?" without realizing currently > unused in the kernel. Sure, that makes sense. I'll add a patch to remove DISABLE_LTO treewide in v3. Sami _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel