]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
libctf: dedup: type tags
authorNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 19:32:58 +0000 (20:32 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 25 Apr 2025 20:23:07 +0000 (21:23 +0100)
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).

libctf/ctf-dedup.c

index e9baa5a2e22ae76f70a1145ace38e106c2c13013..1aec45be5cf3ab74c2fab0f9bd6577f40b71ada6 100644 (file)
@@ -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");