1 |
On Wed, Dec 15, 2021 at 1:37 PM James Beddek <telans@××××××.de> wrote: |
2 |
|
3 |
> On Thursday, 16 December 2021 3:58:26 AM NZDT Adrian Ratiu wrote: |
4 |
> > Starting with kernel>=v5.7 the build system can override the |
5 |
> > tools vars by setting LLVM=1 [1], but older kernels still use |
6 |
> > the default GNU tools, so to be able to use a full LLVM/Clang |
7 |
> > build, CC should be set together with AR to the portage set |
8 |
> > values. |
9 |
> > |
10 |
> > Doing this avoids situations like building the kernel with |
11 |
> > clang (using the set HOSTCC) but using gcc/gnu-ar for headers. |
12 |
> > |
13 |
> > [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to |
14 |
> > Clang/LLVM |
15 |
> > |
16 |
> > Co-authored-by: Manoj Gupta <manojgupta@××××××××.org> |
17 |
> > Signed-off-by: Adrian Ratiu <adrian.ratiu@×××××××××.com> |
18 |
> > --- |
19 |
> > eclass/kernel-2.eclass | 2 +- |
20 |
> > 1 file changed, 1 insertion(+), 1 deletion(-) |
21 |
> > |
22 |
> > diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass |
23 |
> > index adc1425bc2e..caeec86ff59 100644 |
24 |
> > --- a/eclass/kernel-2.eclass |
25 |
> > +++ b/eclass/kernel-2.eclass |
26 |
> > @@ -692,7 +692,7 @@ env_setup_xmakeopts() { |
27 |
> > elif type -p ${CHOST}-ar >/dev/null; then |
28 |
> > xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-" |
29 |
> > fi |
30 |
> > - xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)" |
31 |
> > + xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC) |
32 |
> > AR=$(tc-getAR)" export xmakeopts |
33 |
> > } |
34 |
> |
35 |
> What's the reason for not using $LLVM here? To preserve building with |
36 |
> clang |
37 |
> for kernels < 5.7 ? |
38 |
> |
39 |
> I might be missing the point, but wouldn't something along the lines of |
40 |
> "LLVM=$(! [[ $(tc-getCC) =~ clang ]]; echo $?)" work to preserve the |
41 |
> correct |
42 |
> compiler tools? |
43 |
> |
44 |
> This patch is about respecting the current CC value in portage. It could |
45 |
be clang, icc, or something else |
46 |
What should be the value of CC should be up to the user's portage config. |
47 |
|
48 |
In Chrome OS e.g., we have multiple possible CC's with variants like |
49 |
<abi>-clang. So hardcoding clang |
50 |
also does not look correct. |
51 |
|
52 |
Thanks, |
53 |
Manoj |
54 |
|
55 |
|
56 |
> Cheers |