[llvm-dev] [Request to Review] [BPF] Add BTF generation for BPF target

Y Song via llvm-dev llvm-dev at lists.llvm.org
Sun Oct 14 12:47:26 PDT 2018


Hi,

I just submitted a patch https://reviews.llvm.org/D53261 which
adds BTF generation for BPF target. This is an improvement over
previous patch https://reviews.llvm.org/D52950 which lacks review,
has ill C format, some code "borrowing" from kernel and
lacking tests. This new patch (D53261) addressed all these issues.
Please help review.

The patch itself has a lengthy commit message on what use cases
it tries to solve and what ELF format it uses. Just give a rough
summary here:
   . BTF stands for BPF Type Format, a debug info format for BPF programs.
   . .BTF ELF section has been implemented in pahole for types,
     mimicing dwarf debug_info section.
   . This patch tried implement .BTF ELF section as well as .BTF.ext ELF
     section.
   . The .BTF.ext section implements func_info subsection (some kind of
     FUNC symbols + their types), and line_info subsection (mimicing
     dwarf debug_line section).
   . The consumer of .BTF and .BTF.ext is the kernel bpf loader and the kernel.

Huge thanks to Eric Liu, Fangrui Song, Rui Ueyama and Simon Pilgrim for
helping fixing various issues in my previous patch and now I have incorporated
all the fixes and clang-format runs clean as well.

Regards,

Yonghong


More information about the llvm-dev mailing list