Gentoo Archives: gentoo-dev

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v2] kernel-2.eclass: Respect portage CC & AR variables
Date: Thu, 16 Dec 2021 00:37:59
Message-Id: 20211216033742.1c2d8461a237176fe0701b73@gentoo.org
In Reply to: Re: [gentoo-dev] [PATCH v2] kernel-2.eclass: Respect portage CC & AR variables by Andrew Savchenko
1 On Thu, 16 Dec 2021 03:32:10 +0300 Andrew Savchenko wrote:
2 > On Wed, 15 Dec 2021 16:58:26 +0200 Adrian Ratiu wrote:
3 > > Starting with kernel>=v5.7 the build system can override the
4 > > tools vars by setting LLVM=1 [1], but older kernels still use
5 > > the default GNU tools, so to be able to use a full LLVM/Clang
6 > > build, CC should be set together with AR to the portage set
7 > > values.
8 > >
9 > > Doing this avoids situations like building the kernel with
10 > > clang (using the set HOSTCC) but using gcc/gnu-ar for headers.
11 > >
12 > > [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
13 > >
14 > > Co-authored-by: Manoj Gupta <manojgupta@××××××××.org>
15 > > Signed-off-by: Adrian Ratiu <adrian.ratiu@×××××××××.com>
16 > > ---
17 > > eclass/kernel-2.eclass | 2 +-
18 > > 1 file changed, 1 insertion(+), 1 deletion(-)
19 > >
20 > > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
21 > > index adc1425bc2e..caeec86ff59 100644
22 > > --- a/eclass/kernel-2.eclass
23 > > +++ b/eclass/kernel-2.eclass
24 > > @@ -692,7 +692,7 @@ env_setup_xmakeopts() {
25 > > elif type -p ${CHOST}-ar >/dev/null; then
26 > > xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
27 > > fi
28 > > - xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)"
29 > > + xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC) AR=$(tc-getAR)"
30 >
31 > OBJDUMP should be exported as well
32 > (e.g. used by scripts/Makefile.build)
33
34 And LD as well.
35
36 > > export xmakeopts
37 > > }
38 > >
39 >
40 >
41 > Best regards,
42 > Andrew Savchenko
43
44
45 Best regards,
46 Andrew Savchenko

Replies

Subject Author
Re: [gentoo-dev] [PATCH v2] kernel-2.eclass: Respect portage CC & AR variables Adrian Ratiu <adrian.ratiu@×××××××××.com>