lkml.org 
[lkml]   [2021]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kbuild: Support clang-$ver builds
On Thu, Oct 28, 2021 at 04:15:02PM +0200, Peter Zijlstra wrote:
> 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@infradead.org> 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.

Even better, why not do something like:

if test "${CC:0:5}" == "clang"
then
LLVM=1
LLVM_SFX=${CC:5}
fi

Then we can simply use: make CC=clang-12 and have it all just work.

\
 
 \ /
  Last update: 2021-10-28 16:22    [W:0.049 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site