public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables
@ 2022-01-03 17:49 Adrian Ratiu
  2022-01-03 18:23 ` Mike Gilbert
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Ratiu @ 2022-01-03 17:49 UTC (permalink / raw
  To: gentoo-dev; +Cc: James Beddek, Andrew Savchenko, Manoj Gupta

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 & co should be set to their respective portage values.

[1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to Clang/LLVM

Co-authored-by: Manoj Gupta <manojgupta@chromium.org>
Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
---
Changes in v3:
  - Add rest of vars used by kernel builds (suggested by James)
  - Minor commit msg rewording

Changes in v2:
  - Set AR variable which is also required for linux-headers
  - Reword msg for clarity
---
 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..865c43d3153 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) LD=$(tc-getLD) AR=$(tc-getAR) NM=$(tc-getNM) NM=$(tc-getNM) OBOBJCOPY=$(tc-getOBJCOPY) READELF=$(tc-getREADELF) STRIP=$(tc-getSTRIP)"
 	export xmakeopts
 }
 
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables
  2022-01-03 17:49 [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables Adrian Ratiu
@ 2022-01-03 18:23 ` Mike Gilbert
  2022-01-04 23:25   ` Sam James
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Gilbert @ 2022-01-03 18:23 UTC (permalink / raw
  To: Gentoo Dev; +Cc: James Beddek, Andrew Savchenko, Manoj Gupta

On Mon, Jan 3, 2022 at 12:49 PM Adrian Ratiu <adrian.ratiu@collabora.com> 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 & co should be set to their respective portage values.
>
> [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
>
> Co-authored-by: Manoj Gupta <manojgupta@chromium.org>
> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
> ---
> Changes in v3:
>   - Add rest of vars used by kernel builds (suggested by James)
>   - Minor commit msg rewording
>
> Changes in v2:
>   - Set AR variable which is also required for linux-headers
>   - Reword msg for clarity
> ---
>  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..865c43d3153 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) LD=$(tc-getLD) AR=$(tc-getAR) NM=$(tc-getNM) NM=$(tc-getNM) OBOBJCOPY=$(tc-getOBJCOPY) READELF=$(tc-getREADELF) STRIP=$(tc-getSTRIP)"
>         export xmakeopts
>  }

This seems ok to me, at least given the way the eclass currently works.

At some point, we should really convert xmakeopts into an array. Any
of these variables might contain spaces, and that would break the
current implementation.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables
  2022-01-03 18:23 ` Mike Gilbert
@ 2022-01-04 23:25   ` Sam James
  2022-01-04 23:31     ` Mike
  0 siblings, 1 reply; 4+ messages in thread
From: Sam James @ 2022-01-04 23:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: James Beddek, Andrew Savchenko, Manoj Gupta


[-- Attachment #1.1: Type: text/plain, Size: 963 bytes --]



> On 3 Jan 2022, at 18:23, Mike Gilbert <floppym@gentoo.org> wrote:
> On Mon, Jan 3, 2022 at 12:49 PM Adrian Ratiu <adrian.ratiu@collabora.com <mailto:adrian.ratiu@collabora.com>> 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 & co should be set to their respective portage values.
>> 
>> [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default tools to Clang/LLVM
>> 
>> Co-authored-by: Manoj Gupta <manojgupta@chromium.org>
>> Signed-off-by: Adrian Ratiu <adrian.ratiu@collabora.com>
>> [snip]
> 
> This seems ok to me, at least given the way the eclass currently works.
> 
> At some point, we should really convert xmakeopts into an array. Any
> of these variables might contain spaces, and that would break the
> current implementation.


agreed, but lgtm

[-- Attachment #1.2: Type: text/html, Size: 6676 bytes --]

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables
  2022-01-04 23:25   ` Sam James
@ 2022-01-04 23:31     ` Mike
  0 siblings, 0 replies; 4+ messages in thread
From: Mike @ 2022-01-04 23:31 UTC (permalink / raw
  To: gentoo-dev



On 1/4/22 18:25, Sam James wrote:
> 
> 
>> On 3 Jan 2022, at 18:23, Mike Gilbert <floppym@gentoo.org 
>> <mailto:floppym@gentoo.org>> wrote: On Mon, Jan 3, 2022 at 12:49
>> PM Adrian Ratiu <adrian.ratiu@collabora.com 
>> <mailto:adrian.ratiu@collabora.com>> 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 & co should be set to their respective portage values.
>>> 
>>> [1] a0d1c951ef08 kbuild: support LLVM=1 to switch the default 
>>> tools to Clang/LLVM
>>> 
>>> Co-authored-by: Manoj Gupta <manojgupta@chromium.org 
>>> <mailto:manojgupta@chromium.org>> Signed-off-by: Adrian Ratiu 
>>> <adrian.ratiu@collabora.com <mailto:adrian.ratiu@collabora.com>> 
>>> [snip]
>> 
>> This seems ok to me, at least given the way the eclass currently
>> works.
>> 
>> At some point, we should really convert xmakeopts into an array. 
>> Any of these variables might contain spaces, and that would break 
>> the current implementation.
> 
> agreed, but lgtm


Thanks to both authors for your work, this has been committed. 

-- 
Mike Pagano
Gentoo Developer - Kernel Project
Gentoo Sources - Lead 
E-Mail     : mpagano@gentoo.org
GnuPG FP   : 52CC A0B0 F631 0B17 0142 F83F 92A6 DBEC 81F2 B137
Public Key : http://http://pgp.mit.edu/pks/lookup?search=0x92A6DBEC81F2B137&op=index


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-01-04 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-03 17:49 [gentoo-dev] [PATCH v3] kernel-2.eclass: Respect portage toolchain variables Adrian Ratiu
2022-01-03 18:23 ` Mike Gilbert
2022-01-04 23:25   ` Sam James
2022-01-04 23:31     ` Mike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox