libctf, create: support addition of references to the unimplemented type
authorNick Alcock <nick.alcock@oracle.com>
Tue, 2 Jun 2020 19:04:24 +0000 (20:04 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Wed, 22 Jul 2020 16:57:21 +0000 (17:57 +0100)
commit2361f1c85913a0ff0955069bf3182011765a8ae8
treeb8a2204417f250c58c0e643e2eb8976ca9f7ee9d
parent7eea9d3bdb037a3953101eccdb05826daf2da39a
libctf, create: support addition of references to the unimplemented type

The deduplicating linker adds types from the linker inputs to the output
via the same API everyone else does, so it's important that we can emit
everything that the compiler wants us to.  Unfortunately, the compiler
may represent the unimplemented type (used for compiler constructs that
CTF cannot currently encode) as type zero or as a type of kind
CTF_K_UNKNOWN, and we don't allow the addition of types that cite the
former.

Adding this support adds a tiny bit of extra complexity: additions of
structure members immediately following a member of the unimplemented
type must be via ctf_add_member_offset or ctf_add_member_encoded, since
we have no idea how big members of the unimplemented type are.
(Attempts to do otherwise return -ECTF_NONREPRESENTABLE, like other
attempts to do forbidden things with the unimplemented type.)

Even slices of the unimplemented type are permitted: this is the only
case in which you can slice a type that terminates in a non-integral
type, on the grounds that it was likely integral in the source code,
it's just that we can't represent that sort of integral type properly
yet.

libctf/
* ctf-create.c (ctf_add_reftype): Support refs to type zero.
(ctf_add_array): Support array contents of type zero.
(ctf_add_function): Support arguments and return types of
type zero.
(ctf_add_typedef): Support typedefs to type zero.
(ctf_add_member_offset): Support members of type zero,
unless added at unspecified (naturally-aligned) offset.
libctf/ChangeLog
libctf/ctf-create.c
This page took 0.025288 seconds and 4 git commands to generate.