On 7/15/21 2:03 AM, Lorenz Bauer wrote:
Hi everyone,
I'm trying to build 5.13.2 selftests for github.com/cilium/ci-kernels.
With clang-12:
libbpf: failed to find BTF for extern 'tcp_reno_cong_avoid' [38] section: -2
Error: failed to open BPF object file: No such file or directory
libbpf: failed to find BTF for extern 'tcp_cong_avoid_ai' [27] section: -2
Error: failed to open BPF object file: No such file or directory
Arnaldo has hit this problem before:
https://www.spinics.net/lists/dwarves/msg01332.html So I tried to
recompile with clang-13 (Ubuntu clang version
13.0.0-++20210629083512+c4de78e91c93-1~exp1~20210629184258.496):
libbpf: ELF relo #0 in section #15 has unexpected type 2 in
/home/lorenz/dev/ci-kernels/build/linux-5.13.2/tools/testing/selftests/bpf/bpf_cubic.o
In this particular case, you can check out a llvm13 git repo upto but
not including the patch
6a2ea84600ba BPF: Add more relocation kinds
Aka my clang-12 is too old, my clang-13 is too new. In the past we've
stubbed out some tests based on clang version, can we do the same
here?
LLVM has 6-month development cycle vs. kernel 8-10 weeks.
With this, sometimes we implemented some features which is suitable
for *latest* kernel version but has an adverse impact on old
kernels.
This build breakage tends to happen with every major kernel release.
Is there a way to avoid this? FWIW some CI builds fail because of
this, however I have no idea where these reports go / why they aren't
taken into account: https://lkml.org/lkml/2021/6/22/987
First always check tools/testing/selftests/bpf/README.rst which should
contain most, if not all, possible breakages and how to mitigate them,
e.g., which llvm patch is responsible and if you checkout a llvm repo
upto and without that patch, you might be okay.
We can also maintain a list of llvm sha commits which have been tested
to work for a particular kernel version.
Further, if we really want, we could have a forked llvm-project repo
with tags for each kernel release. This way, people can checkout the
repo/tag and build for particular kernel release selftests.
It would be nice if there was some combination of (easily available
clang release) x (stable kernel versions) that allows to compile BPF
selftests successfully.
Lorenz