Skip to content

template: build warning-free under clang 22 - #37

Merged
julian-goldstein merged 1 commit into
masterfrom
toolchain-v0.10.1
Oct 27, 2026
Merged

julian-goldstein merged 1 commit into
masterfrom
toolchain-v0.10.1

Conversation

@julian-goldstein

@julian-goldstein julian-goldstein commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Silence the 9 -Wmissing-declarations warnings from vmlinux.h. bpftool dumps the kernel's tagged anonymous members verbatim (struct slock_owned; inside a union), which clang 22 now flags. gen-vmlinux.sh prepends #pragma clang system_header to the generated header. Diagnostics only: CO-RE relocations and preserve_access_index are unaffected, and user headers in src/bpf/include keep full -Wall.
  • Fix the loop not unrolled warning in runqlat.bpf.c. clang 22 refuses #pragma unroll on a loop with an early break. The log2 bucketing now uses the branchless binary-search log2 from libbpf-tools: same floor(log2(delta)) result, fixed instruction count, nothing for the verifier to bound.
  • Makefile: default TOOLCHAIN_TAG to v0.10.1, matching the already-synced vendored toolchain (it still said v0.1, which no longer exists on the release server).

Test plan

  • scripts/new into a scratch dir, then make: both BPF units compile with the v0.10.1 clang, link into bin/probe.bpf.o, esbuild bundles.
  • make clean-bpf && make bpf produces zero warning lines (previously 19).
  • New log2 checked against the old loop for all values below 2^22, every power-of-two boundary up to 2^63, and a spread of large values: zero mismatches.

- gen-vmlinux.sh: prepend `#pragma clang system_header` to the generated
  vmlinux.h. bpftool dumps the kernel's tagged anonymous members verbatim
  (`struct foo;` inside a union), which clang 22 reports under
  -Wmissing-declarations. Diagnostics only; CO-RE is untouched.
- runqlat.bpf.c: replace the `#pragma unroll` log2 loop (clang 22 refuses
  to unroll a loop with an early exit) with the branchless binary-search
  log2 from libbpf-tools. Same bucketing, fixed instruction count.
- Makefile: default TOOLCHAIN_TAG to v0.10.1, matching the synced vendor.
@julian-goldstein julian-goldstein changed the title toolchain: sync v0.10.1, build warning-free under clang 22 template: build warning-free under clang 22 Oct 27, 2026
@julian-goldstein
julian-goldstein merged commit 9bf4601 into master Oct 27, 2026
2 checks passed
@julian-goldstein
julian-goldstein deleted the toolchain-v0.10.1 branch October 27, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant