Skip to contentSkip to conversation

tools/resolve_btfids: Fix build when cross compiling kernel with clang.

PATCH Applied Suleiman Souhlal 3 participants 3 messages Jun 6, 2025 – Jun 10, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tools/resolve_btfids: Fix build when cross compiling kernel with clang.

When cross compiling the kernel with clang, we need to override CLANG_CROSS_FLAGS when preparing the step libraries.

Prior to commit d1d096312176 ("tools: fix annoying "mkdir -p ..." logs when building tools in parallel"), MAKEFLAGS would have been set to a value that wouldn't set a value for CLANG_CROSS_FLAGS, hiding the fact that we weren't properly overriding it.

Fixes 56a2df7615fa ("tools/resolve_btfids: Compile resolve_btfids as host program")

---
v2:
- "Signed-off-by:" instead of "Signed-of-by".

v1: https://lore.kernel.org/lkml/[email protected]/

---
 tools/bpf/resolve_btfids/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/resolve_btfids/Makefile +1 -1
index afbddea3a39c..ce1b556dfa90 100644
@@ -17,7 +17,7 @@ endif
 
 # Overrides for the prepare step libraries.
 HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)" \
-		  CROSS_COMPILE="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
+		  CROSS_COMPILE="" CLANG_CROSS_FLAGS="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
 
 RM      ?= rm
 HOSTCC  ?= gcc
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
Acked-by on v2 1/1
#1 lore raw
Quoted 11 lines · Suleiman Souhlal

When cross compiling the kernel with clang, we need to override CLANG_CROSS_FLAGS when preparing the step libraries.

Prior to commit d1d096312176 ("tools: fix annoying "mkdir -p ..." logs when building tools in parallel"), MAKEFLAGS would have been set to a value that wouldn't set a value for CLANG_CROSS_FLAGS, hiding the fact that we weren't properly overriding it.

Fixes 56a2df7615fa ("tools/resolve_btfids: Compile resolve_btfids as host program")

lgtm

thanks,
jirka

Quoted 25 lines

---
v2:
- "Signed-off-by:" instead of "Signed-of-by".

v1: https://lore.kernel.org/lkml/[email protected]/

---
 tools/bpf/resolve_btfids/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bpf/resolve_btfids/Makefile +1 -1
index afbddea3a39c..ce1b556dfa90 100644
@@ -17,7 +17,7 @@ endif
 
 # Overrides for the prepare step libraries.
 HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)" \
-		  CROSS_COMPILE="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
+		  CROSS_COMPILE="" CLANG_CROSS_FLAGS="" EXTRA_CFLAGS="$(HOSTCFLAGS)"
 
 RM      ?= rm
 HOSTCC  ?= gcc
Signature · 1 line
2.50.0.rc0.642.g800a2b2222-goog
#2 lore raw
In reply to Suleiman Souhlal
This patch was applied to bpf/bpf.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Andrii Nakryiko <[email protected]>:

Quoted 9 lines · On Fri, 6 Jun 2025 16:45:38 +0900 you wrote:

When cross compiling the kernel with clang, we need to override CLANG_CROSS_FLAGS when preparing the step libraries.

Prior to commit d1d096312176 ("tools: fix annoying "mkdir -p ..." logs when building tools in parallel"), MAKEFLAGS would have been set to a value that wouldn't set a value for CLANG_CROSS_FLAGS, hiding the fact that we weren't properly overriding it.

[...]

Here is the summary with links:
- [v2] tools/resolve_btfids: Fix build when cross compiling kernel with clang.

    https://git.kernel.org/bpf/bpf/c/a298bbab903e

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html