linux-stable/tools/lib
Toke Høiland-Jørgensen 8ed35dc115 libbpf: Define BTF_KIND_* constants in btf.h to avoid compilation errors
commit eaa266d83a upstream.

The btf.h header included with libbpf contains inline helper functions to
check for various BTF kinds. These helpers directly reference the
BTF_KIND_* constants defined in the kernel header, and because the header
file is included in user applications, this happens in the user application
compile units.

This presents a problem if a user application is compiled on a system with
older kernel headers because the constants are not available. To avoid
this, add #defines of the constants directly in btf.h before using them.

Since the kernel header moved to an enum for BTF_KIND_*, the #defines can
shadow the enum values without any errors, so we only need #ifndef guards
for the constants that predates the conversion to enum. We group these so
there's only one guard for groups of values that were added together.

  [0] Closes: https://github.com/libbpf/libbpf/issues/436

Fixes: 223f903e9c ("bpf: Rename BTF_KIND_TAG to BTF_KIND_DECL_TAG")
Fixes: 5b84bd1036 ("libbpf: Add support for BTF_KIND_TAG")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/bpf/20220118141327.34231-1-toke@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-04-08 13:59:00 +02:00
..
api tools api fs: Cache cgroupfs mount point 2021-02-17 15:09:08 -03:00
bpf libbpf: Define BTF_KIND_* constants in btf.h to avoid compilation errors 2022-04-08 13:59:00 +02:00
perf libperf tests: Fix typo in perf_evlist__open() failure error messages 2022-04-08 13:58:33 +02:00
subcmd libsubcmd: Fix use-after-free for realloc(..., 0) 2022-02-16 13:49:25 -03:00
symbol libsymbols kallsyms: Move hex2u64 out of header 2020-05-05 16:35:32 -03:00
traceevent libtraceevent: Add __rel_loc relative location attribute support 2021-12-06 15:37:22 -05:00
argv_split.c
bitmap.c tools lib: Adopt bitmap_intersects() operation from the kernel sources 2021-06-30 15:28:00 -03:00
ctype.c
find_bit.c tools: sync tools/bitmap with mother linux 2022-01-15 08:47:31 -08:00
hweight.c
list_sort.c tools lib: Adopt list_sort() from the kernel sources 2021-10-20 10:30:59 -03:00
rbtree.c tools/: replace HTTP links with HTTPS ones 2020-08-07 11:33:21 -07:00
str_error_r.c
string.c tools lib: Adopt memchr_inv() from kernel 2020-11-27 08:34:52 -03:00
vsprintf.c
zalloc.c