1 |
On Thursday, 16 December 2021 3:58:26 AM NZDT 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 |
12 |
> 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) |
30 |
> AR=$(tc-getAR)" export xmakeopts |
31 |
> } |
32 |
|
33 |
What's the reason for not using $LLVM here? To preserve building with clang |
34 |
for kernels < 5.7 ? |
35 |
|
36 |
I might be missing the point, but wouldn't something along the lines of |
37 |
"LLVM=$(! [[ $(tc-getCC) =~ clang ]]; echo $?)" work to preserve the correct |
38 |
compiler tools? |
39 |
|
40 |
Cheers |