Gentoo Archives: gentoo-dev

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

Replies