提交 8e2f618e 编写于 作者: A Andrii Nakryiko 提交者: Daniel Borkmann

libbpf: Make __kptr and __kptr_ref unconditionally use btf_type_tag() attr

It will be annoying and surprising for users of __kptr and __kptr_ref if
libbpf silently ignores them just because Clang used for compilation
didn't support btf_type_tag(). It's much better to get clear compiler
error than debug BPF verifier failures later on.

Fixes: ef89654f ("libbpf: Add kptr type tag macros to bpf_helpers.h")
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220509004148.1801791-3-andrii@kernel.org
上级 1e2666e0
...@@ -149,13 +149,8 @@ enum libbpf_tristate { ...@@ -149,13 +149,8 @@ enum libbpf_tristate {
#define __kconfig __attribute__((section(".kconfig"))) #define __kconfig __attribute__((section(".kconfig")))
#define __ksym __attribute__((section(".ksyms"))) #define __ksym __attribute__((section(".ksyms")))
#if __has_attribute(btf_type_tag)
#define __kptr __attribute__((btf_type_tag("kptr"))) #define __kptr __attribute__((btf_type_tag("kptr")))
#define __kptr_ref __attribute__((btf_type_tag("kptr_ref"))) #define __kptr_ref __attribute__((btf_type_tag("kptr_ref")))
#else
#define __kptr
#define __kptr_ref
#endif
#ifndef ___bpf_concat #ifndef ___bpf_concat
#define ___bpf_concat(a, b) a ## b #define ___bpf_concat(a, b) a ## b
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册