bpftool: Cast pointers for shadow types explicitly.
authorKui-Feng Lee <thinker.li@gmail.com>
Tue, 12 Mar 2024 01:37:26 +0000 (18:37 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 14 Mar 2024 20:34:21 +0000 (13:34 -0700)
commitc2a0257c1edf16c6acd2afac7572d7e9043b6577
treed68b6bd0f77702745446b0b6e15ce5558efb5d7a
parent9187210eee7d87eea37b45ea93454a88681894a4
bpftool: Cast pointers for shadow types explicitly.

According to a report, skeletons fail to assign shadow pointers when being
compiled with C++ programs. Unlike C doing implicit casting for void
pointers, C++ requires an explicit casting.

To support C++, we do explicit casting for each shadow pointer.

Also add struct_ops_module.skel.h to test_cpp to validate C++
compilation as part of BPF selftests.

Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/bpf/20240312013726.1780720-1-thinker.li@gmail.com
tools/bpf/bpftool/gen.c
tools/testing/selftests/bpf/test_cpp.cpp