Re: [PATCH] kbuild: Support clang-$ver builds

From: Peter Zijlstra
Date: Thu Oct 28 2021 - 10:15:24 EST


On Thu, Oct 28, 2021 at 11:07:40PM +0900, Masahiro Yamada wrote:
> On Thu, Oct 28, 2021 at 10:44 PM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
> >
> > Hi,
> >
> > 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 use the
> > already mandatory LLVM variable to convey this, enabling one such as
> > myself to use:
> >
> > $ make LLVM=-13
> >
> > This also lets one quickly test different clang versions.
>
>
> Please read the commit log of
> a0d1c951ef08ed24f35129267e3595d86f57f5d3

That's yuck, I like LLVM=-13 or LLVM=-12 much better to select between
compilers. Means I don't have to remember wth they live and or wreck
PATH.