public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: David Faust <david.faust@oracle.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: Indu Bhagat <indu.bhagat@oracle.com>, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] btf: do not use the CHAR `encoding' bit for BTF
Date: Tue, 2 Aug 2022 09:05:35 -0700	[thread overview]
Message-ID: <a80bb7d6-db4c-0cb6-25f0-300bd7c92731@oracle.com> (raw)
In-Reply-To: <878ro6bqip.fsf@oracle.com>



On 8/2/22 08:42, Jose E. Marchesi wrote:
> 
>> On 7/26/22 14:58, Indu Bhagat wrote:
>>> On 7/22/22 4:23 AM, Jose E. Marchesi via Gcc-patches wrote:
>>>>
>>>> Contrary to CTF and our previous expectations, as per [1], turns out
>>>> that in BTF:
>>>>
>>>> 1) The `encoding' field in integer types shall not be treated as a
>>>>     bitmap, but as an enumerated, i.e. these bits are exclusive to each
>>>>     other.
>>>>
>>>> 2) The CHAR bit in `encoding' shall _not_ be set when emitting types
>>>>     for char nor `unsigned char'.
>>>>
>>>
>>> Hmm...well.  At this time, I suggest we make a note of this in the btf.h 
>>> for posterity that BTF_INT_CHAR is to not be used (i.e., BTF_INT_CHAR 
>>> should not be set for char / unsigned char).
>>
>> Agreed it would be good to add this note.
> 
> Hmm, I am not sure such a comment actually belongs to include/btf.h,
> which is not specific to the compiler and is supposed to reflect the BTF
> format per-se.  The CHAR bit is documented in the kernel documentation
> and it may be used at some point by bpflib, or who knows what.

OK you make a good point.

In that case the patch LGTM to commit. Thanks!

> 
> That's why I put the comment in btfout.cc instead, to make it clear that
> BTF_INT_CHAR is indeed not to be set for char / unsigned char by the
> compiler:
> 
>>>> +      /* In BTF the CHAR `encoding' seems to not be used, so clear it
>>>> +         here.  */
>>>> +      dtd->dtd_u.dtu_enc.cte_format &= ~BTF_INT_CHAR;

  reply	other threads:[~2022-08-02 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-22 11:23 Jose E. Marchesi
2022-07-26 21:58 ` Indu Bhagat
2022-08-01 18:52   ` David Faust
2022-08-02 15:42     ` Jose E. Marchesi
2022-08-02 16:05       ` David Faust [this message]
2022-08-02 17:26         ` Jose E. Marchesi

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=a80bb7d6-db4c-0cb6-25f0-300bd7c92731@oracle.com \
    --to=david.faust@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=indu.bhagat@oracle.com \
    --cc=jose.marchesi@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).