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=-0.7 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 DE1D1C433FE for ; Thu, 3 Dec 2020 18:23:18 +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 7D78A21D94 for ; Thu, 3 Dec 2020 18:23:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7D78A21D94 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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=GvhazWAEAoUk4hiQGj1CZOq6Aou/ZHyrVKx0RvkAysk=; b=gN60ztj6WxFC2BLISXNUS2kYe 6zV+z4zxQmGRpQ/3iIx651eBQS844RWhVtFrxA6k5AFaP7E7w6j4SBvXpQ5lUzxgXXtdx5cqR8k+E Le7UoUx9gFBZny0NGvGBlNngD/tvEvX2UcP+6wGX5s7WMVoO0Z8kJSr4zlhwhWF+vVZHpqGDax0uh wJrgdJSYdIko1u+BrbqxXZVoXm6awb4sP8tdQKtNc0JrX8Z0DOKcPGYQAZ0aSy7Pvpf0H2iWttl3o qCAB2/QmcY8dnGS04+hoRY9Zb4XjhHKJ1xatQBYlDKQKdCd1YSzIzz+I4g0+FLbuZpxTy6ZCZ7kTZ mWTB9CZ/w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kktF3-0001cI-K7; Thu, 03 Dec 2020 18:22:09 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kktF0-0001bO-G7 for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 18:22:07 +0000 Received: by mail-qk1-x744.google.com with SMTP id u4so2996737qkk.10 for ; Thu, 03 Dec 2020 10:22:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jSR8ftEy+ZPymQ2+ANnTCIcrdEyC6rgz8i/C+YFDrrs=; b=Ic4QleiYjTsHIMM0On90To1JYUkzfryly4JE00oJVw6xM1knMCPDBhHTFqo48Us3e3 MF3QjiQL1yjayz+ETueVi50Cn9wqU1xj9ng0fJUbRI+swr7mmTUxDCH4/w/s1H+CN7nV OMmtIxG/V/PGVXNAQ6+q7qtZP4eFDcBe5sneK8fRhFRpoA6Nvajm1Z7NHt4ZNxR64L+m 4StPiEoHrbNTyS5/bdTMBY7TWfxjJGh0p0nIYygOwtneo34JRlkXmRO2GZTSE3KheRhh U93GV8FOoYr6XPNft2A1/QvVK5CEPDl6SJRZHBpQO5yh83pv4jtkzUzrLEyURHK7A70P Dbgg== 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=jSR8ftEy+ZPymQ2+ANnTCIcrdEyC6rgz8i/C+YFDrrs=; b=Ku9hFafmWTMWElKmGKecRdqkmmFP0zdFS+tfprWhfCg6LAIpIDzlFsiKtcX9Fb5BYo RBruW6lgOUcbVUkEUWZp8zrWxLenlo+IL0WH308WpuATdAOfh7IO3rn68iwocXuzx0LE L5q5QjG3Rmyfs5QdQbkcmDUckIRJSCXpodK1oH8b8TgN/yy72ekBxjcoN2GK2y0KcXdC +3GrLda8lXfZMzzMYU9m2xWv2LpBMcP4+clm9FzoI/AQK59MC4JLoqANepdRg4gcT/qw Tby0XewPiAwjq4+LZGoZ2DQlSe9Qs0q5LT51eT/edZNJlnyxim+AfWP7pHed/NOxhzqH MALg== X-Gm-Message-State: AOAM532jUPUl2oyUJCsX78mNH97QO7UIi5z2r1coz2tRhsbe/Fyl3bBi qwDQJOVHT9TWUV7TO/GiV7c= X-Google-Smtp-Source: ABdhPJxLBGQRSAEg/JvKkC/BNSVvgOhlpSDC2EIcQCGCOFwysswuak0jbyXtVU7AXdFmRsqK6IIjeA== X-Received: by 2002:a05:620a:1489:: with SMTP id w9mr4240006qkj.43.1607019722685; Thu, 03 Dec 2020 10:22:02 -0800 (PST) Received: from ubuntu-m3-large-x86 ([2604:1380:45f1:1d00::1]) by smtp.gmail.com with ESMTPSA id s8sm1812350qtw.61.2020.12.03.10.22.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 10:22:01 -0800 (PST) Date: Thu, 3 Dec 2020 11:21:59 -0700 From: Nathan Chancellor To: Sami Tolvanen Subject: Re: [PATCH v8 00/16] Add support for Clang LTO Message-ID: <20201203182159.GA2104680@ubuntu-m3-large-x86> References: <20201201213707.541432-1-samitolvanen@google.com> <20201203112622.GA31188@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_132206_595390_B8E86A8E X-CRM114-Status: GOOD ( 35.85 ) 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 , Kees Cook , "Paul E. McKenney" , Kernel Hardening , Peter Zijlstra , Greg Kroah-Hartman , Masahiro Yamada , linux-kbuild , Nick Desaulniers , LKML , Steven Rostedt , clang-built-linux , PCI , Josh Poimboeuf , Will Deacon , linux-arm-kernel 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, Dec 03, 2020 at 09:07:30AM -0800, Sami Tolvanen wrote: > On Thu, Dec 3, 2020 at 3:26 AM Will Deacon wrote: > > > > 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(). > > I just tested this with Clang 11.0.0, which I believe is the latest > 11.x version, and the current Clang 12 development branch, and both > work for me. Godbolt confirms that '.arch_extension rcpc' is supported > by the integrated assembler starting with Clang 11 (the example fails > with 10.0.1): > > https://godbolt.org/z/1csGcT > > What does running clang --version and ld.lld --version tell you? 11.0.5 is AOSP's clang, which is behind the upstream 11.0.0 release so it is most likely the case that it is missing the patch that added rcpc. I think that a version based on the development branch (12.0.0) is in the works but I am not sure. > > 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). > > Without LLVM_IAS=1, Clang uses two different assemblers when LTO is > enabled: the external GNU assembler for stand-alone assembly, and > LLVM's integrated assembler for inline assembly. as-instr tests the > external assembler and makes an admittedly reasonable assumption that > the test is also valid for inline assembly. > > I agree that it would reduce confusion in future if we just always > enabled IAS with LTO. Nick, Nathan, any thoughts about this? I am personally fine with that. As far as I am aware, we are in a fairly good spot on arm64 and x86_64 when it comes to the integrated assembler. Should we make it so that the user has to pass LLVM_IAS=1 explicitly or we just make adding the no integrated assembler flag to CLANG_FLAGS depend on not LTO (although that will require extra handling because Kconfig is not available at that stage I think)? Cheers, Nathan _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel