On 14/05/2026 11:02 am, [email protected] wrote:
tools/build: Allow versioning of all LLVM tools defined in Makefile.include

The version of LLVM tools can be given on the build command with
LLVM=-15, but this isn't applied to all tools. For example $(CC) gets
versioned, but $(CLANG) doesn't. This causes a Perf build with LTO=1 to
fail with an error about mixed clang versions:

  ld.lld: error: libperf/core.o: Unknown attribute kind (86)
    (Producer: 'LLVM18.1.8' Reader: 'LLVM 15.0.7')

This file has two "ifneq ($(LLVM),)" blocks adjacent to each other, so
merge these blocks making it obvious that all tools should be versioned
consistently and there is nothing special about each block.

This also reveals that ?= and "allow-override" are used inconsistently
between the blocks. "allow-override" is technically only required for
builtin variables, but isn't only used on them, and doesn't do any harm
if used on a non-builtin. Make them all "allow-override" for
consistency. The only functional difference this will cause is if there
is a file level definition of one of the variables followed by an
"#include of Makefile.include" which will now overwrite. But this isn't
done and in a later commit some of the duplicate definitions will be
removed for good measure.

There are also some other LLVM tools that are not defined here and will
be moved in a later commit.

Signed-off-by: James Clark <[email protected]>

This looks like a bug fix that corrects inconsistent LLVM tool versioning
introduced in an earlier commit. Should this include:

   Fixes: e9c281928c24 ("kbuild: Make $(LLVM) more flexible")


---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md

CI run summary: https://github.com/kernel-patches/bpf/actions/runs/25853166705

I did consider a fixes tag, but the only real bug is with Perf and LTO=1, and building it in this way has obviously never worked, so you could also argue this is new behavior.

I think it's quite and edge case and has some risk to break other tools if backported so I left the tag off.


Reply via email to