3 releases

0.1.2 Mar 10, 2023
0.1.1 Feb 13, 2023
0.1.0 Feb 11, 2023

#6 in #btf

Download history

112 downloads per month

MIT license

19KB
431 lines

Contains (ELF exe/lib, 2KB) source.bpf.o, (ELF exe/lib, 2KB) src/tests/nested-array.bpf.o

btf2wit

Conversion from BTF to WIT.

Usage: btf2wit [OPTIONS] <INPUT_FILE>

Arguments:
  <INPUT_FILE>  

Options:
  -o, --output-file <OUT_FILE>  
  -h, --help                    Print help
  -V, --version                 Print version

Extract BTF info from DWARF

  • Install pahole
sudo apt install pahole
  • Use clang or gcc to compile program with -g argument
clang simple.c -c -o simple.bpf.o -g
  • Use pahole to emit BTF info from DWARF and store it in the origin ELF file
pahole -J simple.bpf.o

Use btf2wit to emit WIT info from BTF

btf2wit simple.bpf.o -o simple.wit

Use wit-bindgen to emit bindings for C and Rust

wit-bindgen c simple.wit
wit-bindgen rust simple.wit

For examples, please refer to examples/simple.

License

MIT

Dependencies

~9.5MB
~163K SLoC