mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-08-21 08:21:58 +02:00

The capstone devel headers define 'struct bpf_insn' in a way that clashes with
what is in the libbpf devel headers, so we so far need to avoid including both.
This is happening on the tools/build/feature/test-all.c file, where we try
building all the expected set of libraries to be normally available on a
system:
⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
In file included from test-bpf.c:3,
from test-all.c:150:
/home/acme/git/perf-tools-next/tools/include/uapi/linux/bpf.h:77:8: error: ‘bpf_insn’ defined as wrong kind of tag
77 | struct bpf_insn {
| ^~~~~~~~
⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
When doing so there is a trick where we define main to be
main_test_libcapstone, then include the individual
tools/build/feture/test-libcapstone.c capability query test, and then we undef
'main' because we'll do it all over again with the next expected library to
be tested (at this time 'lzma').
To complete this mechanism we need to, in test-all.c 'main' routine, to
call main_test_libcapstone(), which isn't being done, so the effect of
adding references to capstone in test-all.c are not achieved.
The only thing that is happening is that test-all.c is failing to build and thus
all the tests will have to be done individually, which nullifies the test-all.c
single build speedup.
So lets remove references to capstone from test-all.c to see if this makes it
build again so that we get faster builds or go on fixing up whatever is
preventing us to get that benefit.
Nothing: after this fix we get a clean test-all.c build and get the build speedup back:
⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-all.
test-all.bin test-all.d test-all.make.output
⬢[acme@toolbox perf-tools-next]$ cat /tmp/build/perf-tools-next/feature/test-all.make.output
⬢[acme@toolbox perf-tools-next]$ ldd /tmp/build/perf-tools-next/feature/test-all.bin
linux-vdso.so.1 (0x00007f13277a1000)
libpython3.12.so.1.0 => /lib64/libpython3.12.so.1.0 (0x00007f1326e00000)
libm.so.6 => /lib64/libm.so.6 (0x00007f13274be000)
libtraceevent.so.1 => /lib64/libtraceevent.so.1 (0x00007f1327496000)
libtracefs.so.1 => /lib64/libtracefs.so.1 (0x00007f132746f000)
libcrypto.so.3 => /lib64/libcrypto.so.3 (0x00007f1326800000)
libunwind-x86_64.so.8 => /lib64/libunwind-x86_64.so.8 (0x00007f1327452000)
libunwind.so.8 => /lib64/libunwind.so.8 (0x00007f1327436000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f1327403000)
libdw.so.1 => /lib64/libdw.so.1 (0x00007f1326d6f000)
libz.so.1 => /lib64/libz.so.1 (0x00007f13273e2000)
libelf.so.1 => /lib64/libelf.so.1 (0x00007f1326d53000)
libnuma.so.1 => /lib64/libnuma.so.1 (0x00007f13273d4000)
libslang.so.2 => /lib64/libslang.so.2 (0x00007f1326400000)
libperl.so.5.38 => /lib64/libperl.so.5.38 (0x00007f1326000000)
libc.so.6 => /lib64/libc.so.6 (0x00007f1325e0f000)
libzstd.so.1 => /lib64/libzstd.so.1 (0x00007f1326741000)
/lib64/ld-linux-x86-64.so.2 (0x00007f13277a3000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f1326d3f000)
libcrypt.so.2 => /lib64/libcrypt.so.2 (0x00007f1326d07000)
⬢[acme@toolbox perf-tools-next]$
And when having capstone-devel installed we get it detected and linked with
perf, allowing us to benefit from the features that it enables:
⬢[acme@toolbox perf-tools-next]$ rpm -q capstone-devel
capstone-devel-5.0.1-3.fc40.x86_64
⬢[acme@toolbox perf-tools-next]$ ldd /tmp/build/perf-tools-next/perf | grep capstone
libcapstone.so.5 => /lib64/libcapstone.so.5 (0x00007fe6a5c00000)
⬢[acme@toolbox perf-tools-next]$ /tmp/build/perf-tools-next/perf -vv | grep cap
libcapstone: [ on ] # HAVE_LIBCAPSTONE_SUPPORT
⬢[acme@toolbox perf-tools-next]$
Fixes: 8b767db330
("perf: build: introduce the libcapstone")
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Changbin Du <changbin.du@huawei.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/Zry0sepD5Ppa5YKP@x1
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
224 lines
4.6 KiB
C
224 lines
4.6 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* test-all.c: Try to build all the main testcases at once.
|
|
*
|
|
* A well-configured system will have all the prereqs installed, so we can speed
|
|
* up auto-detection on such systems.
|
|
*/
|
|
|
|
/*
|
|
* Quirk: Python and Perl headers cannot be in arbitrary places, so keep
|
|
* these 3 testcases at the top:
|
|
*/
|
|
#define main main_test_libpython
|
|
# include "test-libpython.c"
|
|
#undef main
|
|
|
|
#define main main_test_libperl
|
|
# include "test-libperl.c"
|
|
#undef main
|
|
|
|
#define main main_test_hello
|
|
# include "test-hello.c"
|
|
#undef main
|
|
|
|
#define main main_test_libelf
|
|
# include "test-libelf.c"
|
|
#undef main
|
|
|
|
#define main main_test_get_current_dir_name
|
|
# include "test-get_current_dir_name.c"
|
|
#undef main
|
|
|
|
#define main main_test_gettid
|
|
# include "test-gettid.c"
|
|
#undef main
|
|
|
|
#define main main_test_glibc
|
|
# include "test-glibc.c"
|
|
#undef main
|
|
|
|
#define main main_test_dwarf
|
|
# include "test-dwarf.c"
|
|
#undef main
|
|
|
|
#define main main_test_dwarf_getlocations
|
|
# include "test-dwarf_getlocations.c"
|
|
#undef main
|
|
|
|
#define main main_test_eventfd
|
|
# include "test-eventfd.c"
|
|
#undef main
|
|
|
|
#define main main_test_libelf_getphdrnum
|
|
# include "test-libelf-getphdrnum.c"
|
|
#undef main
|
|
|
|
#define main main_test_libelf_gelf_getnote
|
|
# include "test-libelf-gelf_getnote.c"
|
|
#undef main
|
|
|
|
#define main main_test_libelf_getshdrstrndx
|
|
# include "test-libelf-getshdrstrndx.c"
|
|
#undef main
|
|
|
|
#define main main_test_libunwind
|
|
# include "test-libunwind.c"
|
|
#undef main
|
|
|
|
#define main main_test_libslang
|
|
# include "test-libslang.c"
|
|
#undef main
|
|
|
|
#define main main_test_libbfd
|
|
# include "test-libbfd.c"
|
|
#undef main
|
|
|
|
#define main main_test_libbfd_buildid
|
|
# include "test-libbfd-buildid.c"
|
|
#undef main
|
|
|
|
#define main main_test_backtrace
|
|
# include "test-backtrace.c"
|
|
#undef main
|
|
|
|
#define main main_test_libnuma
|
|
# include "test-libnuma.c"
|
|
#undef main
|
|
|
|
#define main main_test_numa_num_possible_cpus
|
|
# include "test-numa_num_possible_cpus.c"
|
|
#undef main
|
|
|
|
#define main main_test_timerfd
|
|
# include "test-timerfd.c"
|
|
#undef main
|
|
|
|
#define main main_test_stackprotector_all
|
|
# include "test-stackprotector-all.c"
|
|
#undef main
|
|
|
|
#define main main_test_libdw_dwarf_unwind
|
|
# include "test-libdw-dwarf-unwind.c"
|
|
#undef main
|
|
|
|
#define main main_test_zlib
|
|
# include "test-zlib.c"
|
|
#undef main
|
|
|
|
#define main main_test_pthread_attr_setaffinity_np
|
|
# include "test-pthread-attr-setaffinity-np.c"
|
|
#undef main
|
|
|
|
#define main main_test_pthread_barrier
|
|
# include "test-pthread-barrier.c"
|
|
#undef main
|
|
|
|
#define main main_test_scandirat
|
|
# include "test-scandirat.c"
|
|
#undef main
|
|
|
|
#define main main_test_sched_getcpu
|
|
# include "test-sched_getcpu.c"
|
|
#undef main
|
|
|
|
# if 0
|
|
/*
|
|
* Disable libbabeltrace check for test-all, because the requested
|
|
* library version is not released yet in most distributions. Will
|
|
* reenable later.
|
|
*/
|
|
|
|
#define main main_test_libbabeltrace
|
|
# include "test-libbabeltrace.c"
|
|
#undef main
|
|
#endif
|
|
|
|
#define main main_test_lzma
|
|
# include "test-lzma.c"
|
|
#undef main
|
|
|
|
#define main main_test_get_cpuid
|
|
# include "test-get_cpuid.c"
|
|
#undef main
|
|
|
|
#define main main_test_bpf
|
|
# include "test-bpf.c"
|
|
#undef main
|
|
|
|
#define main main_test_libcrypto
|
|
# include "test-libcrypto.c"
|
|
#undef main
|
|
|
|
#define main main_test_sdt
|
|
# include "test-sdt.c"
|
|
#undef main
|
|
|
|
#define main main_test_setns
|
|
# include "test-setns.c"
|
|
#undef main
|
|
|
|
#define main main_test_libaio
|
|
# include "test-libaio.c"
|
|
#undef main
|
|
|
|
#define main main_test_reallocarray
|
|
# include "test-reallocarray.c"
|
|
#undef main
|
|
|
|
#define main main_test_disassembler_four_args
|
|
# include "test-disassembler-four-args.c"
|
|
#undef main
|
|
|
|
#define main main_test_disassembler_init_styled
|
|
# include "test-disassembler-init-styled.c"
|
|
#undef main
|
|
|
|
#define main main_test_libzstd
|
|
# include "test-libzstd.c"
|
|
#undef main
|
|
|
|
int main(int argc, char *argv[])
|
|
{
|
|
main_test_libpython();
|
|
main_test_libperl();
|
|
main_test_hello();
|
|
main_test_libelf();
|
|
main_test_get_current_dir_name();
|
|
main_test_gettid();
|
|
main_test_glibc();
|
|
main_test_dwarf();
|
|
main_test_dwarf_getlocations();
|
|
main_test_eventfd();
|
|
main_test_libelf_getphdrnum();
|
|
main_test_libelf_gelf_getnote();
|
|
main_test_libelf_getshdrstrndx();
|
|
main_test_libunwind();
|
|
main_test_libslang();
|
|
main_test_libbfd();
|
|
main_test_libbfd_buildid();
|
|
main_test_backtrace();
|
|
main_test_libnuma();
|
|
main_test_numa_num_possible_cpus();
|
|
main_test_timerfd();
|
|
main_test_stackprotector_all();
|
|
main_test_libdw_dwarf_unwind();
|
|
main_test_zlib();
|
|
main_test_pthread_attr_setaffinity_np();
|
|
main_test_pthread_barrier();
|
|
main_test_lzma();
|
|
main_test_get_cpuid();
|
|
main_test_bpf();
|
|
main_test_libcrypto();
|
|
main_test_scandirat();
|
|
main_test_sched_getcpu();
|
|
main_test_sdt();
|
|
main_test_setns();
|
|
main_test_libaio();
|
|
main_test_reallocarray();
|
|
main_test_disassembler_four_args();
|
|
main_test_libzstd();
|
|
|
|
return 0;
|
|
}
|