* [PATCH] u-boot: always use GCC to build
@ 2026-08-04 11:41 Ross Burton
2026-08-05 1:08 ` [OE-core] " Khem Raj
2026-08-06 8:20 ` Quentin Schulz
0 siblings, 2 replies; 5+ messages in thread
From: Ross Burton @ 2026-08-04 11:41 UTC (permalink / raw)
To: openembedded-core
Previously, u-boot was almost always built with GCC because the
kernel-arch inherit set TOOLCHAIN to KERNEL_TOOLCHAIN, which defaulted
to 'gcc'.
However, since kernel-arch inherit was removed, u-boot in theory now
respects the default toolchain. In practise, the recipe hard-codes CC
to be gcc, and there are known caveats building u-boot with clang[2].
In the long term we should be able to make this recipe respect TOOLCHAIN,
as the upstream u-boot CI does build and test with clang, but for now
fix the build by restoring the explicit use of gcc.
[1] oe-core 8fb5470841b ("u-boot: Separate out from kernel-arch.bbclass")
[2] https://docs.u-boot-project.org/en/latest/build/clang.html
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
meta/recipes-bsp/u-boot/u-boot.inc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/meta/recipes-bsp/u-boot/u-boot.inc b/meta/recipes-bsp/u-boot/u-boot.inc
index 3e2f5aa1a5f..00a12f1bb91 100644
--- a/meta/recipes-bsp/u-boot/u-boot.inc
+++ b/meta/recipes-bsp/u-boot/u-boot.inc
@@ -3,6 +3,10 @@ PROVIDES = "virtual/bootloader"
PACKAGE_ARCH = "${MACHINE_ARCH}"
+# u-boot is best built with gcc
+# https://docs.u-boot-project.org/en/latest/build/clang.html
+TOOLCHAIN = "gcc"
+
DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
DEPENDS += "${@ 'u-boot-mkenvimage-native' if bb.utils.to_boolean(d.getVar('UBOOT_INITIAL_ENV_BINARY')) else ''}"
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] u-boot: always use GCC to build
2026-08-04 11:41 [PATCH] u-boot: always use GCC to build Ross Burton
@ 2026-08-05 1:08 ` Khem Raj
2026-08-05 9:44 ` Ross Burton
2026-08-06 8:20 ` Quentin Schulz
1 sibling, 1 reply; 5+ messages in thread
From: Khem Raj @ 2026-08-05 1:08 UTC (permalink / raw)
To: ross.burton; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2360 bytes --]
On Tue, Aug 4, 2026 at 4:41 AM Ross Burton via lists.openembedded.org
<ross.burton=arm.com@lists.openembedded.org> wrote:
> Previously, u-boot was almost always built with GCC because the
> kernel-arch inherit set TOOLCHAIN to KERNEL_TOOLCHAIN, which defaulted
> to 'gcc'.
>
> However, since kernel-arch inherit was removed, u-boot in theory now
> respects the default toolchain. In practise, the recipe hard-codes CC
> to be gcc, and there are known caveats building u-boot with clang[2].
>
None of these caveats are relevant to u-boot and clang versions we use
isn't it?
so it seems to be workaround for some issue that is now brought forth which
was
latent before ? if so, why not fix that
>
> In the long term we should be able to make this recipe respect TOOLCHAIN,
> as the upstream u-boot CI does build and test with clang, but for now
> fix the build by restoring the explicit use of gcc.
>
> [1] oe-core 8fb5470841b ("u-boot: Separate out from kernel-arch.bbclass")
> [2] https://docs.u-boot-project.org/en/latest/build/clang.html
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> meta/recipes-bsp/u-boot/u-boot.inc | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/meta/recipes-bsp/u-boot/u-boot.inc
> b/meta/recipes-bsp/u-boot/u-boot.inc
> index 3e2f5aa1a5f..00a12f1bb91 100644
> --- a/meta/recipes-bsp/u-boot/u-boot.inc
> +++ b/meta/recipes-bsp/u-boot/u-boot.inc
> @@ -3,6 +3,10 @@ PROVIDES = "virtual/bootloader"
>
> PACKAGE_ARCH = "${MACHINE_ARCH}"
>
> +# u-boot is best built with gcc
> +# https://docs.u-boot-project.org/en/latest/build/clang.html
> +TOOLCHAIN = "gcc"
> +
> DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr',
> 'u-boot-mkimage-native', '', d)}"
> DEPENDS += "${@ 'u-boot-mkenvimage-native' if
> bb.utils.to_boolean(d.getVar('UBOOT_INITIAL_ENV_BINARY')) else ''}"
>
> --
> 2.43.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#242718):
> https://lists.openembedded.org/g/openembedded-core/message/242718
> Mute This Topic: https://lists.openembedded.org/mt/120591917/1997914
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> raj.khem@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
[-- Attachment #2: Type: text/html, Size: 3873 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] u-boot: always use GCC to build
2026-08-05 1:08 ` [OE-core] " Khem Raj
@ 2026-08-05 9:44 ` Ross Burton
0 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2026-08-05 9:44 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-core@lists.openembedded.org
On 5 Aug 2026, at 02:08, Khem Raj <raj.khem@gmail.com> wrote:
>
> None of these caveats are relevant to u-boot and clang versions we use isn't it?
> so it seems to be workaround for some issue that is now brought forth which was
> latent before ? if so, why not fix that
Almost definitely not, but the immediate fix of restoring the original behaviour (always builds with gcc, even when TOOLCHAIN=clang) was provably a quick fix that could be merged. I filed a bug for myself to do the work so that the uboot recipe actually respects TOOLCHAIN.
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] u-boot: always use GCC to build
2026-08-04 11:41 [PATCH] u-boot: always use GCC to build Ross Burton
2026-08-05 1:08 ` [OE-core] " Khem Raj
@ 2026-08-06 8:20 ` Quentin Schulz
2026-08-06 13:07 ` Ross Burton
1 sibling, 1 reply; 5+ messages in thread
From: Quentin Schulz @ 2026-08-06 8:20 UTC (permalink / raw)
To: ross.burton, openembedded-core
Hi Ross,
On 8/4/26 1:41 PM, Ross Burton via lists.openembedded.org wrote:
> Previously, u-boot was almost always built with GCC because the
> kernel-arch inherit set TOOLCHAIN to KERNEL_TOOLCHAIN, which defaulted
> to 'gcc'.
>
> However, since kernel-arch inherit was removed, u-boot in theory now
> respects the default toolchain. In practise, the recipe hard-codes CC
> to be gcc, and there are known caveats building u-boot with clang[2].
>
> In the long term we should be able to make this recipe respect TOOLCHAIN,
> as the upstream u-boot CI does build and test with clang, but for now
> fix the build by restoring the explicit use of gcc.
>
You don't say what is the issue we encounter when building this recipe
with clang so this can be summed up to "fix issue" which isn't
particularly helpful :) Could you consider providing a bit more info
about build breakage in the commit log? I've built semi-recently (a few
months ago) Rockchip (ARM and ARM64) devices with clang and couldn't
build any of the ARM (thus 32b) SoCs at that time. I am traveling right
now so cannot give you a link to the U-Boot ML archive but look for
"Couple of clang warnings for Rockchip boards" from April 22nd, 2026.
Cheers,
Quentin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH] u-boot: always use GCC to build
2026-08-06 8:20 ` Quentin Schulz
@ 2026-08-06 13:07 ` Ross Burton
0 siblings, 0 replies; 5+ messages in thread
From: Ross Burton @ 2026-08-06 13:07 UTC (permalink / raw)
To: Quentin Schulz; +Cc: openembedded-core@lists.openembedded.org
On 6 Aug 2026, at 09:20, Quentin Schulz <quentin.schulz@cherry.de> wrote:
> You don't say what is the issue we encounter when building this recipe with clang so this can be summed up to "fix issue" which isn't particularly helpful :)
Sorry. At the time the message was sent the failure was “the makefile explicitly calls gcc, but clang is in the sysroot”.
Ross
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-08-06 13:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04 11:41 [PATCH] u-boot: always use GCC to build Ross Burton
2026-08-05 1:08 ` [OE-core] " Khem Raj
2026-08-05 9:44 ` Ross Burton
2026-08-06 8:20 ` Quentin Schulz
2026-08-06 13:07 ` Ross Burton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox