]> git.hungrycats.org Git - linux/commit
bpftool: Improve btf c dump sorting stability
authorMykyta Yatsenko <yatsenko@meta.com>
Fri, 6 Sep 2024 13:24:53 +0000 (14:24 +0100)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 6 Sep 2024 21:06:30 +0000 (14:06 -0700)
commitf8c6b7913dfaa67475883f94261c278adbcaa0ae
tree61f1e8d7c90d9a3c50f121f878d98869b348ec20
parent04bb60d0dfd13ac51c0294ea1c3b78a783b7d22d
bpftool: Improve btf c dump sorting stability

Existing algorithm for BTF C dump sorting uses only types and names of
the structs and unions for ordering. As dump contains structs with the
same names but different contents, relative to each other ordering of
those structs will be accidental.
This patch addresses this problem by introducing a new sorting field
that contains hash of the struct/union field names and types to
disambiguate comparison of the non-unique named structs.

Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240906132453.146085-1-mykyta.yatsenko5@gmail.com
tools/bpf/bpftool/btf.c