[PATCH 6/9] perf build: Use the given CC rather than clang in clang builds
From: Ian Rogers
Date: Wed Sep 16 2026 - 02:15:59 EST
The clang block is entered when CC_NO_CLANG has determined that CC is
clang, but it then ignores CC and hard codes $(CLANG), which defaults to
plain "clang". Building with a versioned compiler silently switches
compiler:
$ make CC=clang-19 # actually builds with "clang"
Worse, the target triple is probed with $(CLANG) too, so on a machine
that only has versioned binaries installed the probe produces nothing
and the build stops:
$ make CC=clang-19
*** Specify CROSS_COMPILE or add CLANG_TARGET_FLAGS for x86_64
Use $(CC) in both places. Within the block CC is known to be clang, and
for "make LLVM=1" CC is already $(CLANG), so nothing changes there.
$(CLANG) is left as it is for BPF skeletons, as bpf_skel.mak builds
those with "$(CLANG) --target=bpf" whatever CC happens to be.
Fixes: 4772e66cb45e ("perf build: Support build with clang")
Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
Assisted-by: Antigravity:gemini-3.1-pro
---
tools/perf/Makefile.config | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile.config b/tools/perf/Makefile.config
index 31e4cbe192b9..dca62e155fb5 100644
--- a/tools/perf/Makefile.config
+++ b/tools/perf/Makefile.config
@@ -38,7 +38,7 @@ ifeq ($(CC_NO_CLANG), 0)
# Default to host architecture if ARCH is not explicitly given.
ifeq ($(ARCH), $(HOSTARCH))
- CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple)
+ CLANG_TARGET_FLAGS := $(shell $(CC) -print-target-triple)
else
CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH))
endif
@@ -53,7 +53,7 @@ ifeq ($(CC_NO_CLANG), 0)
CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%))
endif # CROSS_COMPILE
- CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as
+ CC := $(CC) $(CLANG_FLAGS) -fintegrated-as
# CC being clang says nothing about CXX: "make LLVM=1" overrides both, but
# "make CC=clang" leaves CXX as g++. Probe CXX the way Makefile.include
--
2.55.0.1032.g73a4cd73de-goog