Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp410772pxu; Thu, 3 Dec 2020 03:30:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzFuP/L4lO/ONCNDXoQ0aB4LINVe6YTX6AOUw88MDyFBJfrdheXytD4fo8xeeOtt2nJGyG X-Received: by 2002:aa7:c886:: with SMTP id p6mr2415045eds.207.1606995019705; Thu, 03 Dec 2020 03:30:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606995019; cv=none; d=google.com; s=arc-20160816; b=aQuV1L1JK7mn0xZxXrn6jSiPSldySZ6ZSn5LTL8B/pc5KBhXpSNZxlF81tHjCQvR6k IfuYQ2gucOQMXiWGdCFFW0oIAI9uqiU1vLIaAULujCEl2CDwDb9djOhK831CvDfEd7XH ZT7PDAgI5tBb/M85P2zkEw1wjFQWhDYFb1xbGisn5ONeewgzjPvBJmEB7ziGZsvfZOFM bpxgNLWrUiU2Sn25FAl/N9r3AjxJWBvSwnR2bJHy5xWPibrYqOeJFJ5RQwP9Kvob/hk7 8oT7HyRZj5lg3dlRhji8deXoJixV6nLnkNNKOJ+uPQyuN9eSAHZTCV6trIHlMtyu5a4f pCSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from :dkim-signature:date; bh=e/mgxl8rAzL0jULiM7u5yCnvG2L50UiVe22yp/z2zVw=; b=cF5B2FlKzuoeQWVXurByF/iFs/oY3vk9NSA91ysLBM/4Hpp+WqcRopInKOcNCOZw20 3JcZp+Rh2cQmWR6t4Ks1BSwj/YS0JKShZjcFz2oXXgXkox+ROZXpSbnKuiNPDU5zY7K7 KpPjt77RfxWW9O+DLzGgPlYbwxJ9IvFouq+VGhHGy31sWs+YQG9DKm4c6k2vKfns4gOi fYojl4uXAVCyuSydRNkZqe8OAnuY7HMCAIHoG91bHomNsFX8H7s4AWEx/EE5C2n7WqXZ IU0JO2mpfS6OkDz7zFKiQt/Hp3XRwQGHoYxgKgCg3ajQ/AJ7ThXe9sxuyhwZ98hddJ+F plhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BmIBlbUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si701745eds.215.2020.12.03.03.29.55; Thu, 03 Dec 2020 03:30:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BmIBlbUT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728884AbgLCL1L (ORCPT + 99 others); Thu, 3 Dec 2020 06:27:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:52412 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbgLCL1L (ORCPT ); Thu, 3 Dec 2020 06:27:11 -0500 Date: Thu, 3 Dec 2020 11:26:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1606994790; bh=Z6fRxajiQsjMgIcL2B8U6vdSMQSDFY19TKRTAoS5XwM=; h=From:To:Cc:Subject:References:In-Reply-To:From; b=BmIBlbUTavBbJSA9SMVKb3tOHpXr6pmjMIykJxf8ysFQLdGr4NcG39u+tYjgBM15e ND0gIZQk/Z9Q2lye0p54KpIoxeRbEo86wBhS+sakJ/LTeGH97qgsHZUNuhciXa3sjH Sdap/WsTwkwgmaDLJvxtIbvdHONV85FJ/NQJoTHO+D6r6+nGzh+djD8BmVCZPcr1UA 9KjdS0id2HpEqXYn1f4KtDSfcRnH9mLEjtLYqQpbDQNvRQtx3PhNUaVOjUSpg7p1Fx +aW7XBdMBvjBOcwlwLm9jvoC5FZG3oy1RfqNQMCD7k9DXou+nfkgGL9P6MIG326q2n FxiM1lHhq2TrA== From: Will Deacon To: Sami Tolvanen Cc: Masahiro Yamada , Steven Rostedt , Josh Poimboeuf , Peter Zijlstra , Greg Kroah-Hartman , "Paul E. McKenney" , Kees Cook , Nick Desaulniers , clang-built-linux@googlegroups.com, kernel-hardening@lists.openwall.com, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v8 00/16] Add support for Clang LTO Message-ID: <20201203112622.GA31188@willie-the-truck> References: <20201201213707.541432-1-samitolvanen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201201213707.541432-1-samitolvanen@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sami, On Tue, Dec 01, 2020 at 01:36:51PM -0800, Sami Tolvanen wrote: > This patch series adds support for building the kernel with Clang's > Link Time Optimization (LTO). In addition to performance, the primary > motivation for LTO is to allow Clang's Control-Flow Integrity (CFI) > to be used in the kernel. Google has shipped millions of Pixel > devices running three major kernel versions with LTO+CFI since 2018. > > Most of the patches are build system changes for handling LLVM > bitcode, which Clang produces with LTO instead of ELF object files, > postponing ELF processing until a later stage, and ensuring initcall > ordering. > > Note that arm64 support depends on Will's memory ordering patches > [1]. I will post x86_64 patches separately after we have fixed the > remaining objtool warnings [2][3]. I took this series for a spin, with my for-next/lto branch merged in but I see a failure during the LTO stage with clang 11.0.5 because it doesn't understand the '.arch_extension rcpc' directive we throw out in READ_ONCE(). We actually check that this extension is available before using it in the arm64 Kconfig: config AS_HAS_LDAPR def_bool $(as-instr,.arch_extension rcpc) so this shouldn't happen. I then realised, I wasn't passing LLVM_IAS=1 on my Make command line; with that, then the detection works correctly and the LTO step succeeds. Why is it necessary to pass LLVM_IAS=1 if LTO is enabled? I think it would be _much_ better if this was implicit (or if LTO depended on it). Cheers, Will