aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/ctf.h2
-rw-r--r--libctf/ctf-create.c14
-rw-r--r--libctf/ctf-decl.c8
-rw-r--r--libctf/ctf-dedup.c94
-rw-r--r--libctf/ctf-hash.c6
-rw-r--r--libctf/ctf-impl.h17
-rw-r--r--libctf/ctf-link.c8
-rw-r--r--libctf/ctf-lookup.c30
-rw-r--r--libctf/ctf-open.c132
-rw-r--r--libctf/ctf-serialize.c3
-rw-r--r--libctf/ctf-types.c14
11 files changed, 184 insertions, 144 deletions
diff --git a/include/ctf.h b/include/ctf.h
index f1b86ac..749e266 100644
--- a/include/ctf.h
+++ b/include/ctf.h
@@ -730,7 +730,7 @@ typedef struct ctf_lmember_v2
uint32_t ctlm_offsethi; /* High 32 bits of member offset in bits. */
uint32_t ctlm_type; /* Reference to type of member. */
uint32_t ctlm_offsetlo; /* Low 32 bits of member offset in bits. */
-} ctf_lmember_v3_t;
+} ctf_lmember_v2_t;
#define CTF_V3_LMEM_OFFSET(ctlmp) \
(((uint64_t)(ctlmp)->ctlm_offsethi) << 32 | (ctlmp)->ctlm_offsetlo)
diff --git a/libctf/ctf-create.c b/libctf/ctf-create.c
index 68e6cd2..6eb7192 100644
--- a/libctf/ctf-create.c
+++ b/libctf/ctf-create.c
@@ -1555,7 +1555,7 @@ ctf_add_member_bitfield (ctf_dict_t *fp, ctf_id_t souid, const char *name,
{
ctf_dict_t *ofp = fp;
ctf_dict_t *tmp = fp;
- ctf_dtdef_t *dtd = ctf_dtd_lookup (fp, souid);
+ ctf_dtdef_t *dtd;
ctf_type_t *prefix;
ssize_t msize, ssize;
@@ -1582,6 +1582,8 @@ ctf_add_member_bitfield (ctf_dict_t *fp, ctf_id_t souid, const char *name,
fp = fp->ctf_parent;
}
+ dtd = ctf_dtd_lookup (fp, souid);
+
if (souid < fp->ctf_stypes)
return (ctf_set_errno (ofp, ECTF_RDONLY));
@@ -1594,7 +1596,7 @@ ctf_add_member_bitfield (ctf_dict_t *fp, ctf_id_t souid, const char *name,
if (name != NULL && name[0] == '\0')
name = NULL;
- if ((prefix = ctf_find_prefix (dtd->dtd_buf, CTF_K_BIG)) == NULL)
+ if ((prefix = ctf_find_prefix (fp, dtd->dtd_buf, CTF_K_BIG)) == NULL)
return (ctf_set_errno (ofp, ECTF_CORRUPT));
kind = LCTF_KIND (fp, prefix);
@@ -1664,7 +1666,8 @@ ctf_add_member_bitfield (ctf_dict_t *fp, ctf_id_t souid, const char *name,
}
else /* Subsequent struct member. */
{
- size_t bound, off;
+ size_t bound;
+ ssize_t off;
if (bit_offset == (unsigned long) - 1)
{
@@ -1731,7 +1734,7 @@ ctf_add_member_bitfield (ctf_dict_t *fp, ctf_id_t souid, const char *name,
/* Hunt down the prefix and member list again: they may have been moved by
the realloc()s involved in field additions. */
- if ((prefix = ctf_find_prefix (dtd->dtd_buf, CTF_K_BIG)) == NULL)
+ if ((prefix = ctf_find_prefix (fp, dtd->dtd_buf, CTF_K_BIG)) == NULL)
return (ctf_set_errno (ofp, ECTF_CORRUPT));
vlen = LCTF_VLEN (fp, prefix);
@@ -2671,7 +2674,8 @@ ctf_add_type_internal (ctf_dict_t *dst_fp, ctf_dict_t *src_fp, ctf_id_t src_type
break;
}
- dst_type = ctf_add_struct_sized (dst_fp, flag | (kflag ? CTF_ADD_STRUCT_BITFIELDS),
+ dst_type = ctf_add_struct_sized (dst_fp, flag
+ | (bitfields ? CTF_ADD_STRUCT_BITFIELDS : 0),
name, ctf_type_size (src_fp, src_type));
if (dst_type == CTF_ERR)
return CTF_ERR; /* errno is set for us. */
diff --git a/libctf/ctf-decl.c b/libctf/ctf-decl.c
index a0046a3..eec6196 100644
--- a/libctf/ctf-decl.c
+++ b/libctf/ctf-decl.c
@@ -82,7 +82,7 @@ ctf_decl_push (ctf_decl_t *cd, ctf_dict_t *fp, ctf_id_t type)
const ctf_type_t *tp, *suffix;
ctf_arinfo_t ar;
- if ((tp = ctf_lookup_by_id (&fp, type, NULL)) == NULL)
+ if ((tp = ctf_lookup_by_id (&fp, type, &suffix)) == NULL)
{
cd->cd_err = fp->ctf_errno;
return;
@@ -112,12 +112,12 @@ ctf_decl_push (ctf_decl_t *cd, ctf_dict_t *fp, ctf_id_t type)
break;
case CTF_K_FUNCTION:
- ctf_decl_push (cd, fp, tp->ctt_type);
+ ctf_decl_push (cd, fp, suffix->ctt_type);
prec = CTF_PREC_FUNCTION;
break;
case CTF_K_POINTER:
- ctf_decl_push (cd, fp, tp->ctt_type);
+ ctf_decl_push (cd, fp, suffix->ctt_type);
prec = CTF_PREC_POINTER;
break;
@@ -130,7 +130,7 @@ ctf_decl_push (ctf_decl_t *cd, ctf_dict_t *fp, ctf_id_t type)
case CTF_K_VOLATILE:
case CTF_K_CONST:
case CTF_K_RESTRICT:
- ctf_decl_push (cd, fp, tp->ctt_type);
+ ctf_decl_push (cd, fp, suffix->ctt_type);
prec = cd->cd_qualp;
is_qual++;
break;
diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c
index cbef8e9..b69b435 100644
--- a/libctf/ctf-dedup.c
+++ b/libctf/ctf-dedup.c
@@ -807,7 +807,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
case CTF_K_FLOAT:
{
ctf_encoding_t ep;
- size_t size;
+ ssize_t size;
memset (&ep, 0, sizeof (ctf_encoding_t));
@@ -824,7 +824,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
}
case CTF_K_BTF_FLOAT:
{
- size_t size;
+ ssize_t size;
ctf_get_ctt_size (input, tp, &size, NULL);
ctf_dedup_sha1_add (&hash, &size, sizeof (size_t), "size", depth);
@@ -833,7 +833,6 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
case CTF_K_DECL_TAG:
{
ctf_id_t ref;
- int ref_kind;
/* Decl tags with component indexes mix in the index. We mix in the
component index unconditionally, because an index of -1 is fine
@@ -847,6 +846,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
ctf_dedup_sha1_add (&hash, &component_idx, sizeof (component_idx),
"component index", depth);
}
+ /* FALLTHRU */
/* Types that reference other types. */
case CTF_K_TYPEDEF:
case CTF_K_VOLATILE:
@@ -889,10 +889,12 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
goto err;
}
- if ((citer_hashes = make_set_element (d->cd_citers, child_name)) == NULL)
- goto oom;
- if (ctf_dynset_cinsert (citer_hashes, hval) < 0)
- goto oom;
+ if ((citer_hashes = make_set_element (d->cd_citers, child_name)) == NULL
+ || ctf_dynset_cinsert (citer_hashes, hval) < 0)
+ {
+ whaterr = N_("error tracking struct -> decl tag mappings");
+ goto oom;
+ }
}
}
@@ -1062,7 +1064,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
{
int64_t val;
const char *ename;
- size_t size;
+ ssize_t size;
int enum_unsigned = ctf_enum_unsigned (input, type);
ctf_get_ctt_size (input, tp, &size, NULL);
@@ -1188,9 +1190,9 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
}
ctf_dedup_sha1_add (&hash, &entry->cvs_offset,
- sizeof (entry->cvs_offset), "datasec offset", depth)
+ sizeof (entry->cvs_offset), "datasec offset", depth);
ctf_dedup_sha1_add (&hash, &entry->cvs_size,
- sizeof (entry->cvs_size), "datasec size", depth)
+ sizeof (entry->cvs_size), "datasec size", depth);
child_type = ctf_type_reference (input, type);
if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, child_type,
@@ -1644,6 +1646,10 @@ ctf_dedup_hash_kind_gid (ctf_dict_t *fp, ctf_dict_t **inputs, const char *hash,
CTF_DEDUP_GID_TO_TYPE (id));
}
+static int
+ctf_dedup_mark_conflicting_hash (ctf_dict_t *fp, ctf_dict_t **inputs,
+ const char *hval);
+
/* Mark the types that cite a type with a given hash as a conflicting type.
Internal implementation detail of ctf_dedup_mark_conflicting_hash(),
which see. */
@@ -1656,6 +1662,7 @@ ctf_dedup_mark_conflicting_hash_citers (ctf_dict_t *fp, ctf_dict_t **inputs,
ctf_next_t *i = NULL;
const void *k;
ctf_dynset_t *citers;
+ int err;
/* If any types cite this type, mark them conflicted too. */
if ((citers = ctf_dynhash_lookup (d->cd_citers, hval)) == NULL)
@@ -1677,6 +1684,7 @@ ctf_dedup_mark_conflicting_hash_citers (ctf_dict_t *fp, ctf_dict_t **inputs,
if (err != ECTF_NEXT_END)
return ctf_set_errno (fp, err);
+ return 0;
}
/* Mark a single hash as corresponding to a conflicting type. Mark all types
@@ -1689,14 +1697,13 @@ ctf_dedup_mark_conflicting_hash_citers (ctf_dict_t *fp, ctf_dict_t **inputs,
One exception is decl tags pointing to struct or union members, which appear
in the citers graph as a *decorated struct/union name* mapping to a set of
- decl tags: */
+ decl tags: we check for these separately, below. */
static int
ctf_dedup_mark_conflicting_hash (ctf_dict_t *fp, ctf_dict_t **inputs,
const char *hval)
{
ctf_dedup_t *d = &fp->ctf_dedup;
- int err;
const char *name;
int kind;
void *id;
@@ -1860,7 +1867,7 @@ ctf_dedup_detect_name_ambiguity (ctf_dict_t *fp, ctf_dict_t **inputs)
ctf_dprintf ("Marking %p, with hash %s, conflicting: one "
"of many non-forward GIDs for %s\n", id,
hval, (char *) k);
- ctf_dedup_mark_conflicting_hash (fp, inputs, hval, 0);
+ ctf_dedup_mark_conflicting_hash (fp, inputs, hval);
}
}
if (err != ECTF_NEXT_END)
@@ -1935,7 +1942,7 @@ ctf_dedup_detect_name_ambiguity (ctf_dict_t *fp, ctf_dict_t **inputs)
ctf_dprintf ("Marking %s, an uncommon hash for %s, conflicting\n",
hval, (const char *) k);
- if (ctf_dedup_mark_conflicting_hash (fp, inputs, hval, 0) < 0)
+ if (ctf_dedup_mark_conflicting_hash (fp, inputs, hval) < 0)
{
whaterr = N_("error marking hashes as conflicting");
goto err;
@@ -2060,7 +2067,7 @@ ctf_dedup_init (ctf_dict_t *fp)
if ((d->cd_emission_struct_decl_tags
= ctf_dynhash_create (ctf_hash_integer,
ctf_hash_eq_integer,
- NULL)) == NULL)
+ NULL, NULL)) == NULL)
goto oom;
if ((d->cd_conflicting_types
@@ -2253,7 +2260,7 @@ ctf_dedup_conflictify_unshared (ctf_dict_t *output, ctf_dict_t **inputs)
{
const char *hval = (const char *) k;
- if (ctf_dedup_mark_conflicting_hash (output, inputs, hval, 0) < 0)
+ if (ctf_dedup_mark_conflicting_hash (output, inputs, hval) < 0)
goto err;
}
if (err != ECTF_NEXT_END)
@@ -2412,7 +2419,7 @@ ctf_dedup_member_decl_tag (ctf_dict_t *fp, ctf_id_t type)
if (ref_kind == CTF_K_STRUCT || ref_kind == CTF_K_UNION)
{
- int component_idx;
+ int64_t component_idx;
if (ctf_decl_tag (fp, type, &component_idx) == CTF_ERR)
return -1;
@@ -3155,7 +3162,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
since a cu-mapped link will want to emit a *different* CTF_K_CONFLICTING
entry in its place. */
name = ctf_strraw (real_input, suffix->ctt_name);
- isroot = LCTF_ISROOT (real_input, tp);
+ isroot = LCTF_INFO_ISROOT (real_input, tp->ctt_info);
/* Hide conflicting types, if we were asked to: also hide if a type with this
name already exists and is not a forward, or if this type is hidden on the
@@ -3222,13 +3229,13 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
ctf_encoding_t en;
errtype = _("enum");
- if ((en = ctf_type_encoding (input, type, &en)) < 0)
+ if (ctf_type_encoding (input, type, &en) < 0)
goto err_input;
if (kind == CTF_K_ENUM)
- new_type = ctf_add_enum (target, isroot, name, encoding);
+ new_type = ctf_add_enum_encoded (target, isroot, name, &en);
else
- new_type = ctf_add_enum64 (target, isroot, name, encoding);
+ new_type = ctf_add_enum64_encoded (target, isroot, name, &en);
if (new_type == CTF_ERR)
goto err_input; /* errno is set for us. */
@@ -3354,6 +3361,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
{
ctf_funcinfo_t fi;
ctf_id_t *args;
+ const char **arg_names;
uint32_t j;
errtype = _("function");
@@ -3388,20 +3396,36 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
goto err_input;
}
+ if ((arg_names = calloc (fi.ctc_argc, sizeof (const char **))) == NULL)
+ {
+ ctf_set_errno (input, ENOMEM);
+ goto err_input;
+ }
+
+ errtype = _("function arg names");
+ if (ctf_func_type_arg_names (input, type, fi.ctc_argc, arg_names) < 0)
+ {
+ free (args);
+ free (arg_names);
+ goto err_input;
+ }
+
if ((new_type = ctf_add_function (target, isroot,
- &fi, args)) == CTF_ERR)
+ &fi, args, arg_names)) == CTF_ERR)
{
free (args);
+ free (arg_names);
goto err_target;
}
free (args);
+ free (arg_names);
break;
}
case CTF_K_STRUCT:
case CTF_K_UNION:
{
- size_t size = ctf_type_size (input, type);
+ ssize_t size = ctf_type_size (input, type);
void *out_id;
int is_bitfield;
@@ -3440,7 +3464,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
case CTF_K_DECL_TAG:
{
int to_sou_member = ctf_dedup_member_decl_tag (input, type);
- int component_idx;
+ int64_t component_idx;
errtype = _("decl tag");
@@ -3485,7 +3509,7 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
{
void *datasec;
ctf_id_t datasec_type;
- int component_idx;
+ int64_t component_idx;
const char *datasec_name;
ctf_var_secinfo_t *entry;
int linkage;
@@ -3618,9 +3642,10 @@ ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
ctf_dict_t *target;
uint32_t target_num;
ctf_id_t input_type, target_type;
- ssize_t offset;
- ctf_id_t membtype;
const char *name;
+ ctf_id_t membtype;
+ ssize_t offset;
+ int width;
input_num = CTF_DEDUP_GID_TO_INPUT (input_id);
input_fp = inputs[input_num];
@@ -3644,7 +3669,7 @@ ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
target_type = CTF_DEDUP_GID_TO_TYPE (target_id);
while ((offset = ctf_member_next (input_fp, input_type, &j, &name,
- &membtype, 0)) >= 0)
+ &membtype, &width, 0)) >= 0)
{
err_fp = target;
err_type = target_type;
@@ -3662,8 +3687,8 @@ ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
#ifdef ENABLE_LIBCTF_HASH_DEBUGGING
ctf_dprintf ("Emitting %s, target-mapped type %lx, offset %zi\n", name, membtype, offset);
#endif
- if (ctf_add_member_offset (target, target_type, name,
- membtype, offset) < 0)
+ if (ctf_add_member_bitfield (target, target_type, name, membtype,
+ offset, width) < 0)
{
ctf_next_destroy (j);
goto err_target;
@@ -3697,8 +3722,7 @@ ctf_dedup_emit_struct_members (ctf_dict_t *output, ctf_dict_t **inputs,
point. */
static int
-ctf_dedup_emit_decl_tags (ctf_dict_t *output, ctf_dict_t **inputs,
- uint32_t ninputs, uint32_t *parents)
+ctf_dedup_emit_decl_tags (ctf_dict_t *output, ctf_dict_t **inputs)
{
ctf_dedup_t *d = &output->ctf_dedup;
ctf_next_t *i = NULL;
@@ -3715,7 +3739,7 @@ ctf_dedup_emit_decl_tags (ctf_dict_t *output, ctf_dict_t **inputs,
uint32_t target_num;
ctf_id_t input_type, struct_type, new_type;
const char *name;
- int component_idx;
+ int64_t component_idx;
int isroot;
const char *hval;
@@ -3767,7 +3791,7 @@ ctf_dedup_emit_decl_tags (ctf_dict_t *output, ctf_dict_t **inputs,
CTF_DEDUP_GID (output, input_num, input_type));
if (!ctf_assert (output, hval != NULL))
- return CTF_ERR; /* errno is set for us. */
+ return -1; /* errno is set for us. */
if (new_type != 0
&& ctf_dynhash_cinsert (target->ctf_dedup.cd_output_emission_hashes,
@@ -3842,7 +3866,7 @@ ctf_dedup_emit (ctf_dict_t *output, ctf_dict_t **inputs, uint32_t ninputs,
return NULL; /* errno is set for us. */
ctf_dprintf ("Populating decl tags pointing at struct members.\n");
- if (ctf_dedup_emit_decl_tags (output, inputs, ninputs, parents) < 0)
+ if (ctf_dedup_emit_decl_tags (output, inputs) < 0)
return NULL;
for (i = 0; i < ninputs; i++)
diff --git a/libctf/ctf-hash.c b/libctf/ctf-hash.c
index a170b6c..64657bd 100644
--- a/libctf/ctf-hash.c
+++ b/libctf/ctf-hash.c
@@ -779,6 +779,12 @@ ctf_dynset_destroy (ctf_dynset_t *hp)
htab_delete ((struct htab *) hp);
}
+void
+ctf_dynset_destroy_arg (ctf_dynset_t *hp, void *unused _libctf_unused_)
+{
+ ctf_dynset_destroy (hp);
+}
+
void *
ctf_dynset_lookup (ctf_dynset_t *hp, const void *key)
{
diff --git a/libctf/ctf-impl.h b/libctf/ctf-impl.h
index 07b323e..642ff6e 100644
--- a/libctf/ctf-impl.h
+++ b/libctf/ctf-impl.h
@@ -452,8 +452,8 @@ struct ctf_dict
Counts down. Parent only. */
uint32_t ctf_nprovtypes; /* Number of provisional types (convenience). */
const ctf_dmodel_t *ctf_dmodel; /* Data model pointer (see above). */
- const char *ctf_cuname; /* Compilation unit name (if any). */
- char *ctf_dyn_cuname; /* Dynamically allocated name of CU. */
+ const char *ctf_cu_name; /* Compilation unit name (if any). */
+ char *ctf_dyn_cu_name; /* Dynamically allocated name of CU. */
struct ctf_dict *ctf_parent; /* Parent CTF dict (if any). */
int ctf_parent_unreffed; /* Parent set by ctf_import_unref? */
const char *ctf_parent_name; /* Basename of parent (if any). */
@@ -558,7 +558,7 @@ struct ctf_next
void (*ctn_iter_fun) (void);
ctf_id_t ctn_type;
size_t ctn_size;
- size_t ctn_increment;
+ ssize_t ctn_increment;
const ctf_type_t *ctn_tp;
uint32_t ctn_n;
@@ -637,7 +637,7 @@ extern ctf_id_t ctf_index_to_type (const ctf_dict_t *, uint32_t);
extern ctf_dynhash_t *ctf_name_table (ctf_dict_t *, int);
extern const ctf_type_t *ctf_lookup_by_id (ctf_dict_t **, ctf_id_t,
const ctf_type_t **suffix);
-extern ctf_type_t *ctf_find_prefix (ctf_type_t *, int kind);
+extern ctf_type_t *ctf_find_prefix (ctf_dict_t *, ctf_type_t *, int kind);
extern ctf_id_t ctf_lookup_by_sym_or_name (ctf_dict_t *, unsigned long symidx,
const char *symname, int try_parent,
int is_function);
@@ -717,6 +717,7 @@ extern int ctf_dynset_insert (ctf_dynset_t *, void *);
extern void ctf_dynset_remove (ctf_dynset_t *, const void *);
extern size_t ctf_dynset_elements (ctf_dynset_t *);
extern void ctf_dynset_destroy (ctf_dynset_t *);
+extern void ctf_dynset_destroy_arg (ctf_dynset_t *, void *unused);
extern void *ctf_dynset_lookup (ctf_dynset_t *, const void *);
extern int ctf_dynset_exists (ctf_dynset_t *, const void *key,
const void **orig_key);
@@ -797,7 +798,7 @@ extern struct ctf_archive *ctf_arc_open_internal (const char *, int *);
extern void ctf_arc_close_internal (struct ctf_archive *);
extern const ctf_preamble_t *ctf_arc_bufpreamble (const ctf_sect_t *);
extern void *ctf_set_open_errno (int *, int);
-extern void ctf_flip_header (ctf_header_t *);
+extern void ctf_flip_header (void *, int, int);
extern int ctf_flip (ctf_dict_t *, ctf_header_t *, unsigned char *,
int is_btf, int to_foreign);
@@ -815,9 +816,9 @@ extern char *ctf_str_append_noerr (char *, const char *);
extern ctf_id_t ctf_type_resolve_unsliced (ctf_dict_t *, ctf_id_t);
extern int ctf_type_kind_unsliced (ctf_dict_t *, ctf_id_t);
-extern int ctf_type_kind_unsliced_tp (ctf_dict_t *, ctf_type_t *);
-extern int ctf_type_kind_tp (ctf_dict_t *, ctf_type_t *);
-extern int ctf_type_kind_forwarded_tp (ctf_dict_t *, ctf_type_t *);
+extern int ctf_type_kind_unsliced_tp (ctf_dict_t *, const ctf_type_t *);
+extern int ctf_type_kind_tp (ctf_dict_t *, const ctf_type_t *);
+extern int ctf_type_kind_forwarded_tp (ctf_dict_t *, const ctf_type_t *);
extern ssize_t ctf_type_align_natural (ctf_dict_t *fp, ctf_id_t prev_type,
ctf_id_t type, ssize_t bit_offset);
extern ctf_var_secinfo_t *ctf_datasec_entry (ctf_dict_t *, ctf_id_t,
diff --git a/libctf/ctf-link.c b/libctf/ctf-link.c
index 9b6dd48..9cdffa9 100644
--- a/libctf/ctf-link.c
+++ b/libctf/ctf-link.c
@@ -44,10 +44,10 @@
const char *
ctf_link_input_name (ctf_dict_t *fp)
{
- if (fp->ctf_parent && fp->ctf_parent->ctf_cuname)
- return fp->ctf_parent->ctf_cuname;
- else if (fp->ctf_cuname)
- return fp->ctf_cuname;
+ if (fp->ctf_parent && fp->ctf_parent->ctf_cu_name)
+ return fp->ctf_parent->ctf_cu_name;
+ else if (fp->ctf_cu_name)
+ return fp->ctf_cu_name;
else
return "(unnamed)";
}
diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 483dd07..6ebcc18 100644
--- a/libctf/ctf-lookup.c
+++ b/libctf/ctf-lookup.c
@@ -380,11 +380,10 @@ ctf_lookup_by_name (ctf_dict_t *fp, const char *name)
This function is not exported outside of the library. */
const ctf_type_t *
-ctf_lookup_by_id (ctf_dict_t **fpp, ctf_id_t type, ctf_type_t **suffix)
+ctf_lookup_by_id (ctf_dict_t **fpp, ctf_id_t type, const ctf_type_t **suffix)
{
ctf_dict_t *fp = *fpp;
ctf_id_t idx;
- int kind;
if ((fp = ctf_get_dict (fp, type)) == NULL)
{
@@ -393,14 +392,14 @@ ctf_lookup_by_id (ctf_dict_t **fpp, ctf_id_t type, ctf_type_t **suffix)
}
idx = ctf_type_to_index (fp, type);
- if (idx < 0 || (unsigned long) idx > fp->ctf_typemax)
+ if ((unsigned long) idx > fp->ctf_typemax)
{
ctf_set_errno (*fpp, ECTF_BADID);
return NULL;
}
*fpp = fp; /* Possibly the parent CTF dict. */
- if (i->ctn_type > fp->ctf_stypes)
+ if (idx > fp->ctf_stypes)
{
ctf_dtdef_t *dtd;
@@ -413,13 +412,13 @@ ctf_lookup_by_id (ctf_dict_t **fpp, ctf_id_t type, ctf_type_t **suffix)
{
ctf_type_t *tp;
- tp = (ctf_type_t *)((uintptr_t)(fp)->ctf_buf + (fp)->ctf_txlate[(i)]);
+ tp = (ctf_type_t *)((uintptr_t) fp->ctf_buf + fp->ctf_txlate[idx]);
if (suffix)
{
ctf_type_t *suff;
suff = tp;
- while (LCTF_IS_PREFIXED_KIND (CTF_INFO_UNPREFIXED_KIND (fp, suff->ctt_info)))
+ while (LCTF_IS_PREFIXED_KIND (LCTF_INFO_UNPREFIXED_KIND (fp, suff->ctt_info)))
suff++;
*suffix = suff;
@@ -430,13 +429,15 @@ ctf_lookup_by_id (ctf_dict_t **fpp, ctf_id_t type, ctf_type_t **suffix)
/* Find a given prefix in some type, if any. */
ctf_type_t *
-ctf_find_prefix (ctf_type_t *tp, int kind)
+ctf_find_prefix (ctf_dict_t *fp, ctf_type_t *tp, int kind)
{
- while (LCTF_IS_PREFIXED_KIND (tp->info)
- && CTF_INFO_KIND (tp->info) != kind)
+ uint32_t kind_ = kind;
+
+ while (LCTF_IS_PREFIXED_KIND (tp->ctt_info)
+ && CTF_INFO_KIND (tp->ctt_info) != kind_)
tp++;
- if (LCTF_INFO_UNPREFIXED_KIND (tp->ctt_info) != kind)
+ if (LCTF_INFO_UNPREFIXED_KIND (fp, tp->ctt_info) != kind_)
return NULL;
return tp;
@@ -459,13 +460,13 @@ ctf_lookup_by_kind (ctf_dict_t *fp, int kind, const char *name)
if (kind == CTF_K_TYPE_TAG || kind == CTF_K_DECL_TAG)
return (ctf_set_typed_errno (fp, ECTF_NEVERTAG));
- if ((type == ctf_dynhash_lookup_type (ctf_name_table (fp, kind),
- name)) != CTF_ERR)
+ if ((type = ctf_dynhash_lookup_type (ctf_name_table (fp, kind),
+ name)) != CTF_ERR)
return type;
if (fp->ctf_parent
- && (type == ctf_dynhash_lookup_type (ctf_name_table (fp->ctf_parent, kind),
- name)) != CTF_ERR)
+ && (type = ctf_dynhash_lookup_type (ctf_name_table (fp->ctf_parent, kind),
+ name)) != CTF_ERR)
return type;
return ctf_set_typed_errno (fp, ECTF_NOTYPE);
@@ -603,7 +604,6 @@ ctf_lookup_enumerator_next (ctf_dict_t *fp, const char *name,
vlen = dtd->dtd_vlen;
else
{
- unsigned char *vlen;
ctf_get_ctt_size (fp, tp, NULL, &i->ctn_increment);
vlen = (unsigned char *) ((uintptr_t) tp + i->ctn_increment);
}
diff --git a/libctf/ctf-open.c b/libctf/ctf-open.c
index 3a09908..18aa416 100644
--- a/libctf/ctf-open.c
+++ b/libctf/ctf-open.c
@@ -46,7 +46,7 @@ get_kind_v1 (uint32_t info)
static uint32_t
get_prefixed_kind_v1 (const ctf_type_t *tp)
{
- return (CTF_V1_INFO_KIND (tp->info));
+ return (CTF_V1_INFO_KIND (tp->ctt_info));
}
static uint32_t
@@ -64,7 +64,7 @@ get_vlen_v1 (uint32_t info)
static uint32_t
get_prefixed_vlen_v1 (const ctf_type_t *tp)
{
- return (CTF_V1_INFO_VLEN (tp->info));
+ return (CTF_V1_INFO_VLEN (tp->ctt_info));
}
static uint32_t
@@ -76,7 +76,7 @@ get_kind_v2 (uint32_t info)
static uint32_t
get_prefixed_kind_v2 (const ctf_type_t *tp)
{
- return (CTF_V2_INFO_KIND (tp->info));
+ return (CTF_V2_INFO_KIND (tp->ctt_info));
}
static uint32_t
@@ -94,7 +94,7 @@ get_vlen_v2 (uint32_t info)
static uint32_t
get_prefixed_vlen_v2 (const ctf_type_t *tp)
{
- return (CTF_V2_INFO_VLEN (tp->info));
+ return (CTF_V2_INFO_VLEN (tp->ctt_info));
}
static uint32_t
@@ -106,14 +106,12 @@ get_kind_v4 (uint32_t info)
static uint32_t
get_prefixed_kind_v4 (const ctf_type_t *tp)
{
- uint32_t kind;
-
/* Resolve away as many prefixes as exist. */
- while (LCTF_IS_PREFIXED_KIND (tp->info))
+ while (LCTF_IS_PREFIXED_KIND (tp->ctt_info))
tp++;
- return CTF_INFO_KIND (tp->info);
+ return CTF_INFO_KIND (tp->ctt_info);
}
static uint32_t
@@ -131,21 +129,21 @@ get_vlen_v4 (uint32_t info)
static uint32_t
get_prefixed_vlen_v4 (const ctf_type_t *tp)
{
- ctf_type_t *suffix;
+ const ctf_type_t *suffix;
/* Resolve away non-BIG prefixes (which have no affect on vlen). */
- while (LCTF_IS_PREFIXED_KIND (tp->info)
- && CTF_INFO_KIND (info) != CTF_K_BIG)
+ while (LCTF_IS_PREFIXED_KIND (tp->ctt_info)
+ && CTF_INFO_KIND (tp->ctt_info) != CTF_K_BIG)
tp++;
- if (!LCTF_IS_PREFIXED_KIND (CTF_INFO_KIND (tp->info)))
- return (CTF_INFO_VLEN (tp->info));
+ if (!LCTF_IS_PREFIXED_KIND (CTF_INFO_KIND (tp->ctt_info)))
+ return (CTF_INFO_VLEN (tp->ctt_info));
suffix = tp + 1;
/* CTF_K_BIG. */
- return (CTF_INFO_VLEN (tp->info) << 16 | CTF_INFO_VLEN (suffix->info));
+ return (CTF_INFO_VLEN (tp->ctt_info) << 16 | CTF_INFO_VLEN (suffix->ctt_info));
}
static inline ssize_t
@@ -215,7 +213,7 @@ get_ctt_size_v2 (const ctf_dict_t *fp, const ctf_type_t *tp,
}
static ssize_t
-get_ctt_size_v4 (const ctf_dict_t *fp, const ctf_type_t *tp,
+get_ctt_size_v4 (const ctf_dict_t *fp _libctf_unused_, const ctf_type_t *tp,
ssize_t *sizep, ssize_t *incrementp)
{
ssize_t size = 0;
@@ -223,13 +221,13 @@ get_ctt_size_v4 (const ctf_dict_t *fp, const ctf_type_t *tp,
/* Figure out how many prefixes there are, and adjust the size appropriately
if we pass a BIG. */
- while (LCTF_IS_PREFIXED_KIND (tp->info))
+ while (LCTF_IS_PREFIXED_KIND (tp->ctt_info))
{
- if (CTF_INFO_KIND (tp->info) == CTF_KIND_BIG)
- size = tp->ctt_size << 32;
+ if (CTF_INFO_KIND (tp->ctt_info) == CTF_K_BIG)
+ size = ((ssize_t) tp->ctt_size) << 32;
if (incrementp)
- *increment += sizeof (ctf_type_t);
+ *incrementp += sizeof (ctf_type_t);
tp++;
}
@@ -272,8 +270,8 @@ get_vbytes_old (ctf_dict_t *fp, unsigned short kind, size_t vlen)
static ssize_t
get_vbytes_v1 (ctf_dict_t *fp, const ctf_type_t *tp, ssize_t size)
{
- unsigned short kind = CTF_V1_INFO_KIND (tp->info);
- size_t vlen = CTF_V1_INFO_VLEN (tp->info);
+ unsigned short kind = CTF_V1_INFO_KIND (tp->ctt_info);
+ size_t vlen = CTF_V1_INFO_VLEN (tp->ctt_info);
switch (kind)
{
@@ -295,8 +293,8 @@ get_vbytes_v1 (ctf_dict_t *fp, const ctf_type_t *tp, ssize_t size)
static ssize_t
get_vbytes_v2 (ctf_dict_t *fp, const ctf_type_t *tp, ssize_t size)
{
- unsigned short kind = CTF_V2_INFO_KIND (tp->info);
- size_t vlen = CTF_V2_INFO_VLEN (tp->info);
+ unsigned short kind = CTF_V2_INFO_KIND (tp->ctt_info);
+ size_t vlen = CTF_V2_INFO_VLEN (tp->ctt_info);
switch (kind)
{
@@ -319,8 +317,8 @@ static ssize_t
get_vbytes_v4 (ctf_dict_t *fp, const ctf_type_t *tp,
ssize_t size _libctf_unused_)
{
- unsigned short kind = LCTF_KIND (fp, tp, NULL);
- ssize_t vlen = LCTF_VLEN (fp, tp, NULL);
+ unsigned short kind = LCTF_KIND (fp, tp);
+ ssize_t vlen = LCTF_VLEN (fp, tp);
switch (kind)
{
@@ -372,7 +370,7 @@ get_vbytes_v4 (ctf_dict_t *fp, const ctf_type_t *tp,
}
static const ctf_dictops_t ctf_dictops[] = {
- {NULL, NULL, NULL, NULL, NULL},
+ {NULL, NULL, NULL, NULL, NULL, NULL, NULL},
/* CTF_VERSION_1 */
{get_kind_v1, get_prefixed_kind_v1, get_root_v1, get_vlen_v1,
get_prefixed_vlen_v1, get_ctt_size_v1, get_vbytes_v1},
@@ -413,8 +411,8 @@ init_symtab (ctf_dict_t *fp, const ctf_header_t *hp, const ctf_sect_t *sp)
uint32_t *xp = fp->ctf_sxlate;
uint32_t *xend = PTR_ADD (xp, fp->ctf_nsyms);
- uint32_t objtoff = hp->cth_objtoff;
- uint32_t funcoff = hp->cth_funcoff;
+ uint32_t objtoff = hp->cth_objt_off;
+ uint32_t funcoff = hp->cth_func_off;
/* If this is a v3 dict, and the CTF_F_NEWFUNCINFO flag is not set, pretend
the func info section is empty: this compiler is too old to emit a function
@@ -423,9 +421,9 @@ init_symtab (ctf_dict_t *fp, const ctf_header_t *hp, const ctf_sect_t *sp)
if (fp->ctf_v3_header && (fp->ctf_v3_header->cth_flags & CTF_F_NEWFUNCINFO))
skip_func_info = 1;
- if (hp->cth_objtidx_off + hp->cth_objtidx_len <= hp->cth_funcidx_off)
+ if (hp->cth_objtidx_len > 0)
fp->ctf_objtidx_names = (uint32_t *) (fp->ctf_buf + hp->cth_objtidx_off);
- if (hp->cth_funcidx_off + hp->cth_funcidx_len <= hp->cth_varoff && !skip_func_info)
+ if (hp->cth_funcidx_len > 0 && !skip_func_info)
fp->ctf_funcidx_names = (uint32_t *) (fp->ctf_buf + hp->cth_funcidx_off);
/* Don't bother doing the rest if everything is indexed, or if we don't have a
@@ -547,7 +545,7 @@ ctf_set_base (ctf_dict_t *fp, const ctf_header_t *hp, unsigned char *base)
if (fp->ctf_cu_name)
ctf_dprintf ("ctf_set_base: CU name %s\n", fp->ctf_cu_name);
if (fp->ctf_parent_name)
- ctf_dprintf ("ctf_set_base: parent name %s\n" fp->ctf_parent_name);
+ ctf_dprintf ("ctf_set_base: parent name %s\n", fp->ctf_parent_name);
}
static int
@@ -594,8 +592,8 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth, int is_btf)
if ((err = upgrade_types (fp, cth)) != 0)
return err; /* Upgrade failed. */
#endif
- ctf_err_warn (ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
- return (ctf_set_open_errno (errp, ECTF_INTERNAL));
+ ctf_err_warn (NULL, 0, ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
+ return ECTF_INTERNAL;
}
tbuf = (ctf_type_t *) (fp->ctf_buf + cth->btf.bth_type_off);
@@ -618,7 +616,7 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth, int is_btf)
size_t vlen = LCTF_VLEN (fp, tp);
int nonroot = 0;
ssize_t size, increment, vbytes;
- ctf_type_t *suffix = tp;
+ const ctf_type_t *suffix = tp;
(void) ctf_get_ctt_size (fp, tp, &size, &increment);
@@ -708,7 +706,7 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth, int is_btf)
if ((fp->ctf_tags
= ctf_dynhash_create_sized (pop[CTF_K_DECL_TAG] + pop [CTF_K_TYPE_TAG],
ctf_hash_string, ctf_hash_eq_string,
- NULL, (ctf_hash_free_fun) ctf_dynset_destroy,
+ NULL, (ctf_hash_free_arg_fun) ctf_dynset_destroy_arg,
NULL)) == NULL)
return ENOMEM;
@@ -725,7 +723,7 @@ init_static_types (ctf_dict_t *fp, ctf_header_t *cth, int is_btf)
return ENOMEM;
if ((fp->ctf_var_datasecs
- = ctf_dynhash_create (ctf_hash_pointer, ctf_hash_pointer, NULL, NULL))
+ = ctf_dynhash_create (htab_hash_pointer, htab_eq_pointer, NULL, NULL))
== NULL)
return ENOMEM;
@@ -835,7 +833,7 @@ init_static_types_names_internal (ctf_dict_t *fp, ctf_header_t *cth, int is_btf,
unsigned short isroot = LCTF_INFO_ISROOT (fp, tp->ctt_info);
size_t vlen = LCTF_VLEN (fp, tp);
ssize_t size, increment, vbytes;
- ctf_type_t *suffix = tp;
+ const ctf_type_t *suffix = tp;
const char *name;
/* Prefixed type: pull off the prefixes (for most purposes). (We already
@@ -900,21 +898,25 @@ init_static_types_names_internal (ctf_dict_t *fp, ctf_header_t *cth, int is_btf,
}
case CTF_K_BTF_FLOAT:
- if (!isroot)
- break;
+ {
+ ctf_id_t existing;
- /* Don't allow a float to be overwritten by a BTF float. */
+ if (!isroot)
+ break;
- if (((existing = ctf_dynhash_lookup_type (fp->ctf_names, name)) == 0)
- && ctf_type_kind (fp, existing) == CTF_K_FLOAT)
- break;
+ /* Don't allow a float to be overwritten by a BTF float. */
- err = ctf_dynhash_insert_type (fp, fp->ctf_names,
- ctf_index_to_type (fp, id),
- suffix->ctt_name);
- if (err != 0)
- return err * -1;
- break;
+ if (((existing = ctf_dynhash_lookup_type (fp->ctf_names, name)) == 0)
+ && ctf_type_kind (fp, existing) == CTF_K_FLOAT)
+ break;
+
+ err = ctf_dynhash_insert_type (fp, fp->ctf_names,
+ ctf_index_to_type (fp, id),
+ suffix->ctt_name);
+ if (err != 0)
+ return err * -1;
+ break;
+ }
/* These kinds have no name, so do not need interning into any
hashtables. */
@@ -971,7 +973,7 @@ init_static_types_names_internal (ctf_dict_t *fp, ctf_header_t *cth, int is_btf,
/* Only insert forward types if the type is not already present. */
if (vlen == 0
&& ctf_dynhash_lookup_type (ctf_name_table (fp, kind),
- suffix->ctt_name) != 0)
+ name) != 0)
break;
err = ctf_dynhash_insert_type (fp, fp->ctf_enums,
@@ -1024,7 +1026,7 @@ init_static_types_names_internal (ctf_dict_t *fp, ctf_header_t *cth, int is_btf,
/* Remember the biggest datasec we've seen. */
- if (vlen > biggest_datasec)
+ if ((ssize_t) vlen > biggest_datasec)
{
biggest_datasec = vlen;
fp->ctf_default_var_datasec = id;
@@ -1186,18 +1188,18 @@ ctf_flip_header (void *cthp, int is_btf, int ctf_version)
{
ctf_btf_header_t *bth = (ctf_btf_header_t *) cthp;
- swap_thing (cth->btf.bth_preamble.btf_magic);
- swap_thing (cth->btf.bth_preamble.btf_version);
- swap_thing (cth->btf.bth_preamble.btf_flags);
- swap_thing (cth->btf.bth_hdr_len);
- swap_thing (cth->btf.btf_type_off);
- swap_thing (cth->btf.btf_type_len);
- swap_thing (cth->btf.str_off);
- swap_thing (cth->btf.str_len);
+ swap_thing (bth->bth_preamble.btf_magic);
+ swap_thing (bth->bth_preamble.btf_version);
+ swap_thing (bth->bth_preamble.btf_flags);
+ swap_thing (bth->bth_hdr_len);
+ swap_thing (bth->bth_type_off);
+ swap_thing (bth->bth_type_len);
+ swap_thing (bth->bth_str_off);
+ swap_thing (bth->bth_str_len);
/* Raw BTF? */
if (ctf_version == 1)
- return;
+ return 0;
}
else
{
@@ -1209,17 +1211,17 @@ ctf_flip_header (void *cthp, int is_btf, int ctf_version)
case CTF_VERSION_1:
case CTF_VERSION_1_UPGRADED_3:
case CTF_VERSION_2:
- ctf_err_warn (ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
+ ctf_err_warn (NULL, 0, ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
return (ctf_set_open_errno (errp, ECTF_INTERNAL));
/* ctf_flip_header_v2 (cth); */
break;
case CTF_VERSION_3:
- ctf_err_warn (ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
- return (ctf_set_open_errno (errp, ECTF_INTERNAL));
+ ctf_err_warn (NULL, 0, ECTF_INTERNAL, "Implementation of backward-compatible CTF reading still underway\n");
+ return (ctf_set_open_errno (errp, ECTF_INTERNAL));
/* ctf_flip_header_v3 (cth); */
}
- return;
+ return 0;
}
/* CTFv4. */
@@ -1238,6 +1240,8 @@ ctf_flip_header (void *cthp, int is_btf, int ctf_version)
swap_thing (cth->cth_objtidx_len);
swap_thing (cth->cth_funcidx_off);
swap_thing (cth->cth_funcidx_len);
+
+ return 0;
}
/* Flip the endianness of the data-object or function sections or their indexes,
diff --git a/libctf/ctf-serialize.c b/libctf/ctf-serialize.c
index 1061fff..75cac32 100644
--- a/libctf/ctf-serialize.c
+++ b/libctf/ctf-serialize.c
@@ -1705,7 +1705,8 @@ ctf_write_mem (ctf_dict_t *fp, size_t *size, size_t threshold)
if (flip_endian)
{
- ctf_flip_header (hp, fp->ctf_serializing_is_btf, 0);
+ if (ctf_flip_header (hp, fp->ctf_serializing_is_btf, 0) <0)
+ goto err; /* errno is set for us. */
if (ctf_flip (fp, rawhp, src, fp->ctf_serializing_is_btf, 1) < 0)
goto err; /* errno is set for us. */
}
diff --git a/libctf/ctf-types.c b/libctf/ctf-types.c
index 959a988..2d12644 100644
--- a/libctf/ctf-types.c
+++ b/libctf/ctf-types.c
@@ -252,7 +252,7 @@ ctf_member_next (ctf_dict_t *fp, ctf_id_t type, ctf_next_t **it,
if (i->u.ctn_dtd)
i->u.ctn_tp = dtd->dtd_buf;
- if ((prefix = ctf_find_prefix (i->u.ctn_tp, CTF_K_BIG)) == NULL)
+ if ((prefix = ctf_find_prefix (fp, i->u.ctn_tp, CTF_K_BIG)) == NULL)
prefix = i->u.ctn_tp;
/* When we hit an unnamed struct/union member, we set ctn_type to indicate
@@ -615,7 +615,7 @@ ctf_type_next (ctf_dict_t *fp, ctf_next_t **it, int *flag, int want_hidden)
if (i->ctn_type > fp->ctf_stypes)
tp = ctf_dtd_lookup (fp, ctf_index_to_type (fp, i->ctn_type))->dtd_data;
else
- tp = (ctf_type_t *)((uintptr_t)(fp)->ctf_buf + (fp)->ctf_txlate[(i)]);
+ tp = (ctf_type_t *)((uintptr_t) fp->ctf_buf + fp->ctf_txlate[i->ctn_type]);
if ((!want_hidden) && (!LCTF_INFO_ISROOT (fp, tp->ctt_info)))
{
@@ -1128,8 +1128,8 @@ ctf_type_aname (ctf_dict_t *fp, ctf_id_t type)
fi.ctc_argc, argv) < 0)
goto err; /* errno is set for us. */
- if (ctf_func_type_params (rfp, cdp->cd_type,
- fi.ctc_argc, arg_names) < 0)
+ if (ctf_func_type_arg_names (rfp, cdp->cd_type,
+ fi.ctc_argc, arg_names) < 0)
goto err; /* errno is set for us. */
ctf_decl_sprintf (&cd, "(*) (");
@@ -1510,7 +1510,7 @@ ctf_type_align (ctf_dict_t *fp, ctf_id_t type)
use and compatibility. */
int
-ctf_type_kind_unsliced_tp (ctf_dict_t *fp, ctf_type_t *tp)
+ctf_type_kind_unsliced_tp (ctf_dict_t *fp, const ctf_type_t *tp)
{
const ctf_type_t *suffix = NULL;
@@ -1525,7 +1525,7 @@ ctf_type_kind_unsliced_tp (ctf_dict_t *fp, ctf_type_t *tp)
Slices are considered to be of the same kind as the type sliced. */
int
-ctf_type_kind_tp (ctf_dict_t *fp, ctf_type_t *tp)
+ctf_type_kind_tp (ctf_dict_t *fp, const ctf_type_t *tp)
{
int kind;
@@ -1549,7 +1549,7 @@ ctf_type_kind_tp (ctf_dict_t *fp, ctf_type_t *tp)
/* Return the kind of this type pointer, except, for forwards, return the kind
of thing this is a forward to. */
int
-ctf_type_kind_forwarded_tp (ctf_dict_t *fp, ctf_type_t *tp)
+ctf_type_kind_forwarded_tp (ctf_dict_t *fp, const ctf_type_t *tp)
{
int kind;
const ctf_type_t *tp; /* The suffixed kind, if prefixed */