diff options
author | Andrei Matei <andreimatei1@gmail.com> | 2020-11-24 22:52:55 -0500 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-11-26 00:25:55 +0100 |
commit | fb3558127cb62ba2dea9e3d0efa1bb1d7e5eee2a (patch) | |
tree | 374c267ee03238d92efd31ff1cd74537e7492bc8 /tools | |
parent | 34b82d3ac1058653b3de7be4697b55f67533b1f1 (diff) | |
download | linux-fb3558127cb62ba2dea9e3d0efa1bb1d7e5eee2a.tar.gz linux-fb3558127cb62ba2dea9e3d0efa1bb1d7e5eee2a.tar.bz2 linux-fb3558127cb62ba2dea9e3d0efa1bb1d7e5eee2a.zip |
bpf: Fix selftest compilation on clang 11
Before this patch, profiler.inc.h wouldn't compile with clang-11 (before
the __builtin_preserve_enum_value LLVM builtin was introduced in
https://reviews.llvm.org/D83242).
Another test that uses this builtin (test_core_enumval) is conditionally
skipped if the compiler is too old. In that spirit, this patch inhibits
part of populate_cgroup_info(), which needs this CO-RE builtin. The
selftests build again on clang-11.
The affected test (the profiler test) doesn't pass on clang-11 because
it's missing https://reviews.llvm.org/D85570, but at least the test suite
as a whole compiles. The test's expected failure is already called out in
the README.
Signed-off-by: Andrei Matei <andreimatei1@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Florian Lehner <dev@der-flo.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20201125035255.17970-1-andreimatei1@gmail.com
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/bpf/progs/profiler.inc.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/profiler.inc.h b/tools/testing/selftests/bpf/progs/profiler.inc.h index 30982a7e4d0f..4896fdf816f7 100644 --- a/tools/testing/selftests/bpf/progs/profiler.inc.h +++ b/tools/testing/selftests/bpf/progs/profiler.inc.h @@ -256,6 +256,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data, BPF_CORE_READ(task, nsproxy, cgroup_ns, root_cset, dfl_cgrp, kn); struct kernfs_node* proc_kernfs = BPF_CORE_READ(task, cgroups, dfl_cgrp, kn); +#if __has_builtin(__builtin_preserve_enum_value) if (ENABLE_CGROUP_V1_RESOLVER && CONFIG_CGROUP_PIDS) { int cgrp_id = bpf_core_enum_value(enum cgroup_subsys_id___local, pids_cgrp_id___local); @@ -275,6 +276,7 @@ static INLINE void* populate_cgroup_info(struct cgroup_data_t* cgroup_data, } } } +#endif cgroup_data->cgroup_root_inode = get_inode_from_kernfs(root_kernfs); cgroup_data->cgroup_proc_inode = get_inode_from_kernfs(proc_kernfs); |