Em Tue, Feb 05, 2019 at 11:24:46PM -0800, Andrii Nakryiko escreveu: > This change allows to use libbpf definitions and APIs from pahole. > > Signed-off-by: Andrii Nakryiko <andriin@xxxxxx> > --- > .gitmodules | 3 +++ > CMakeLists.txt | 32 ++++++++++++++++++++++++++++++-- > lib/bpf | 1 + > 3 files changed, 34 insertions(+), 2 deletions(-) > create mode 100644 .gitmodules > create mode 160000 lib/bpf > > diff --git a/.gitmodules b/.gitmodules > new file mode 100644 > index 0000000..6be99dc > --- /dev/null > +++ b/.gitmodules > @@ -0,0 +1,3 @@ > +[submodule "lib/bpf"] > + path = lib/bpf > + url = https://github.com/libbpf/libbpf Nifty, seems to work but then there is a warning about bzero() not being declared: [acme@quaco pahole]$ am /wb/1.patch Applying: pahole: add libbpf as submodule under lib/bpf [master bb826736dc6b] pahole: Add libbpf as submodule under lib/bpf Author: Andrii Nakryiko <andriin@xxxxxx> Date: Tue Feb 5 23:24:46 2019 -0800 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 .gitmodules create mode 160000 lib/bpf [acme@quaco pahole]$ make -C build make: Entering directory '/home/acme/git/pahole/build' -- Checking availability of DWARF and ELF development libraries -- Checking availability of DWARF and ELF development libraries - done -- Submodule update Submodule 'lib/bpf' (https://github.com/libbpf/libbpf) registered for path 'lib/bpf' Cloning into '/home/acme/git/pahole/lib/bpf'... Submodule path 'lib/bpf': checked out 'b19c6dcf623a7adc9e538ddbe2964c2f58dd2417' -- Submodule update - done -- Configuring done -- Generating done -- Build files have been written to: /home/acme/git/pahole/build make[1]: Entering directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target bpf make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 2%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf.o /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_load_program_xattr’: /home/acme/git/pahole/lib/bpf/src/bpf.c:225:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration] bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c:225:2: warning: incompatible implicit declaration of built-in function ‘bzero’ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_verify_program’: /home/acme/git/pahole/lib/bpf/src/bpf.c:330:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_update_elem’: /home/acme/git/pahole/lib/bpf/src/bpf.c:350:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_lookup_elem’: /home/acme/git/pahole/lib/bpf/src/bpf.c:363:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_lookup_elem_flags’: /home/acme/git/pahole/lib/bpf/src/bpf.c:375:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_lookup_and_delete_elem’: /home/acme/git/pahole/lib/bpf/src/bpf.c:388:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_delete_elem’: /home/acme/git/pahole/lib/bpf/src/bpf.c:400:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_get_next_key’: /home/acme/git/pahole/lib/bpf/src/bpf.c:411:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_obj_pin’: /home/acme/git/pahole/lib/bpf/src/bpf.c:423:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_obj_get’: /home/acme/git/pahole/lib/bpf/src/bpf.c:434:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_attach’: /home/acme/git/pahole/lib/bpf/src/bpf.c:445:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_detach’: /home/acme/git/pahole/lib/bpf/src/bpf.c:458:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_detach2’: /home/acme/git/pahole/lib/bpf/src/bpf.c:469:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_query’: /home/acme/git/pahole/lib/bpf/src/bpf.c:483:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_test_run’: /home/acme/git/pahole/lib/bpf/src/bpf.c:504:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_test_run_xattr’: /home/acme/git/pahole/lib/bpf/src/bpf.c:529:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_get_next_id’: /home/acme/git/pahole/lib/bpf/src/bpf.c:549:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_get_next_id’: /home/acme/git/pahole/lib/bpf/src/bpf.c:564:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_prog_get_fd_by_id’: /home/acme/git/pahole/lib/bpf/src/bpf.c:578:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_map_get_fd_by_id’: /home/acme/git/pahole/lib/bpf/src/bpf.c:588:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_btf_get_fd_by_id’: /home/acme/git/pahole/lib/bpf/src/bpf.c:598:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_obj_get_info_by_fd’: /home/acme/git/pahole/lib/bpf/src/bpf.c:609:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/bpf.c: In function ‘bpf_raw_tracepoint_open’: /home/acme/git/pahole/lib/bpf/src/bpf.c:625:2: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&attr, sizeof(attr)); ^~~~~ [ 4%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/bpf_prog_linfo.o [ 6%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/btf.o /home/acme/git/pahole/lib/bpf/src/btf.c: In function ‘btf__get_from_id’: /home/acme/git/pahole/lib/bpf/src/btf.c:471:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration] bzero(ptr, last_size); ^~~~~ /home/acme/git/pahole/lib/bpf/src/btf.c:471:2: warning: incompatible implicit declaration of built-in function ‘bzero’ [ 8%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf.o /home/acme/git/pahole/lib/bpf/src/libbpf.c: In function ‘bpf_program__init’: /home/acme/git/pahole/lib/bpf/src/libbpf.c:310:2: warning: implicit declaration of function ‘bzero’ [-Wimplicit-function-declaration] bzero(prog, sizeof(*prog)); ^~~~~ /home/acme/git/pahole/lib/bpf/src/libbpf.c:310:2: warning: incompatible implicit declaration of built-in function ‘bzero’ /home/acme/git/pahole/lib/bpf/src/libbpf.c: In function ‘bpf_program__load’: /home/acme/git/pahole/lib/bpf/src/libbpf.c:1579:3: warning: incompatible implicit declaration of built-in function ‘bzero’ bzero(&result, sizeof(result)); ^~~~~ [ 10%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf_errno.o [ 12%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/libbpf_probes.o [ 14%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/netlink.o [ 16%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/nlattr.o [ 18%] Building C object CMakeFiles/bpf.dir/lib/bpf/src/str_error.o [ 20%] Linking C static library libbpf.a make[2]: Leaving directory '/home/acme/git/pahole/build' [ 20%] Built target bpf make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target dwarves make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 22%] Linking C shared library libdwarves.so make[2]: Leaving directory '/home/acme/git/pahole/build' [ 50%] Built target dwarves make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target codiff make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 52%] Linking C executable codiff make[2]: Leaving directory '/home/acme/git/pahole/build' [ 54%] Built target codiff make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target dwarves_reorganize make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 56%] Linking C shared library libdwarves_reorganize.so make[2]: Leaving directory '/home/acme/git/pahole/build' [ 58%] Built target dwarves_reorganize make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target dwarves_emit make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 60%] Linking C shared library libdwarves_emit.so make[2]: Leaving directory '/home/acme/git/pahole/build' [ 62%] Built target dwarves_emit make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target ctracer make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 64%] Linking C executable ctracer make[2]: Leaving directory '/home/acme/git/pahole/build' [ 66%] Built target ctracer make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target pglobal make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 68%] Linking C executable pglobal make[2]: Leaving directory '/home/acme/git/pahole/build' [ 70%] Built target pglobal make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target dtagnames make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 72%] Linking C executable dtagnames make[2]: Leaving directory '/home/acme/git/pahole/build' [ 74%] Built target dtagnames make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target pfunct make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 76%] Linking C executable pfunct make[2]: Leaving directory '/home/acme/git/pahole/build' [ 78%] Built target pfunct make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target prefcnt make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 80%] Linking C executable prefcnt make[2]: Leaving directory '/home/acme/git/pahole/build' [ 82%] Built target prefcnt make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target scncopy make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 84%] Linking C executable scncopy make[2]: Leaving directory '/home/acme/git/pahole/build' [ 88%] Built target scncopy make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target syscse make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 90%] Linking C executable syscse make[2]: Leaving directory '/home/acme/git/pahole/build' [ 92%] Built target syscse make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target pahole make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 94%] Linking C executable pahole make[2]: Leaving directory '/home/acme/git/pahole/build' [ 96%] Built target pahole make[2]: Entering directory '/home/acme/git/pahole/build' Scanning dependencies of target pdwtags make[2]: Leaving directory '/home/acme/git/pahole/build' make[2]: Entering directory '/home/acme/git/pahole/build' [ 98%] Linking C executable pdwtags make[2]: Leaving directory '/home/acme/git/pahole/build' [100%] Built target pdwtags make[1]: Leaving directory '/home/acme/git/pahole/build' make: Leaving directory '/home/acme/git/pahole/build' [acme@quaco pahole]$