Skip to contentSkip to conversation

buildman: Correct override toolchain support for clang

PATCH In review Tom Rini 2 participants 3 messages Nov 6, 2025 – Nov 7, 2025

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 buildman: Correct override toolchain support for clang

When initially adding support for building with clang with buildman, there was some minimum logic in the Makefile to inform clang what the expected target was, without CROSS_COMPILE being set. This has long been deprecated / removed from the Linux kernel, and also not functional in U-Boot. The normal expectation, especially so that an intentional mix-and-match of GNU binutils and LLVM C compiler can be used relies on CROSS_COMPILE also being set and passed. To have buildman do this we only need to remove the logic that was not setting CROSS_COMPILE when we had an override. Correct the comment about what override_toolchain does as it is functional outside of sandbox too.

---
Cc: Simon Glass <[email protected]>

 tools/buildman/toolchain.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
tools/buildman/toolchain.py +2 -5
index 5e5bb4b0aedd..80468dfb4175 100644
@@ -57,7 +57,7 @@ class Toolchain:
         arch: Architecture of toolchain as determined from the first
                 component of the filename. E.g. arm-linux-gcc becomes arm
         priority: Toolchain priority (0=highest, 20=lowest)
-        override_toolchain: Toolchain to use for sandbox, overriding the normal
+        override_toolchain: Toolchain to use for CC/HOSTC, overriding the normal
                 one
     """
     def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC,
@@ -208,10 +208,7 @@ class Toolchain:
 
         wrapper = self.GetWrapper()
 
-        if self.override_toolchain:
-            # We'll use MakeArgs() to provide this
-            pass
-        elif full_path and self.cross:
+        if full_path and self.cross:
             env[b'CROSS_COMPILE'] = tools.to_bytes(
                 wrapper + os.path.join(self.path, self.cross))
         elif self.cross:
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Tom Rini

When initially adding support for building with clang with buildman, there was some minimum logic in the Makefile to inform clang what the expected target was, without CROSS_COMPILE being set. This has long been deprecated / removed from the Linux kernel, and also not functional in U-Boot. The normal expectation, especially so that an intentional mix-and-match of GNU binutils and LLVM C compiler can be used relies on CROSS_COMPILE also being set and passed. To have buildman do this we only need to remove the logic that was not setting CROSS_COMPILE when we had an override. Correct the comment about what override_toolchain does as it is functional outside of sandbox too.

Quoted 7 lines

---
Cc: Simon Glass <[email protected]>

 tools/buildman/toolchain.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

I don't recall trying clang with real boards.

author
#2 lore raw
Quoted 17 lines · Simon Glass
Quoted 16 lines · Tom Rini

When initially adding support for building with clang with buildman, there was some minimum logic in the Makefile to inform clang what the expected target was, without CROSS_COMPILE being set. This has long been deprecated / removed from the Linux kernel, and also not functional in U-Boot. The normal expectation, especially so that an intentional mix-and-match of GNU binutils and LLVM C compiler can be used relies on CROSS_COMPILE also being set and passed. To have buildman do this we only need to remove the logic that was not setting CROSS_COMPILE when we had an override. Correct the comment about what override_toolchain does as it is functional outside of sandbox too.

---
Cc: Simon Glass <[email protected]>

Quoted 7 lines
Quoted 3 lines
 tools/buildman/toolchain.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

I don't recall trying clang with real boards.

I did for a few years until things broke and I didn't have time nor incentive to try and fix. Now that someone has fixed clang builds in general and I've gotten someone to work on labgrid with upstream, we should have a lab posted shortly and clang will be part of the set of builds that gets tested.

Signature · 1 line
Tom