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

Replies