public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: David Faust <dfaust@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/dfaust/heads/btf-type-tag-new-rebase)] Output BTF DECL_TAG and TYPE_TAG types Date: Fri, 7 Oct 2022 18:34:51 +0000 (GMT) [thread overview] Message-ID: <20221007183451.7876E3857B9A@sourceware.org> (raw) 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;
reply other threads:[~2022-10-07 18:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20221007183451.7876E3857B9A@sourceware.org \ --to=dfaust@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).