]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: serialize: kind suppression and prohibition
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 11:42:12 +0000 (12:42 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:07:44 +0000 (18:07 +0100)
commitc14bdfc7a4442c539258dfef437adec1b2efe5c9
treebf1c55f88c8b155f7c606db67821d1f8a76a8ab3
parent2c5f74300af4c79e4baae69f547f7e69dbd73559
libctf: serialize: kind suppression and prohibition

The CTF serialization machinery decides whether to write out a dict as BTF
or CTF (or, in LIBCTF_BTM_BTF mode, whether to write out a dict or fail with
ECTF_NOTBTF) in part by looking at the type kinds in the dictionary.

It is possible that you'd like to extend this check and ban specific type
kinds from the dictionary (possibly even if it's CTF); it's also possible
that you'd like to *not* fail even if a CTF-only kind is found, but rather
replace it with a still-valid stub (CTF_K_UNKNOWN / BTF_KIND_UNKNOWN) and
keep going.  (The kernel's btfarchive machinery does this to ensure that
the compiler and previous link stages have emitted only valid BTF type
kinds.)

ctf_write_suppress_kind supports both these use cases:

+int ctf_write_suppress_kind (ctf_dict_t *fp, int kind, int prohibited);

This commit adds only the core population code: the actual suppression is
spread across the serializer and will be added in the next commits.
include/ctf-api.h
libctf/ctf-impl.h
libctf/ctf-serialize.c
libctf/libctf.ver