aboutsummaryrefslogtreecommitdiff
path: root/libctf/ctf-intl.h
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2025-04-25 12:20:36 +0100
committerNick Alcock <nick.alcock@oracle.com>2025-04-25 18:07:44 +0100
commitf782340ba5e0d94e7d74190ec0da7dc0e395e5d0 (patch)
treecb223a33d767ac9afce1c2ff344fb77851ca151f /libctf/ctf-intl.h
parent3c5eb5b20adb555e0fd0f42cf8349a70d8fb4fe9 (diff)
downloadbinutils-f782340ba5e0d94e7d74190ec0da7dc0e395e5d0.zip
binutils-f782340ba5e0d94e7d74190ec0da7dc0e395e5d0.tar.gz
binutils-f782340ba5e0d94e7d74190ec0da7dc0e395e5d0.tar.bz2
libctf, serialize: preparatory steps
The new serializer is quite a lot more customizable than the old, because it can write out BTF as well as CTF: you can ask to write out BTF or fail, write out CTF if required to avoid information loss, otherwise BTF, or always write out CTF. Callers often need to find out whether a dict could be written out as BTF before deciding how to write it out (because a dict can never be written out as BTF if it is compressed, a caller might well want to ask if there is anything else that prevents BTF writeout -- say, slices, conflicting types, or CTF_K_BIG -- before deciding whether to compress it). GNU ld will do this whenever it is passed only BTF sections on the input. Figuring out whether a dict can be written out as BTF is quite expensive: we have to traverse all the types and check them, including every member of every struct. So we'd rather do that work only once. This means making a lot of state once private to ctf_preserialize public enough that another function can initialize it; and since the whole API is available after calling this function and before serializing, we should probably arrange that if we do things we know will invalidate the results of all this checking, we are forced to do it again. This commit does that, moving all the existing serialization state into a new ctf_serialize_t and adding to it. Several functions grow force_ctf arguments that allow the caller to force CTF emission even if the type section looks BTFish: the writeout code and archive creation use this to force CTF emission if we are compressing, and archive creation uses it to force CTF emission if a CTF multi-member archive is in use, because BTF doesn't support archives at all so there's no point maintaining BTF compatibility in that case. The ctf_write* functions gain support for writing out BTF headers as well as CTF, depending on whether what was ultimately written out was actually BTF or not. Even more than most commits in this series, there is no way this is going to compile right now: we're in the middle of a major transition, completed in the next few commits.
Diffstat (limited to 'libctf/ctf-intl.h')
0 files changed, 0 insertions, 0 deletions