Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1999045pxb; Sun, 31 Oct 2021 05:39:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPL4XcigJnbFVt3HUukdEB3TLlvnInFpMQi4BeLl0cqEMvifT3sR2OxvqoJZOCQ5b1XQkm X-Received: by 2002:a92:cd8b:: with SMTP id r11mr827591ilb.320.1635683970703; Sun, 31 Oct 2021 05:39:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635683970; cv=none; d=google.com; s=arc-20160816; b=hcyaYMjGVUC+qSKXdfmkUlrKtJFhenpBnfNdSA1WdUk0fe3DtpTa4Yt9vLkiCCOukO +smZh9Irz0mVJw21OiEIqywtgMP41Y0e763m8fs7EkgiLGXPj0LpDE1VMMM7WEgEAsB+ 9w38z8ZSA3U5Q4FEUbVcGBCSaHhka0EWXF2d6oZuXsrPn4XwjIGmdB9D/p0/dsipgGAS Q0XcB/oki1h9U28J/2Whq5vdf7Nn2T23A1nCCWj2+DWPvk7xm12R29INqMXTdlXdr0Qe Ci7xCpKbN7EK9BA+m2I609briGOv4+++Zur8MuukpD8m8biXnUDNj9HcZKq+9k3aZeFS D0Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lB3SIW23abBtuALywBPxVOTIYwGSheKJFWf5p+84tX8=; b=wXy0Gcw9aZSd/eEGmA91g4dlNdt1h7H4eDp/zkSTJqrbyn8Aibq7r+7gVNUNC4l6T0 gm8T+EKWsVuTolv7g/TGof5RUAl/tA08BC3rIxW286k4s9Y/X+ki0U7j62InSdEQURNl kjh5+0SMDbEnKqQ2TTAGGXIla5suWswhozHvhXu3bQHELXONaN8t1S+xwHFUPobNjgsG Fo+z/+w6uyIi/4kIDxrE6dOrl36d4DhJCH9azJ4vZYQb8FiQYVw161yq8j+aBDBSd2gJ aN0LKPylFz+b4l4fRvDaOuGGETQJ4AOCJ6ffzbnN5Ydkf1pO4zqtuEh5Mva6XEs21MRG UV6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=WPBMqihv; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u8si10222134ior.11.2021.10.31.05.39.18; Sun, 31 Oct 2021 05:39:30 -0700 (PDT) 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=@infradead.org header.s=desiato.20200630 header.b=WPBMqihv; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbhJaMkw (ORCPT + 99 others); Sun, 31 Oct 2021 08:40:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229798AbhJaMkv (ORCPT ); Sun, 31 Oct 2021 08:40:51 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D72EC061570; Sun, 31 Oct 2021 05:38:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lB3SIW23abBtuALywBPxVOTIYwGSheKJFWf5p+84tX8=; b=WPBMqihvv4pLk4emK09OVXBWRC pentfIRPIE5qmfrKS0AmTqor18AZ94gYBRvr2a+lTz8GVx0bnybLPdIaTG2YNrhPuIDJ9CsN2YDsm bFdJVvv74+i4DgKl6pevZVLuUwoPZ+JlLzyIoedMuojRVKeM9tob5NzGr2bM6fwIn/BfmeddfiS2s L0RKibOLT/wcio67N8z18cRurtuIAC+G54nbP4b9EoT7bzI2CxyMBI/9Nf/DsTxndiynavrdV0cZT FfpgLT9KSBFmqFWeYi1MyV/g15JzMaU5bEbq/nFF3bjkzsRbGaJ/1olyi3OtklFLgKxz8b2YBXDYB KQ8jwEWA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mhA6D-00DOaJ-NH; Sun, 31 Oct 2021 12:38:09 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 5F07430022C; Sun, 31 Oct 2021 13:38:08 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3B4832058F615; Sun, 31 Oct 2021 13:38:08 +0100 (CET) Date: Sun, 31 Oct 2021 13:38:08 +0100 From: Peter Zijlstra To: Sedat Dilek Cc: Nick Desaulniers , Nathan Chancellor , Masahiro Yamada , Michal Marek , X86 ML , Linux Kernel Mailing List , Linux Kbuild mailing list , llvm@lists.linux.dev Subject: Re: [PATCH] kbuild: Support clang-$ver builds Message-ID: References: <20211028204855.GP174703@worktop.programming.kicks-ass.net> <20211030143311.GH174730@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 31, 2021 at 02:18:01AM +0100, Sedat Dilek wrote: > On Sat, Oct 30, 2021 at 4:34 PM Peter Zijlstra wrote: > > > > > > Latestest greatness... :-) > > > > --- > > Subject: kbuild: Fix clang/llvm build infra > > > > Debian (and derived) distros ship their compilers as -$ver suffixed > > binaries. For gcc it is sufficent to use: > > > > $ make CC=gcc-12 > > > > However, clang builds (esp. clang-lto) need a whole array of tools to be > > exactly right, leading to unweildy stuff like: > > > > $ make CC=clang-13 LD=ld.lld=14 AR=llvm-ar-13 NM=llvm-nm-13 OBJCOPY=llvm-objcopy-13 OBJDUMP=llvm-objdump-13 READELF=llvm-readelf-13 STRIP=llvm-strip-13 LLVM=1 > > > > which is, quite franktly, totally insane and unusable. Instead make > > the CC variable DTRT, enabling one such as myself to use: > > > > $ make CC=clang-13 > > > > This also lets one quickly test different clang versions. > > Additionally, also support path based LLVM suites like: > > > > $ make CC=/opt/llvm/bin/clang > > > > Hi Peter, > > Thanks for bringing this up again. > > Your issue is not new for Debianist and Linux-LLVM/Clang folks. > > But let me comment. > > I agree, it is preferable or should be treated the same way in using > clang-$ver like gcc-$ver. > > Background: Right, I know that. > As a compromise I use in my build_linux-llvm-toolchain.sh script > But... > > ...for several new features like Clang-LTO we need the LLVM full "eco system". > LLVM eco system means compiler, linker and binutils. > In several talks at LPC 2021 talkers used the term "LLVM/binutils" > like for GNU/binutils. > The LLVM/Clang kernel-docs talk about "LLVM util(itie)s" which is set > by LLVM=1 or not (LLVM=0). > > Link: https://www.kernel.org/doc/html/latest/kbuild/llvm.html#llvm-utilities > > AFAICS your patch has a primary focus to fix the LLVM/Clang > infrastructure when CONFIG_LTO_CLANG=y, right? > Can you massage the commit message to reflect this? It already does :-) Also, it's a little bit more complicated, you can't actually select CONFIG_LTO *unless* you've configured your toolchain just right. > IMHO your patch can be improved to check for CONFIG_LTO_CLANG=y where > LLVM=1 is mandatory and IIRC LLVM_IAS=1, too. > ( The default to use LLVM/Clang-IAS (Integrated ASsembler) was changed > recently for some combinations arches + Clang-LTO? ) Egg, meet chicken :-) > Before I forgot: > Can you add a comment for the PPC and S390 situation in the commit message. Sure. > Please remember people also want to use combinations like gcc-$ver and > LLVM/binutils like ld.lld-$ver. make CC=gcc LLVM=1 make CC=clang LLVM=0 are still valid combinations that work, I just don't think they ought to be the default. > GCC-10 + LLD-$VER was the fastest combination to build a Linux Debian > package here on my Intel SandyBridge CPU system. > ( There exists overrides like LD=... STRIP=... and I use > XXX_FOR_BUILD=... (see my attached build-script). ) Right, that's what overrides are for, non-default setups. I just, quite strongly, feel that our defaults are completely insane. ~ Peter