libctf, create, types: encoding, BTF floats

This adds support for the nearly useless BTF_KIND_FLOAT, under the name
CTF_K_BTF_FLOAT.  At the same time we fix up the ctf_add_encoding and
ctf_type_encoding machinery for the new API changes.

I expect this to change a bit: Ali Bahrami reckons I've oversimplified the
CTFv4 encoding representation and need to reintroduce at least a width.

New API:

ctf_id_t ctf_add_btf_float (ctf_dict_t *, uint32_t,
                            const char *, const ctf_encoding_t *);
This commit is contained in:
Nick Alcock
2025-04-24 17:28:34 +01:00
parent 03609073b0
commit 2c1a0a70d1
4 changed files with 46 additions and 36 deletions

View File

@@ -135,7 +135,9 @@ typedef enum ctf_sect_names
/* Encoding information for integers, floating-point values, and certain other
intrinsics can be obtained by calling ctf_type_encoding, below. The flags
field will contain values appropriate for the type defined in <ctf.h>. */
field will contain values appropriate for the type defined in <ctf.h>.
For floats, only the first of these fields is meaningful. */
typedef struct ctf_encoding
{
@@ -846,6 +848,8 @@ extern ctf_id_t ctf_add_enum64 (ctf_dict_t *, uint32_t, const char *);
extern ctf_id_t ctf_add_enum_encoded (ctf_dict_t *, uint32_t, const char *,
const ctf_encoding_t *);
extern ctf_id_t ctf_add_enum (ctf_dict_t *, uint32_t, const char *);
extern ctf_id_t ctf_add_btf_float (ctf_dict_t *, uint32_t,
const char *, const ctf_encoding_t *);
extern ctf_id_t ctf_add_float (ctf_dict_t *, uint32_t,
const char *, const ctf_encoding_t *);
extern ctf_id_t ctf_add_forward (ctf_dict_t *, uint32_t, const char *,