From: Nick Alcock <nick.alcock@oracle.com>
To: Alan Maguire <alan.maguire@oracle.com>
Cc: Bruce McCulloch <bruce.mcculloch@oracle.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
dwarves@vger.kernel.org
Subject: Re: Pahole, BTF, and vector types
Date: Tue, 20 May 2025 16:27:29 +0100 [thread overview]
Message-ID: <878qmr5mla.fsf@esperi.org.uk> (raw)
In-Reply-To: <f5ff6332-eb86-4c08-b4c4-9e7c9b8fb882@oracle.com> (Alan Maguire's message of "Wed, 14 May 2025 16:22:23 +0100")
On 14 May 2025, Alan Maguire told this:
> On 13/05/2025 23:39, Bruce McCulloch wrote:
>> Hello Alan, Arnaldo, All,
>>
>> Recently the Linux Toolchain team at oracle had reason to start emitting
>> types
>> with the vector_size() attribute as arrays when compiling with -gctf/-
>> gbtf. This
>> is a change from the previous behavior, which was to emit these as unknown
>> types. This emission as an array is consistent with BTF generated in
>> both clang
>> and pahole. We have some ideas on how to implement the change in GCC,
>> but were
>> wondering if anyone involved with dwarves had any insight into why
>> vectors are
>> emitted in this way. More specifically, there were concerns surrounding the
>> practical differences between vectors and arrays in the realm of memory
>> (e.g.
>> Vectors can be passed as args by value, while arrays cannot). More
>> information
>> about this can be found on the DWARF std issues list [1].
>>
>> Any input on this subject would be much appreciated.
>>
>> Bruce
>>
>> [1] https://dwarfstd.org/issues/230413.1.html
>>
>
>
> As far as I can see in dwarf_loader.c we do record that an array type is
> a vector, noting that struct array_type specifies true for its
> "is_vector" field if the DIE has a DW_AT_GNU_vector attribute, but this
> information is not used during BTF encoding; they are as you say just
> treated like normal arrays.
>
> So we do have the information available to potentially do something
> different for vectors at BTF encoding time. Did you have a specific
> representation in mind? Thanks!
We were thinking of simply turning on the kind_flag in the
BTF_KIND_ARRAY for such arrays-that-are-actually-vectors: it's not used
for anything else as yet, and that means we don't need to add something
to the vlen (which would of course be a compatibility break, though BTF
seems to care relatively little about such things). Adding a new meaning
for kind_flag 1 ("is a vector") is relatively compatibility-concern
free.
(I'm assuming that being a vector is a one-bit decision: vectors don't
seem to have any other properties beyond those arrays have in the DWARF
representation nor in GCC nor clang, that I can see.)
--
NULL && (void)
prev parent reply other threads:[~2025-05-20 15:27 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-13 22:39 Pahole, BTF, and vector types Bruce McCulloch
2025-05-14 15:22 ` Alan Maguire
2025-05-20 15:27 ` Nick Alcock [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=878qmr5mla.fsf@esperi.org.uk \
--to=nick.alcock@oracle.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=bruce.mcculloch@oracle.com \
--cc=dwarves@vger.kernel.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: 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