summaryrefslogtreecommitdiff
path: root/tools/bpf
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2022-02-16 15:35:40 -0800
committerAlexei Starovoitov <ast@kernel.org>2022-02-16 16:58:51 -0800
commit9b6eb0478dfad3b0e7af6c73523d96826210f4fe (patch)
tree4f7a775147c617a41a4a4fc3c905b3cc37bcf098 /tools/bpf
parentf76d8507d23834f7e56b0fe95c82605e7d7e0efe (diff)
bpftool: Fix C++ additions to skeleton
Mark C++-specific T::open() and other methods as static inline to avoid symbol redefinition when multiple files use the same skeleton header in an application. Fixes: bb8ffe61ea45 ("bpftool: Add C++-specific open/load/etc skeleton wrappers") Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220216233540.216642-1-andrii@kernel.org
Diffstat (limited to 'tools/bpf')
-rw-r--r--tools/bpf/bpftool/gen.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index e461059a72ee..f8c1413523a3 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -834,13 +834,13 @@ static int do_skeleton(int argc, char **argv)
\n\
\n\
#ifdef __cplusplus \n\
- static struct %1$s *open(const struct bpf_object_open_opts *opts = nullptr);\n\
- static struct %1$s *open_and_load(); \n\
- static int load(struct %1$s *skel); \n\
- static int attach(struct %1$s *skel); \n\
- static void detach(struct %1$s *skel); \n\
- static void destroy(struct %1$s *skel); \n\
- static const void *elf_bytes(size_t *sz); \n\
+ static inline struct %1$s *open(const struct bpf_object_open_opts *opts = nullptr);\n\
+ static inline struct %1$s *open_and_load(); \n\
+ static inline int load(struct %1$s *skel); \n\
+ static inline int attach(struct %1$s *skel); \n\
+ static inline void detach(struct %1$s *skel); \n\
+ static inline void destroy(struct %1$s *skel); \n\
+ static inline const void *elf_bytes(size_t *sz); \n\
#endif /* __cplusplus */ \n\
}; \n\
\n\