aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Alcock <nick.alcock@oracle.com>2025-04-25 20:32:58 +0100
committerNick Alcock <nick.alcock@oracle.com>2025-04-25 21:23:07 +0100
commitbf735030ac448b1e60d3f01fb88f205de3153656 (patch)
tree21ab4ee946e68771b5993162ab5b7f1ddc987772
parent4db605353c33245acb436d76129610131916574a (diff)
downloadbinutils-bf735030ac448b1e60d3f01fb88f205de3153656.zip
binutils-bf735030ac448b1e60d3f01fb88f205de3153656.tar.gz
binutils-bf735030ac448b1e60d3f01fb88f205de3153656.tar.bz2
libctf: dedup: type tags
Another trivial case: they're just like pointers except that they have a name (and we don't need to care about that, because names are hashed in, if present, anyway).
-rw-r--r--libctf/ctf-dedup.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libctf/ctf-dedup.c b/libctf/ctf-dedup.c
index e9baa5a..1aec45b 100644
--- a/libctf/ctf-dedup.c
+++ b/libctf/ctf-dedup.c
@@ -821,6 +821,7 @@ ctf_dedup_rhash_type (ctf_dict_t *fp, ctf_dict_t *input, ctf_dict_t **inputs,
case CTF_K_CONST:
case CTF_K_RESTRICT:
case CTF_K_POINTER:
+ case CTF_K_TYPE_TAG:
/* Hash the referenced type, if not already hashed, and mix it in. */
child_type = ctf_type_reference (input, type);
if ((hval = ctf_dedup_hash_type (fp, input, inputs, input_num, child_type,
@@ -2548,6 +2549,7 @@ ctf_dedup_rwalk_one_output_mapping (ctf_dict_t *output,
case CTF_K_SLICE:
case CTF_K_FUNC_LINKAGE:
case CTF_K_VAR:
+ case CTF_K_TYPE_TAG:
CTF_TYPE_WALK (ctf_type_reference (fp, type), err,
N_("error during referenced type walk"));
break;
@@ -3283,6 +3285,19 @@ ctf_dedup_emit_type (const char *hval, ctf_dict_t *output, ctf_dict_t **inputs,
goto err_target; /* errno is set for us. */
break;
+ case CTF_K_TYPE_TAG:
+ errtype = _("type tag");
+
+ ref = ctf_type_reference (input, type);
+ if ((ref = ctf_dedup_id_to_target (output, target, inputs, ninputs,
+ parents, input, input_num,
+ ref)) == CTF_ERR)
+ goto err_input; /* errno is set for us. */
+
+ if ((new_type = ctf_add_type_tag (target, isroot, ref, name)) == CTF_ERR)
+ goto err_target; /* errno is set for us. */
+ break;
+
case CTF_K_SLICE:
errtype = _("slice");