[PATCH] D53261: [BPF] Add BTF generation for BPF target

Yonghong Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 20 00:30:12 PDT 2018


yonghong-song added a comment.

@dblaikie Thanks for the review. All of code review parts make sense. Currently I am experimenting with IR->BTF. Once that is ready we can decide whether we do IR->BTF or Dwarf->BTF. If Dwarf->BTF is preferred, I will make changes.
For sizeof, the structure is already "packed" based on C standard. There are no holes.  But I can add packed attributes to the definition to make it portable across different platforms.

For the question "Is this a feature already implemented in another compiler? How much room is there for design input? (wondering if, rather than reinventing the format, there could be an extension attribute in the DWARF saying "yeah, I guarantee I've met the requirements to use this in the driver" (or whatever it is))"

The .BTF section has been implemented in pahole and in linux kernel. Since it has been implemented in linux kernel as part of syscall interface, it becomes a kernel ABI and we cannot change any more.
But the structure itself has a version number, we could bump version number with different structures. The .BTF.ext section is new, not landed in kernel yet. So changes are possible.

Since the debug info passed to kernel needs to be parsed and *verified* by kernel before using it. In the past, the kernel community has rejected the dwarf parser/verifier inside the kernle due to its complexity
and that is why people designed BTF (simple parser and verifier). Any idea to improve the interface is surely welcome.

Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D53261





More information about the llvm-commits mailing list