Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: List newest Clang built-ins needed for some CO-RE selftests

Record which built-ins are optional and needed for some of recent BPF CO-RE
subtests. Document Clang diff that fixed corner-case issue with
__builtin_btf_type_id().

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20200820061411.1755905-4-andriin@fb.com

authored by

Andrii Nakryiko and committed by
Daniel Borkmann
149cb339 37a6a9e7

+24 -1
+21
tools/testing/selftests/bpf/README.rst
··· 43 43 https://reviews.llvm.org/D78466 44 44 has been pushed to llvm 10.x release branch and will be 45 45 available in 10.0.1. The fix is available in llvm 11.0.0 trunk. 46 + 47 + BPF CO-RE-based tests and Clang version 48 + ======================================= 49 + 50 + A set of selftests use BPF target-specific built-ins, which might require 51 + bleeding-edge Clang versions (Clang 12 nightly at this time). 52 + 53 + Few sub-tests of core_reloc test suit (part of test_progs test runner) require 54 + the following built-ins, listed with corresponding Clang diffs introducing 55 + them to Clang/LLVM. These sub-tests are going to be skipped if Clang is too 56 + old to support them, they shouldn't cause build failures or runtime test 57 + failures: 58 + 59 + - __builtin_btf_type_id() ([0], [1], [2]); 60 + - __builtin_preserve_type_info(), __builtin_preserve_enum_value() ([3], [4]). 61 + 62 + [0] https://reviews.llvm.org/D74572 63 + [1] https://reviews.llvm.org/D74668 64 + [2] https://reviews.llvm.org/D85174 65 + [3] https://reviews.llvm.org/D83878 66 + [4] https://reviews.llvm.org/D83242
+3 -1
tools/testing/selftests/bpf/progs/test_core_reloc_type_id.c
··· 75 75 { 76 76 /* We use __builtin_btf_type_id() in this tests, but up until the time 77 77 * __builtin_preserve_type_info() was added it contained a bug that 78 - * would make this test fail. The bug was fixed with addition of 78 + * would make this test fail. The bug was fixed ([0]) with addition of 79 79 * __builtin_preserve_type_info(), though, so that's what we are using 80 80 * to detect whether this test has to be executed, however strange 81 81 * that might look like. 82 + * 83 + * [0] https://reviews.llvm.org/D85174 82 84 */ 83 85 #if __has_builtin(__builtin_preserve_type_info) 84 86 struct core_reloc_type_id_output *out = (void *)&data.out;