diff options
author | Nick Alcock <nick.alcock@oracle.com> | 2024-07-15 20:21:36 +0100 |
---|---|---|
committer | Nick Alcock <nick.alcock@oracle.com> | 2025-02-28 14:47:24 +0000 |
commit | 9a74ab12c8e7e24e2929696dba02f63ed115a2a0 (patch) | |
tree | 12835c09ffb65674e62055ab66a1f1daf41ca83a /libctf/ctf-dump.c | |
parent | 8cdf110a115c971f3184bbd30f515fd2cd6f72ef (diff) | |
download | binutils-9a74ab12c8e7e24e2929696dba02f63ed115a2a0.zip binutils-9a74ab12c8e7e24e2929696dba02f63ed115a2a0.tar.gz binutils-9a74ab12c8e7e24e2929696dba02f63ed115a2a0.tar.bz2 |
include, libctf: start work on libctf v4
This format is a superset of BTF, but for now we just do the minimum to
declare a new file format version, without actually introducing any format
changes.
From now on, we refuse to reserialize CTFv1 dicts: these have a distinct
parent/child boundary which obviously cannot change upon reserialization
(that would change the type IDs): instead, we encoded this by stuffing in
a unique CTF version for such dicts. We can't do that now we have one
version for all CTFv4 dicts, and testing such old dicts is very hard these
days anyway, and is not automated: so just drop support for writing them out
entirely. (You still *can* write them out, but you have to do a full-blown
ctf_link, which generates an all-new fresh dict and recomputes type IDs as
part of deduplication.)
To prevent this extremely-not-ready format escaping into the wild, add a
new mechanism whereby any format version higher than the new #define
CTF_STABLE_VERSION cannot be serialized unless I_KNOW_LIBCTF_IS_UNSTABLE is
set in the environment.
include/
* ctf-api.h (_CTF_ERRORS) [ECTF_CTFVERS_NO_SERIALIZE]: New.
[ECTF_UNSTABLE]: New.
(ECTF_NERR): Update.
* ctf.h: Small comment improvements..
(ctf_header_v3): New, copy of ctf_header.
(CTF_VERSION_4): New.
(CTF_VERSION): Now CTF_VERSION_4.
(CTF_STABLE_VERSION): Still 4, CTF_VERSION_3.
ld/
* testsuite/ld-ctf/*.d: Update to CTF_VERSION_4.
libctf/
* ctf-impl.h (LCTF_NO_SERIALIZE): New.
* ctf-dump.c (ctf_dump_header): Add CTF_VERSION_4.
* ctf-open.c (ctf_dictops): Likewise.
(upgrade_header): Rename to...
(upgrade_header_v2): ... this.
(upgrade_header_v3): New.
(upgrade_types): Support upgrading from CTF_VERSION_3.
Turn on LCTF_NO_SERIALIZE for CTFv1.
(init_static_types_internal): Upgrade all types tables older than
* CTF_VERSION_4.
(ctf_bufopen): Support CTF_VERSION_4: error out if we forget to
update this switch in future. Add header upgrading from v3 and
below. Improve comments slightly.
* ctf-serialize.c (ctf_serialize): Block serialization of unstable
file formats, and of file formats for which LCTF_NO_SERIALIZE is
turned on (v1).
Diffstat (limited to 'libctf/ctf-dump.c')
-rw-r--r-- | libctf/ctf-dump.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libctf/ctf-dump.c b/libctf/ctf-dump.c index 54febd6..0c0228f 100644 --- a/libctf/ctf-dump.c +++ b/libctf/ctf-dump.c @@ -298,7 +298,9 @@ ctf_dump_header (ctf_dict_t *fp, ctf_dump_state_t *state) "CTF_VERSION_1_UPGRADED_3 (latest format, version 1 type " "boundaries)", "CTF_VERSION_2", - "CTF_VERSION_3", NULL + "CTF_VERSION_3", + "CTF_VERSION_4", + NULL }; const char *verstr = NULL; |