]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
bpf_helpers.h: Add note for building with vmlinux.h or linux/types.h
authorYoshiki Komachi <komachi.yoshiki@gmail.com>
Tue, 21 Apr 2020 00:05:27 +0000 (09:05 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 26 Apr 2020 15:40:01 +0000 (08:40 -0700)
commitae460c022453337850bdc36a36bf7596a6cfcf99
tree07a6f1e5b9eff7629dbce7ef95a995ca16e82b3a
parent0456ea170cd665ddbb9503be92e39f96055dd5fa
bpf_helpers.h: Add note for building with vmlinux.h or linux/types.h

The following error was shown when a bpf program was compiled without
vmlinux.h auto-generated from BTF:

 # clang -I./linux/tools/lib/ -I/lib/modules/$(uname -r)/build/include/ \
   -O2 -Wall -target bpf -emit-llvm -c bpf_prog.c -o bpf_prog.bc
 ...
 In file included from linux/tools/lib/bpf/bpf_helpers.h:5:
 linux/tools/lib/bpf/bpf_helper_defs.h:56:82: error: unknown type name '__u64'
 ...

It seems that bpf programs are intended for being built together with
the vmlinux.h (which will have all the __u64 and other typedefs). But
users may mistakenly think "include <linux/types.h>" is missing
because the vmlinux.h is not common for non-bpf developers. IMO, an
explicit comment therefore should be added to bpf_helpers.h as this
patch shows.

Signed-off-by: Yoshiki Komachi <komachi.yoshiki@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/1587427527-29399-1-git-send-email-komachi.yoshiki@gmail.com
tools/lib/bpf/bpf_helpers.h