Skip to content

Tracking: what C++ BPF programs need today #4

Open

Description

@maxskokov

State as of October 2026, tested with clang built from llvm/llvm-project#233715, libbpf headers from bpf-next and a bpf-next 7.3-rc5 kernel.

With the workarounds below, a C++ BPF program builds, bpftool gen skeleton works, and the program loads and runs: CO-RE relocations are applied, kfuncs resolve, and tp_btf and kprobe programs work.

Compiler:

Headers and tools:

  • vmlinux.h is not valid C++ #2
  • bpf_helper_defs.h: = (void *) N does not convert to a function pointer in C++; (__typeof__(name)) N works in both C and C++ (scripts/bpf_doc.py)
  • typeof in libbpf headers needs -std=gnu++20; __typeof__ works in every mode
  • BPF_PROG(), BPF_KPROBE() and related macros rely on implicit integer to pointer conversion
  • Map definitions with an unnamed struct get internal linkage in C++ and libbpf rejects them; workaround: name the type

Documentation:

Each fix belongs upstream (clang, libbpf, bpftool or the kernel), following the vision. Links to patches will be added here as they are sent.

Activity

  1. added
    upstream
    on Oct 20, 2026
  2. pinned this issue on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    upstream

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions