[PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools

James Clark posted 4 patches 1 week, 3 days ago
tools/bpf/resolve_btfids/Makefile    |  3 --
tools/lib/api/Makefile               |  4 --
tools/lib/bpf/Makefile               |  8 ++--
tools/lib/subcmd/Makefile            |  4 --
tools/lib/symbol/Makefile            |  4 --
tools/perf/Makefile.perf             |  7 ----
tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
tools/testing/selftests/bpf/Makefile |  1 -
8 files changed, 46 insertions(+), 62 deletions(-)
[PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by James Clark 1 week, 3 days ago
I ran into the build issue mentioned in the first commit, because using
an option like LLVM=-15 is a documented way to build [1], but only
some of the LLVM tools defined in tools/ support this.

After fixing that, a lot of other tidyups fell out. I didn't go too far,
for example some selftests include tools/testing/selftests/lib.mk which
reimplements some of the LLVM_SUFFIX stuff, but other selftests include
tools/scripts/Makefile.include and I stopped before touching the former.
Some other non build scripts hard code toolchains and I didn't touch
those either, this change is only focused on things that already
include Makefile.include.

[1]: Documentation/kbuild/llvm.rst

Signed-off-by: James Clark <james.clark@linaro.org>
---
Changes in v4:
- Drop "tools/build: selftests: Allow versioning LLVM lld", clang
  already picks the correct sibling lld version. (Sashiko)
- Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org

Changes in v3:
- Add warning for empty $USE_LD
- Use $HOSTREADELF in bpf Makefile
- Rebase on v7.2-rc3
- Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org

Changes in v2:
- Fix selftests/bpf build. LLD needs to take the full path to be used
  with -fuse-ld=
- Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org

---
James Clark (4):
      tools/build: Allow versioning of all LLVM tools defined in Makefile.include
      tools/build: Indent if else blocks
      tools/build: Allow versioning LLVM readelf
      tools/build: selftests: Remove some duplicate toolchain definitions

 tools/bpf/resolve_btfids/Makefile    |  3 --
 tools/lib/api/Makefile               |  4 --
 tools/lib/bpf/Makefile               |  8 ++--
 tools/lib/subcmd/Makefile            |  4 --
 tools/lib/symbol/Makefile            |  4 --
 tools/perf/Makefile.perf             |  7 ----
 tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
 tools/testing/selftests/bpf/Makefile |  1 -
 8 files changed, 46 insertions(+), 62 deletions(-)
---
base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
change-id: 20260511-james-perf-llvm-version-43ab1cb5bc7d

Best regards,
-- 
James Clark <james.clark@linaro.org>
Re: [PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by Namhyung Kim 1 week, 2 days ago
Hello BPF folks,

On Wed, Jul 15, 2026 at 03:53:47PM +0100, James Clark wrote:
> I ran into the build issue mentioned in the first commit, because using
> an option like LLVM=-15 is a documented way to build [1], but only
> some of the LLVM tools defined in tools/ support this.
> 
> After fixing that, a lot of other tidyups fell out. I didn't go too far,
> for example some selftests include tools/testing/selftests/lib.mk which
> reimplements some of the LLVM_SUFFIX stuff, but other selftests include
> tools/scripts/Makefile.include and I stopped before touching the former.
> Some other non build scripts hard code toolchains and I didn't touch
> those either, this change is only focused on things that already
> include Makefile.include.
> 
> [1]: Documentation/kbuild/llvm.rst
> 
> Signed-off-by: James Clark <james.clark@linaro.org>
> ---
> Changes in v4:
> - Drop "tools/build: selftests: Allow versioning LLVM lld", clang
>   already picks the correct sibling lld version. (Sashiko)
> - Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org
> 
> Changes in v3:
> - Add warning for empty $USE_LD
> - Use $HOSTREADELF in bpf Makefile
> - Rebase on v7.2-rc3
> - Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org
> 
> Changes in v2:
> - Fix selftests/bpf build. LLD needs to take the full path to be used
>   with -fuse-ld=
> - Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org
> 
> ---
> James Clark (4):
>       tools/build: Allow versioning of all LLVM tools defined in Makefile.include
>       tools/build: Indent if else blocks
>       tools/build: Allow versioning LLVM readelf
>       tools/build: selftests: Remove some duplicate toolchain definitions
> 
>  tools/bpf/resolve_btfids/Makefile    |  3 --
>  tools/lib/api/Makefile               |  4 --
>  tools/lib/bpf/Makefile               |  8 ++--
>  tools/lib/subcmd/Makefile            |  4 --
>  tools/lib/symbol/Makefile            |  4 --
>  tools/perf/Makefile.perf             |  7 ----
>  tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
>  tools/testing/selftests/bpf/Makefile |  1 -
>  8 files changed, 46 insertions(+), 62 deletions(-)

Are you ok with this change and going through perf tree?

Thanks,
Namhyung

> ---
> base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
> change-id: 20260511-james-perf-llvm-version-43ab1cb5bc7d
> 
> Best regards,
> -- 
> James Clark <james.clark@linaro.org>
>
Re: [PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by Kumar Kartikeya Dwivedi 22 hours ago
On Thu Jul 16, 2026 at 1:46 AM CEST, Namhyung Kim wrote:
> Hello BPF folks,
>
> On Wed, Jul 15, 2026 at 03:53:47PM +0100, James Clark wrote:
>> I ran into the build issue mentioned in the first commit, because using
>> an option like LLVM=-15 is a documented way to build [1], but only
>> some of the LLVM tools defined in tools/ support this.
>>
>> After fixing that, a lot of other tidyups fell out. I didn't go too far,
>> for example some selftests include tools/testing/selftests/lib.mk which
>> reimplements some of the LLVM_SUFFIX stuff, but other selftests include
>> tools/scripts/Makefile.include and I stopped before touching the former.
>> Some other non build scripts hard code toolchains and I didn't touch
>> those either, this change is only focused on things that already
>> include Makefile.include.
>>
>> [1]: Documentation/kbuild/llvm.rst
>>
>> Signed-off-by: James Clark <james.clark@linaro.org>
>> ---
>> Changes in v4:
>> - Drop "tools/build: selftests: Allow versioning LLVM lld", clang
>>   already picks the correct sibling lld version. (Sashiko)
>> - Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org
>>
>> Changes in v3:
>> - Add warning for empty $USE_LD
>> - Use $HOSTREADELF in bpf Makefile
>> - Rebase on v7.2-rc3
>> - Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org
>>
>> Changes in v2:
>> - Fix selftests/bpf build. LLD needs to take the full path to be used
>>   with -fuse-ld=
>> - Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org
>>
>> ---
>> James Clark (4):
>>       tools/build: Allow versioning of all LLVM tools defined in Makefile.include
>>       tools/build: Indent if else blocks
>>       tools/build: Allow versioning LLVM readelf
>>       tools/build: selftests: Remove some duplicate toolchain definitions
>>
>>  tools/bpf/resolve_btfids/Makefile    |  3 --
>>  tools/lib/api/Makefile               |  4 --
>>  tools/lib/bpf/Makefile               |  8 ++--
>>  tools/lib/subcmd/Makefile            |  4 --
>>  tools/lib/symbol/Makefile            |  4 --
>>  tools/perf/Makefile.perf             |  7 ----
>>  tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
>>  tools/testing/selftests/bpf/Makefile |  1 -
>>  8 files changed, 46 insertions(+), 62 deletions(-)
>
> Are you ok with this change and going through perf tree?
>

Sorry for the delay, yes, feel free to take it through your tree.

> Thanks,
> Namhyung
>
>> ---
>> base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
>> change-id: 20260511-james-perf-llvm-version-43ab1cb5bc7d
>>
>> Best regards,
>> --
>> James Clark <james.clark@linaro.org>
>>
Re: [PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by Namhyung Kim 16 hours ago
On Fri, Jul 24, 2026 at 07:19:45PM +0200, Kumar Kartikeya Dwivedi wrote:
> On Thu Jul 16, 2026 at 1:46 AM CEST, Namhyung Kim wrote:
> > Hello BPF folks,
> >
> > On Wed, Jul 15, 2026 at 03:53:47PM +0100, James Clark wrote:
> >> I ran into the build issue mentioned in the first commit, because using
> >> an option like LLVM=-15 is a documented way to build [1], but only
> >> some of the LLVM tools defined in tools/ support this.
> >>
> >> After fixing that, a lot of other tidyups fell out. I didn't go too far,
> >> for example some selftests include tools/testing/selftests/lib.mk which
> >> reimplements some of the LLVM_SUFFIX stuff, but other selftests include
> >> tools/scripts/Makefile.include and I stopped before touching the former.
> >> Some other non build scripts hard code toolchains and I didn't touch
> >> those either, this change is only focused on things that already
> >> include Makefile.include.
> >>
> >> [1]: Documentation/kbuild/llvm.rst
> >>
> >> Signed-off-by: James Clark <james.clark@linaro.org>
> >> ---
> >> Changes in v4:
> >> - Drop "tools/build: selftests: Allow versioning LLVM lld", clang
> >>   already picks the correct sibling lld version. (Sashiko)
> >> - Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org
> >>
> >> Changes in v3:
> >> - Add warning for empty $USE_LD
> >> - Use $HOSTREADELF in bpf Makefile
> >> - Rebase on v7.2-rc3
> >> - Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org
> >>
> >> Changes in v2:
> >> - Fix selftests/bpf build. LLD needs to take the full path to be used
> >>   with -fuse-ld=
> >> - Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org
> >>
> >> ---
> >> James Clark (4):
> >>       tools/build: Allow versioning of all LLVM tools defined in Makefile.include
> >>       tools/build: Indent if else blocks
> >>       tools/build: Allow versioning LLVM readelf
> >>       tools/build: selftests: Remove some duplicate toolchain definitions
> >>
> >>  tools/bpf/resolve_btfids/Makefile    |  3 --
> >>  tools/lib/api/Makefile               |  4 --
> >>  tools/lib/bpf/Makefile               |  8 ++--
> >>  tools/lib/subcmd/Makefile            |  4 --
> >>  tools/lib/symbol/Makefile            |  4 --
> >>  tools/perf/Makefile.perf             |  7 ----
> >>  tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
> >>  tools/testing/selftests/bpf/Makefile |  1 -
> >>  8 files changed, 46 insertions(+), 62 deletions(-)
> >
> > Are you ok with this change and going through perf tree?
> >
> 
> Sorry for the delay, yes, feel free to take it through your tree.

Thanks, can I take it as your Acked-by?

Namhyung
Re: [PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by Kumar Kartikeya Dwivedi 16 hours ago
On Sat Jul 25, 2026 at 1:31 AM CEST, Namhyung Kim wrote:
> On Fri, Jul 24, 2026 at 07:19:45PM +0200, Kumar Kartikeya Dwivedi wrote:
>> On Thu Jul 16, 2026 at 1:46 AM CEST, Namhyung Kim wrote:
>> > Hello BPF folks,
>> >
>> > On Wed, Jul 15, 2026 at 03:53:47PM +0100, James Clark wrote:
>> >> I ran into the build issue mentioned in the first commit, because using
>> >> an option like LLVM=-15 is a documented way to build [1], but only
>> >> some of the LLVM tools defined in tools/ support this.
>> >>
>> >> After fixing that, a lot of other tidyups fell out. I didn't go too far,
>> >> for example some selftests include tools/testing/selftests/lib.mk which
>> >> reimplements some of the LLVM_SUFFIX stuff, but other selftests include
>> >> tools/scripts/Makefile.include and I stopped before touching the former.
>> >> Some other non build scripts hard code toolchains and I didn't touch
>> >> those either, this change is only focused on things that already
>> >> include Makefile.include.
>> >>
>> >> [1]: Documentation/kbuild/llvm.rst
>> >>
>> >> Signed-off-by: James Clark <james.clark@linaro.org>
>> >> ---
>> >> Changes in v4:
>> >> - Drop "tools/build: selftests: Allow versioning LLVM lld", clang
>> >>   already picks the correct sibling lld version. (Sashiko)
>> >> - Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org
>> >>
>> >> Changes in v3:
>> >> - Add warning for empty $USE_LD
>> >> - Use $HOSTREADELF in bpf Makefile
>> >> - Rebase on v7.2-rc3
>> >> - Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org
>> >>
>> >> Changes in v2:
>> >> - Fix selftests/bpf build. LLD needs to take the full path to be used
>> >>   with -fuse-ld=
>> >> - Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org
>> >>
>> >> ---
>> >> James Clark (4):
>> >>       tools/build: Allow versioning of all LLVM tools defined in Makefile.include
>> >>       tools/build: Indent if else blocks
>> >>       tools/build: Allow versioning LLVM readelf
>> >>       tools/build: selftests: Remove some duplicate toolchain definitions
>> >>
>> >>  tools/bpf/resolve_btfids/Makefile    |  3 --
>> >>  tools/lib/api/Makefile               |  4 --
>> >>  tools/lib/bpf/Makefile               |  8 ++--
>> >>  tools/lib/subcmd/Makefile            |  4 --
>> >>  tools/lib/symbol/Makefile            |  4 --
>> >>  tools/perf/Makefile.perf             |  7 ----
>> >>  tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
>> >>  tools/testing/selftests/bpf/Makefile |  1 -
>> >>  8 files changed, 46 insertions(+), 62 deletions(-)
>> >
>> > Are you ok with this change and going through perf tree?
>> >
>>
>> Sorry for the delay, yes, feel free to take it through your tree.
>
> Thanks, can I take it as your Acked-by?
>

Sure.

Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>

> Namhyung
Re: [PATCH v4 0/4] tools/build: Allow versioning of all LLVM tools
Posted by Ian Rogers 1 week, 2 days ago
On Wed, Jul 15, 2026 at 7:54 AM James Clark <james.clark@linaro.org> wrote:
>
> I ran into the build issue mentioned in the first commit, because using
> an option like LLVM=-15 is a documented way to build [1], but only
> some of the LLVM tools defined in tools/ support this.
>
> After fixing that, a lot of other tidyups fell out. I didn't go too far,
> for example some selftests include tools/testing/selftests/lib.mk which
> reimplements some of the LLVM_SUFFIX stuff, but other selftests include
> tools/scripts/Makefile.include and I stopped before touching the former.
> Some other non build scripts hard code toolchains and I didn't touch
> those either, this change is only focused on things that already
> include Makefile.include.
>
> [1]: Documentation/kbuild/llvm.rst
>
> Signed-off-by: James Clark <james.clark@linaro.org>

For the series:

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

> ---
> Changes in v4:
> - Drop "tools/build: selftests: Allow versioning LLVM lld", clang
>   already picks the correct sibling lld version. (Sashiko)
> - Link to v3: https://lore.kernel.org/r/20260715-james-perf-llvm-version-v3-0-8854bfe5af7e@linaro.org
>
> Changes in v3:
> - Add warning for empty $USE_LD
> - Use $HOSTREADELF in bpf Makefile
> - Rebase on v7.2-rc3
> - Link to v2: https://lore.kernel.org/r/20260518-james-perf-llvm-version-v2-0-f12cc4f031d8@linaro.org
>
> Changes in v2:
> - Fix selftests/bpf build. LLD needs to take the full path to be used
>   with -fuse-ld=
> - Link to v1: https://lore.kernel.org/r/20260514-james-perf-llvm-version-v1-0-6cac1a9a4c8d@linaro.org
>
> ---
> James Clark (4):
>       tools/build: Allow versioning of all LLVM tools defined in Makefile.include
>       tools/build: Indent if else blocks
>       tools/build: Allow versioning LLVM readelf
>       tools/build: selftests: Remove some duplicate toolchain definitions
>
>  tools/bpf/resolve_btfids/Makefile    |  3 --
>  tools/lib/api/Makefile               |  4 --
>  tools/lib/bpf/Makefile               |  8 ++--
>  tools/lib/subcmd/Makefile            |  4 --
>  tools/lib/symbol/Makefile            |  4 --
>  tools/perf/Makefile.perf             |  7 ----
>  tools/scripts/Makefile.include       | 77 ++++++++++++++++++++----------------
>  tools/testing/selftests/bpf/Makefile |  1 -
>  8 files changed, 46 insertions(+), 62 deletions(-)
> ---
> base-commit: a13c140cc289c0b7b3770bce5b3ad42ab35074aa
> change-id: 20260511-james-perf-llvm-version-43ab1cb5bc7d
>
> Best regards,
> --
> James Clark <james.clark@linaro.org>
>