Skip to content

Commit 09872c5

Browse files
anakryikoNobody
authored and
Nobody
committed
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: bb8ffe6 ("bpftool: Add C++-specific open/load/etc skeleton wrappers") Signed-off-by: Andrii Nakryiko <[email protected]>
1 parent 9903d3e commit 09872c5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tools/bpf/bpftool/gen.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -834,13 +834,13 @@ static int do_skeleton(int argc, char **argv)
834834
\n\
835835
\n\
836836
#ifdef __cplusplus \n\
837-
static struct %1$s *open(const struct bpf_object_open_opts *opts = nullptr);\n\
838-
static struct %1$s *open_and_load(); \n\
839-
static int load(struct %1$s *skel); \n\
840-
static int attach(struct %1$s *skel); \n\
841-
static void detach(struct %1$s *skel); \n\
842-
static void destroy(struct %1$s *skel); \n\
843-
static const void *elf_bytes(size_t *sz); \n\
837+
static inline struct %1$s *open(const struct bpf_object_open_opts *opts = nullptr);\n\
838+
static inline struct %1$s *open_and_load(); \n\
839+
static inline int load(struct %1$s *skel); \n\
840+
static inline int attach(struct %1$s *skel); \n\
841+
static inline void detach(struct %1$s *skel); \n\
842+
static inline void destroy(struct %1$s *skel); \n\
843+
static inline const void *elf_bytes(size_t *sz); \n\
844844
#endif /* __cplusplus */ \n\
845845
}; \n\
846846
\n\

0 commit comments

Comments
 (0)