Skip to content

tools/resolve_btfids: Fix cross-compilation to non-host endianness

Viktor Malik requested to merge vmalikrh/centos-stream-9:cross-compile-fix into main

JIRA: https://issues.redhat.com/browse/RHEL-16042

The .BTF_ids section of vmlinux is pre-filled with zeroed BTF ID entries during the build and afterwards patched by resolve_btfids with correct values. Since resolve_btfids always writes in host-native endianness, it relies on libelf to do the translation when the target ELF is cross-compiled to a different endianness.

Unfortunately, the translation will corrupt the flags fields of SET8 entries because these were written during vmlinux compilation and are in the correct endianness already. This will lead to numerous BPF selftests failures.

The issue mainly affects CKI-compiled s390x (big-endian) kernels as these are cross-compiled on little-endian machines.

This MR backports upstream patches which resolve the problem.

Signed-off-by: Viktor Malik vmalik@redhat.com

Merge request reports