Re: [PATCH bpf-next v3 2/3] bpftool: Preserve unsigned enum values in data dumps
From: Hungyu Lin
Date: Thu Nov 05 2026 - 20:03:15 EST
> how old by now are those btf produces that do not emit kflag=1 for
> signed enums? should we even care at this point or just assume that
> kflag is set correctly?
LLVM 14 and earlier, and pahole before 1.24, for example. Signed
enum kflag support was added in pahole 1.24 (August 2022) and
LLVM 15 (September 2022), about four years ago.
libbpf still clears enum kflag when loading BTF into kernels without
enum64 support, though. bpftool map dump reads that BTF back from
the kernel, so this also happens with newer compilers.
Dropping the legacy comparison would lose existing negative-enumerator
name matches for 1-, 2- and 8-byte ENUMs in bpftool, and the 8-byte
case in libbpf. In the proposed code, 4-byte ENUMs match through the
helper with or without the legacy comparison.
I'd keep the legacy comparison to preserve those existing name
matches. Would you prefer to drop it and rely on kflag alone?
Thanks,
Hungyu