]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
libctf: open, types: ctf_import for BTF
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 16:59:31 +0000 (17:59 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 17:07:44 +0000 (18:07 +0100)
commit908a7e71671ea2ecafed060866d9fd6a665a79a2
tree7169e402cbd799233278815cd1e7f2891924f7e1
parentd5012389a44029018a92b113d2253afb79493e7e
libctf: open, types: ctf_import for BTF

ctf_import needs a bunch of fixes to work with pure BTF dicts -- and, for
that matter, importing newly-created parent dicts that have never been
written out, which may have a bunch of nonprovisional types (if types were
added to it before any imports were done) or may not (if at least one
ctf_import into it was done before any types were added).

So we adjust things so that the values that are checked against are the
nonprovisional-types values: the header revisions actually changed the name
of cth_parent_typemax to cth_parent_ntypes to make this clearer, so catch up
with that.  In the parent, we have to use ctf_idmax, not ctf_typemax.

One thing we must prohibit is that you cannot add a bunch of types to a
child and then import a parent into it: the type IDs will all be wrong
and the string offsets more so.  This was partly prohibited: prohibit it
entirely (excepting only that the not-actually-written-out void type
we might add to new BTF dicts does not influence this check).

Since BTF children don't have a cth_parent_ntypes or a cth_parent_strlen, we
cannot check this stuff, but just set them and hope.
libctf/ctf-open.c
libctf/ctf-types.c