From: Peter Zijlstra <peterz@infradead.org>
To: Sedat Dilek <sedat.dilek@gmail.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>,
Nathan Chancellor <nathan@kernel.org>,
Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>, X86 ML <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux Kbuild mailing list <linux-kbuild@vger.kernel.org>,
llvm@lists.linux.dev
Subject: Re: [PATCH] kbuild: Support clang-$ver builds
Date: Sun, 31 Oct 2021 13:38:08 +0100 [thread overview]
Message-ID: <YX6OMKPlV/pFvIpT@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <CA+icZUUU53OwtCDC-4FPfcCenYQeZo7b8b=wszbvrHSYBqbYOA@mail.gmail.com>
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@infradead.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
next prev parent reply other threads:[~2021-10-31 12:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-28 13:43 [PATCH] kbuild: Support clang-$ver builds Peter Zijlstra
2021-10-28 14:07 ` Masahiro Yamada
2021-10-28 14:15 ` Peter Zijlstra
2021-10-28 14:22 ` Peter Zijlstra
2021-10-28 15:03 ` Peter Zijlstra
2021-10-28 17:44 ` Nathan Chancellor
2021-10-28 20:48 ` Peter Zijlstra
2021-10-28 23:27 ` Nick Desaulniers
2021-10-29 8:54 ` Peter Zijlstra
2021-10-30 14:33 ` Peter Zijlstra
2021-10-31 1:18 ` Sedat Dilek
2021-10-31 12:38 ` Peter Zijlstra [this message]
2021-10-29 8:56 ` David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YX6OMKPlV/pFvIpT@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=sedat.dilek@gmail.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox