From: Yonghong Song <yhs@meta.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: bpf@vger.kernel.org, david.faust@oracle.com,
elena.zannoni@oracle.com, David Malcolm <dmalcolm@redhat.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Julia Lawall <julia.lawall@inria.fr>
Subject: Re: Follow up from the btf_type_tag discussion in the BPF office hours
Date: Tue, 27 Dec 2022 20:49:30 -0800 [thread overview]
Message-ID: <c56183d3-7d75-af03-321e-8ccffafdd1ab@meta.com> (raw)
In-Reply-To: <87h6xrfgmz.fsf@oracle.com>
On 12/19/22 9:27 AM, Jose E. Marchesi wrote:
>
> Hi Yonghong.
>
>> On 12/15/22 10:43 AM, Jose E. Marchesi wrote:
>>> Of the two problems discussed:
>>> 1. DW_TAG_LLVM_annotation not being able to denote annotations to
>>> non-pointed based types. clang currently ignores these instances.
>>> We discussed two possible options to deal with this:
>>> 1.1 To continue ignoring these cases in the front-end, keep the dwarf
>>> expressiveness limitation, and document it.
>>> 1.2 To change DW_TAG_LLVM_annotation so it behaves like a qualifier
>>> DIE (like const, volatile, etc.) so it can apply to any type.
>>
>> Thanks for the detailed update. Yes, we do want to __tag behaving like
>> a qualifier.
>>
>> Today clang only support 'base_type <type_tag> *' style of code.
>> But we are open to support non-pointer style of tagging like
>> 'base_type <type_tag> global_var'. Because of this, the following
>> dwarf output should be adopted:
>> C: int __tag1 * __tag2 * p;
>> dwarf: ptr -> __tag2 --> ptr -> __tag1 -> int
>> or
>> C: int __tag1 g;
>> dwarf: var_g -> __tag1 --> int
>>
>> The above format *might* require particular dwarf tools to add support
>> for __tag attribute. But I think it is a good thing in the long run
>> esp. if we might add support to non-pointer types. In current
>> implementation, dwarf tools can simply ignore the children of ptr
>> which they may already do it.
>
> I wonder, since these annotations are atomic, is there a reason for not
> using an attribute instead of a DIE tag? Something like DW_AT_annotation.
Yes, we can. My suggestion is to facilitate gcc implementation.
Currently clang uses an attribute instead of a DIE tag. I am totally
fine if gcc uses the same dwarf representation mechanism as clang.
>
> The attribute could then be used by any DIE (declaration, type, ...) and
> existing DWARF consumers that don't support the new attribute would
> happily just ignore it.
clang already use attributes to represent btf_type_tag and btf_decl_tag.
One of early considerations to use attribute in clang indeed is to avoid
existing tool changes as much as possible.
prev parent reply other threads:[~2022-12-28 4:52 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-15 18:43 Follow up from the btf_type_tag discussion in the BPF office hours Jose E. Marchesi
2022-12-15 22:14 ` Jose E. Marchesi
2022-12-17 1:38 ` Yonghong Song
2022-12-19 17:27 ` Jose E. Marchesi
2022-12-28 4:49 ` Yonghong Song [this message]
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=c56183d3-7d75-af03-321e-8ccffafdd1ab@meta.com \
--to=yhs@meta.com \
--cc=bpf@vger.kernel.org \
--cc=david.faust@oracle.com \
--cc=dmalcolm@redhat.com \
--cc=elena.zannoni@oracle.com \
--cc=jose.marchesi@oracle.com \
--cc=julia.lawall@inria.fr \
--cc=ndesaulniers@google.com \
/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: link
Be 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