[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YX6OMKPlV/pFvIpT@hirez.programming.kicks-ass.net>
Date: Sun, 31 Oct 2021 13:38:08 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Sedat Dilek <sedat.dilek@...il.com>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <nathan@...nel.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Michal Marek <michal.lkml@...kovi.net>,
X86 ML <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>,
llvm@...ts.linux.dev
Subject: Re: [PATCH] kbuild: Support clang-$ver builds
On Sun, Oct 31, 2021 at 02:18:01AM +0100, Sedat Dilek wrote:
> On Sat, Oct 30, 2021 at 4:34 PM Peter Zijlstra <peterz@...radead.org> 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
Powered by blists - more mailing lists