Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2898653ybb; Sun, 5 Apr 2020 20:15:21 -0700 (PDT) X-Google-Smtp-Source: APiQypIK0sGXC7prUvmKzvLUh6sJu2vEfe4r0tyBrM+ODjcw1HkYVNRj23BKe5Y0irXDmVhEdVDR X-Received: by 2002:a9d:2c01:: with SMTP id f1mr16286378otb.67.1586142921486; Sun, 05 Apr 2020 20:15:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586142921; cv=none; d=google.com; s=arc-20160816; b=gmV0u9Erd4vXJxK8v/5v6vb5FQend/ljKiHCeUsgIGVGtvEOs5DSyjseJyZtuTxVAM Qo2+43x4Y6nMtn3LTnQpXLjfGPvgcIIl9Ol5iVIdBhaVNp+gIF54jrKp22Z423XxtyP0 oatMF7cT0kXVQkpo+uGIEEObWsqX0YP+KJtSoTucAYpidWlbnA1U4xBZdRDJbRAqi87k WrAwtf2LvYzPe9SbMeB4Hr++GbQ+qULWFlgxE1Lz3LSEhEUvHJsDHy+rgaJBty2JzQYJ ipp35cVcwgaQmZPt+RQ9R84bE16geA85ByYv8CGecPwA1YRCUjP6bs8SfEjFclxqb/0q m7eQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=KrMlUKTNeum7x5sltX8KMxycbNc+02GypLAIc2PxYRo=; b=VD/7v2SN6zN3HmuIZYBLr0yYz74nlcxTYmeKD6cREeQXMS9TjHr1tzCJ2peCW16nDy /2r3jCZUCY2RRaODQRrPPGI+7aMYyaOx/T0Vrc2mpeaxK9lzsy9q1W/yQy6+cINN/l/4 m30Fa3aGQWf825jOS406mG+WAaLIyyUiOPwOb3xnlUJ/PWjUy775NeUxxnplpwJEM95P HJepVcunuq/lXYl2QvOrjKxjNTTCyJc1KKxHyB8Wa7/j86S4Up/cJIsLqaLZ2CVD47Ik LuG24EUDPKBZdG7YmOnmQdFvOSSa3XFl0Ixyt86PJKcvo1/R83NwbT4etvGEzoPHp7qY np1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="n6l9/PoP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si6923813ood.64.2020.04.05.20.15.10; Sun, 05 Apr 2020 20:15:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="n6l9/PoP"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726595AbgDFDOr (ORCPT + 99 others); Sun, 5 Apr 2020 23:14:47 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43868 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726408AbgDFDOr (ORCPT ); Sun, 5 Apr 2020 23:14:47 -0400 Received: by mail-pl1-f193.google.com with SMTP id v23so5350078ply.10 for ; Sun, 05 Apr 2020 20:14:46 -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=KrMlUKTNeum7x5sltX8KMxycbNc+02GypLAIc2PxYRo=; b=n6l9/PoPu69WpXT2Mhp8EZHschCokwiFwYEsCQGtvfeKtWLCPJVr6oG1HquLiu02XI tN1ZBgOX7T4orHjVzbpZq1YbtwWWTGwb6eoHiHCefE7DIkPuZJrQwcn3vk5DrUxhLlms AB0x78zGlV7JWTZl0LGNj4BxRhgg0E4fNtV7+gKw/vW5Z/g9cBFxXsSnl6KSSfEcT/Tm 8r7JKejY8sjcEDU2QAnkKKkPTg25kaFCjoc9mJGuRFzSiJ+JclKyEr/r7H6Zt/Ozh83g h0cBn5nMJXMfaPQfWPvMoXNeewVsI9Y0qS1MFHCZ1mbKj7ljW/DmFXJqIiyXejh54FR1 0uHw== 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=KrMlUKTNeum7x5sltX8KMxycbNc+02GypLAIc2PxYRo=; b=Li1owDIE940moMFt6hbI8jV8ZP5gtZdF5SMUVbcZNfC7dPPUNgJ65XqGmf8gWY8FwG 5tSprY8ad3L/6hPggaOmuHwHw/4EAP8J6WqYYgsU828uzIhKoZ82Do6Qtx/Fef2Fqf3B PDlSvFzmuCtvqGkza9N1mGphRqm0wPcbRX0IheFIq00htgBQ9f602XH/qo1JyCEBZRFy 6Snvc+Bn0NRrlhEZGZb+nguD+tkZqBS/Y8xVjUXVWvFNvEhN/M73mf3oUp8CywMbItAV nI5ccQ3QdcVfuL4kUH3tuguH7aM2R1KihB2lSioJX/FYAkCcEb2VC4tFmjX2Y6jEPmaV JdzQ== X-Gm-Message-State: AGi0PuacFYs4XsBxdnudY2jkahlBIcBcI3pStOnHbz67NfcpgWXVT4px y9FxWIZQzyzd5FyWSTUYI/9pdA== X-Received: by 2002:a17:902:b682:: with SMTP id c2mr18913445pls.36.1586142886153; Sun, 05 Apr 2020 20:14:46 -0700 (PDT) Received: from google.com ([2620:15c:2ce:0:9efe:9f1:9267:2b27]) by smtp.gmail.com with ESMTPSA id e184sm10357065pfh.219.2020.04.05.20.14.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Apr 2020 20:14:45 -0700 (PDT) Date: Sun, 5 Apr 2020 20:14:42 -0700 From: Fangrui Song To: Masahiro Yamada Cc: Nick Desaulniers , Linux Kbuild mailing list , Nathan Chancellor , clang-built-linux , Jonathan Corbet , Michal Marek , Linux Doc Mailing List , LKML , Matthias =?utf-8?Q?M=C3=A4nnich?= , Sandeep Patil Subject: Re: [PATCH] kbuild: support 'LLVM' to switch the default tools to Clang/LLVM Message-ID: <20200406031442.2yrjtjp476qzjbqs@google.com> References: <20200403051709.22407-1-masahiroy@kernel.org> <20200405235507.psjjhqa3cxw57xra@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-06, Masahiro Yamada wrote: >On Mon, Apr 6, 2020 at 8:55 AM 'Fangrui Song' via Clang Built Linux > wrote: >> >> On 2020-04-06, Masahiro Yamada wrote: >> >On Sat, Apr 4, 2020 at 3:24 AM Nick Desaulniers wrote: >> >> >> >> On Thu, Apr 2, 2020 at 10:17 PM Masahiro Yamada wrote: >> >> > >> >> > As Documentation/kbuild/llvm.rst implies, building the kernel with a >> >> > full set of LLVM tools gets very verbose and unwieldy. >> >> > >> >> > Provide a single switch 'LLVM' to use Clang and LLVM tools instead of >> >> > GCC and Binutils. You can pass LLVM=1 from the command line or as an >> >> > environment variable. Then, Kbuild will use LLVM toolchains in your >> >> > PATH environment. >> >> > >> >> > Please note LLVM=1 does not turn on the LLVM integrated assembler. >> >> > You need to explicitly pass AS=clang to use it. When the upstream >> >> > kernel is ready for the integrated assembler, I think we can make >> >> > it default. >> >> >> >> Having this behavior change over time may be surprising. I'd rather >> >> that if you want to not use the integrated assembler, you explicitly >> >> negate it, or just don't use the LLVM=1 syntax, ie. `make CC=clang >> >> LD=ld.lld ...`. >> >> >> >> We could modify how `-no-integrated-as` is chosen when LLVM=1. >> >> >> >> make LLVM=1 LLVMIA=0 ... # add `-no-integrated-as` >> >> # what the flag is doesn't really matter to me, something shorter might be nice. >> >> make LLVM=1 # use all LLVM tools >> >> >> >> Since we got rid of $(AS), it would be appropriate to remove/change it >> >> there, since no one really relies on AS=clang right now. (We do have 1 >> >> of our 60+ CI targets using it, but we can also change that trivially. >> >> So I think we have a lot of freedom to change how `-no-integrated-as` >> >> is set. >> >> >> >> This could even be independent of this patch. >> > >> > >> >I also thought a boolean flag is preferred. >> > >> >AS=clang will not live long anyway, and >> >I hesitated to break the compatibility >> >for the short-term workaround. >> > >> >But, if this is not a big deal, I can >> >replace AS=clang with LLVMIA=1. >> >> My mere complaint is that it may be difficult to infer the intention (integrated >> assembler) from the abbreviation "IA" in "LLVMIA" :/ >> >> Something with "AS" in the name may be easier for a user to understand, >> e.g. CLANG_AS or LLVM_AS. > >I see 'llvm-as' in my PATH, >but it is a different kind of tool, right? >(converter from LLVM assembler *.ll to LLVM bit code *.bc) > >So, I thought "LLVM_AS" might be confusing. You are right. llvm-as converts a textual form of LLVM IR (.ll) to a binary form bitcode (.bc). LLVM_AS is confusing. CLANG_AS/CLANGAS might be suitable. clang a.c '-###' => clang -cc1 # like gcc invokes cc1 clang a.s '-###' => clang -cc1as # this invokes the integrated assembler