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

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 16 08:45:18 PDT 2018


aprantl added a comment.

Thanks!



================
Comment at: include/llvm/MC/MCBTFContext.h:23
+
+// The .BTF section format is defined at
+//   https://github.com/torvalds/linux/blob/master/include/uapi/linux/btf.h
----------------
```
/// \file
/// ...
```


================
Comment at: include/llvm/MC/MCBTFContext.h:167
+/// The .BTF.ext section header definition
+struct BTFExtHeader {
+  uint16_t Magic;
----------------
do you need any kind of packing attribute here for this to work on all platforms?


================
Comment at: include/llvm/MC/MCBTFContext.h:207
+static const char *const BTFKindStr[] = {
+    "UNKNOWN",    // BTF_KIND_UNKN
+    "INT",        // BTF_KIND_INT
----------------
You might want to look at include/llvm/BinaryFormat/Dwarf.h and include/llvm/BinaryFormat/Dwarf.def for how we usually do enums<->string conversions


================
Comment at: lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp:175
+Die2BTFEntryInt::Die2BTFEntryInt(const DIE &Die) : Die2BTFEntry(Die) {
+  // handle BTF_INT_ENCODING in IntVal
+  auto Encoding = Die2BTFEntry::getBaseTypeEncoding(Die);
----------------
`//  Handle BTF_INT_ENCODING in IntVal.`


================
Comment at: lib/CodeGen/AsmPrinter/Dwarf2BTF.cpp:181
+
+  // handle BTF_INT_OFFSET in IntVal
+  auto V = Die.findAttribute(dwarf::DW_AT_bit_offset);
----------------
ditto...


Repository:
  rL LLVM

https://reviews.llvm.org/D53261





More information about the llvm-commits mailing list