[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181121000555.ov2435hakwvqpavs@mini-arch.hsd1.ca.comcast.net>
Date: Tue, 20 Nov 2018 16:05:55 -0800
From: Stanislav Fomichev <sdf@...ichev.me>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>
Cc: Stanislav Fomichev <sdf@...gle.com>, netdev@...r.kernel.org,
ast@...nel.org, daniel@...earbox.net, ys114321@...il.com
Subject: Re: [PATCH bpf-next v2] libbpf: make sure bpf headers are c++
include-able
On 11/20, Alexei Starovoitov wrote:
> On Tue, Nov 20, 2018 at 01:37:23PM -0800, Stanislav Fomichev wrote:
> > Wrap headers in extern "C", to turn off C++ mangling.
> > This simplifies including libbpf in c++ and linking against it.
> >
> > v2 changes:
> > * do the same for btf.h
> >
> > Signed-off-by: Stanislav Fomichev <sdf@...gle.com>
> > ---
> > tools/lib/bpf/bpf.h | 9 +++++++++
> > tools/lib/bpf/btf.h | 8 ++++++++
> > tools/lib/bpf/libbpf.h | 9 +++++++++
> > 3 files changed, 26 insertions(+)
> >
> > diff --git a/tools/lib/bpf/bpf.h b/tools/lib/bpf/bpf.h
> > index 26a51538213c..9ea3aec82d8a 100644
> > --- a/tools/lib/bpf/bpf.h
> > +++ b/tools/lib/bpf/bpf.h
> > @@ -27,6 +27,10 @@
> > #include <stdbool.h>
> > #include <stddef.h>
> >
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif
>
> Acked-by: Alexei Starovoitov <ast@...nel.org>
>
> was wondering whether it's possible to make it testable.
> HOSTCXX is available, but I don't see much of the kernel tree
> using it...
By testable you mean compile some dummy c++ main and link against libbpf?
perf has something similar:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/perf/util/c++/clang-test.cpp#n7
But they don't use Makefiles for that (there is USE_CXX feature test as
well), so I'm not sure either :-/
Powered by blists - more mailing lists