public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/dfaust/heads/btf-type-tag-new-rebase)] Output BTF DECL_TAG and TYPE_TAG types
@ 2022-10-07 18:34 David Faust
0 siblings, 0 replies; only message in thread
From: David Faust @ 2022-10-07 18:34 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1affad2e1f5a2d7a9c5cbc970ca252140465273c
commit 1affad2e1f5a2d7a9c5cbc970ca252140465273c
Author: David Faust <david.faust@oracle.com>
Date: Wed Mar 2 15:13:13 2022 -0800
Output BTF DECL_TAG and TYPE_TAG types
This patch updates btfout.cc to be aware of the DECL_TAG and TYPE_TAG
kinds and output them appropriately.
gcc/
* btfout.cc (get_btf_kind): Handle TYPE_TAG and DECL_TAG kinds.
(btf_calc_num_vbytes): Likewise.
(btf_asm_type): Likewise.
(output_asm_btf_vlen_bytes): Likewise.
Diff:
---
gcc/btfout.cc | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/gcc/btfout.cc b/gcc/btfout.cc
index 997a33fa089..573d00837ee 100644
--- a/gcc/btfout.cc
+++ b/gcc/btfout.cc
@@ -136,6 +136,8 @@ get_btf_kind (uint32_t ctf_kind)
case CTF_K_VOLATILE: return BTF_KIND_VOLATILE;
case CTF_K_CONST: return BTF_KIND_CONST;
case CTF_K_RESTRICT: return BTF_KIND_RESTRICT;
+ case CTF_K_TYPE_TAG: return BTF_KIND_TYPE_TAG;
+ case CTF_K_DECL_TAG: return BTF_KIND_DECL_TAG;
default:;
}
return BTF_KIND_UNKN;
@@ -201,6 +203,7 @@ btf_calc_num_vbytes (ctf_dtdef_ref dtd)
case BTF_KIND_CONST:
case BTF_KIND_RESTRICT:
case BTF_KIND_FUNC:
+ case BTF_KIND_TYPE_TAG:
/* These kinds have no vlen data. */
break;
@@ -238,6 +241,10 @@ btf_calc_num_vbytes (ctf_dtdef_ref dtd)
vlen_bytes += vlen * sizeof (struct btf_var_secinfo);
break;
+ case BTF_KIND_DECL_TAG:
+ vlen_bytes += sizeof (struct btf_decl_tag);
+ break;
+
default:
break;
}
@@ -637,6 +644,22 @@ btf_asm_type (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
dw2_asm_output_data (4, dtd->dtd_data.ctti_size, "btt_size: %uB",
dtd->dtd_data.ctti_size);
return;
+ case BTF_KIND_DECL_TAG:
+ {
+ /* A decl tag might refer to (be the child DIE of) a variable. Try to
+ lookup the parent DIE's CTF variable, and if it exists point to the
+ corresponding BTF variable. This is an odd construction - we have a
+ 'type' which refers to a variable, rather than the reverse. */
+ dw_die_ref parent = dw_get_die_parent (dtd->dtd_key);
+ ctf_dvdef_ref dvd = ctf_dvd_lookup (ctfc, parent);
+ if (dvd)
+ {
+ unsigned int var_id =
+ *(btf_var_ids->get (dvd)) + num_types_added + 1;
+ dw2_asm_output_data (4, var_id, "btt_type");
+ return;
+ }
+ }
default:
break;
}
@@ -957,6 +980,11 @@ output_asm_btf_vlen_bytes (ctf_container_ref ctfc, ctf_dtdef_ref dtd)
at this point. */
gcc_unreachable ();
+ case BTF_KIND_DECL_TAG:
+ dw2_asm_output_data (4, dtd->dtd_u.dtu_btfnote.component_idx,
+ "decltag_compidx");
+ break;
+
default:
/* All other BTF type kinds have no variable length data. */
break;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-10-07 18:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-07 18:34 [gcc(refs/users/dfaust/heads/btf-type-tag-new-rebase)] Output BTF DECL_TAG and TYPE_TAG types David Faust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).