On Wed, Dec 15, 2021 at 1:37 PM James Beddek <
[email protected]> wrote:
On Thursday, 16 December 2021 3:58:26 AM NZDT Adrian Ratiu wrote:
Starting with kernel>=v5.7 the build system can override the
tools vars by setting LLVM=1 [1], but older kernels still use
the default GNU tools, so to be able to use a full LLVM/Clang
build, CC should be set together with AR to the portage set
values.
Doing this avoids situations like building the kernel with
clang (using the set HOSTCC) but using gcc/gnu-ar for headers.
[1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
Co-authored-by: Manoj Gupta <[email protected]>
Signed-off-by: Adrian Ratiu <[email protected]>
---
eclass/kernel-2.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index adc1425bc2e..caeec86ff59 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -692,7 +692,7 @@ env_setup_xmakeopts() {
elif type -p ${CHOST}-ar >/dev/null; then
xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
fi
- xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)"
+ xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC) AR=$(tc-getAR)" export xmakeopts
}
What's the reason for not using $LLVM here? To preserve building with
clang
for kernels < 5.7 ?
I might be missing the point, but wouldn't something along the lines of "LLVM=$(! [[ $(tc-getCC) =~ clang ]]; echo $?)" work to preserve the
correct
compiler tools?
This patch is about respecting the current CC value in portage. It could
be clang, icc, or something else
What should be the value of CC should be up to the user's portage config.
In Chrome OS e.g., we have multiple possible CC's with variants like <abi>-clang. So hardcoding clang
also does not look correct.
Thanks,
Manoj
Cheers
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Dec 15, 2021 at 1:37 PM James Beddek <<a href="mailto:
[email protected]">
[email protected]</a>> wrote:<br></div><blockquote class="gmail_
quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thursday, 16 December 2021 3:58:26 AM NZDT Adrian Ratiu wrote:<br>
> Starting with kernel>=v5.7 the build system can override the<br>
> tools vars by setting LLVM=1 [1], but older kernels still use<br>
> the default GNU tools, so to be able to use a full LLVM/Clang<br>
> build, CC should be set together with AR to the portage set<br>
> values.<br>
> <br>
> Doing this avoids situations like building the kernel with<br>
> clang (using the set HOSTCC) but using gcc/gnu-ar for headers.<br>
> <br>
> [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to<br> > Clang/LLVM<br>
> <br>
> Co-authored-by: Manoj Gupta <<a href="mailto:
[email protected]" target="_blank">
[email protected]</a>><br>
> Signed-off-by: Adrian Ratiu <<a href="mailto:
[email protected]" target="_blank">
[email protected]</a>><br>
> ---<br>
> eclass/kernel-2.eclass | 2 +-<br>
> 1 file changed, 1 insertion(+), 1 deletion(-)<br>
> <br>
> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass<br>
> index adc1425bc2e..caeec86ff59 100644<br>
> --- a/eclass/kernel-2.eclass<br>
> +++ b/eclass/kernel-2.eclass<br>
> @@ -692,7 +692,7 @@ env_setup_xmakeopts() {<br>
> elif type -p ${CHOST}-ar >/dev/null; then<br>
> xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"<br>
> fi<br>
> - xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC)"<br> > + xmakeopts="${xmakeopts} HOSTCC=$(tc-getBUILD_CC) CC=$(tc-getCC)<br>
> AR=$(tc-getAR)" export xmakeopts<br>
> }<br>
What's the reason for not using $LLVM here? To preserve building with clang <br>
for kernels < 5.7 ?<br>
I might be missing the point, but wouldn't something along the lines of<br> "LLVM=$(! [[ $(tc-getCC) =~ clang ]]; echo $?)" work to preserve the correct <br>
compiler tools?<br>
<br></blockquote><div>This patch is about respecting the current CC value in portage. It could be clang, icc, or something else</div><div>What should be the value of CC should be up to the user's portage config.</div><div><br></div><div>In Chrome OS
e.g., we have multiple possible CC's with variants like <abi>-clang. So hardcoding clang</div><div>also does not look correct.</div><div><br></div><div>Thanks,</div><div>Manoj</div><div> </div><blockquote class="gmail_quote" style="margin:
0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Cheers</blockquote></div></div>
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)