[PATCH] D83289: [BPF] Emit unknown types as byte arrays

Andrii Nakryiko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 8 17:48:44 PST 2021


anakryiko added a comment.

In D83289#2549050 <https://reviews.llvm.org/D83289#2549050>, @iii wrote:

> Hi, it has been a long time, but I've finally implemented the support
> for the floating-point types in BTF. Here are the other pieces:
>
> - verifier+libbpf: https://github.com/iii-i/linux/commit/wip
> - just libbpf (same as the libbpf part of the above): https://github.com/iii-i/libbpf/commit/wip

fyi, github.com/libbpf/libbpf is derived from kernel sources, so there is no need for separate Github parts

> - pahole: https://github.com/iii-i/dwarves/commit/wip
>
> Could you please have a quick look regarding whether this all makes
> sense and whether we want to go forward with this? I can then split
> the commits and send them to the mailing lists for the proper review.

I still think float/double doesn't deserve its own BTF_KIND_FLOAT kind and all the extra code (and APIs). Just like DWARF is doing just fine with just a DW_ATE_float encoding in base_type kind, so can BTF have BTF_KIND_INT (unfortunate name, but it corresponds to DWARF's base_type) with special FLOAT encoding. Having 'float'/'double' as BTF_KIND_INT (without extra encoding bits) would make all this work with vmlinux.h generation with absolutely no changes in kernel, libbpf, pahole, today. We could also add FLOAT encoding for kernel to deal with calling conventions, though. That would still require less changes across existing tool chains and whichever other users of BTF are out there.

Either way, libbpf as it is right now is missing BTF sanitization bits. You'd probably want to implement BTF_KIND_FLOAT -> BTF_KIND_INT substitution for that in bpf_object__sanitize_btf().


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D83289/new/

https://reviews.llvm.org/D83289



More information about the llvm-commits mailing list