rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
	Martin Rodriguez Reboredo <yakoyoku@gmail.com>,
	linux-kernel@vger.kernel.org, Neal Gompa <neal@gompa.dev>,
	Eric Curtin <ecurtin@redhat.com>,
	bpf@vger.kernel.org, rust-for-linux@vger.kernel.org,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Yonghong Song <yhs@fb.com>
Subject: pahole issues with Rust DWARF was: Re: [PATCH 1/1] pahole/Rust: Check that we're adding DW_TAG_member sorted by byte offset
Date: Mon, 13 Feb 2023 09:09:32 -0300	[thread overview]
Message-ID: <Y+oofL/aJmUjcxIR@kernel.org> (raw)
In-Reply-To: <Y+atpJV5rqo08dQJ@kernel.org>

Em Fri, Feb 10, 2023 at 05:48:36PM -0300, Arnaldo Carvalho de Melo escreveu:
> I'll go thru the others to see if they are easy (or at least restricted
> to Rust CUs) as this one.

The namespace.o seems to be ok:

⬢[acme@toolbox pahole]$ cat ../pahole-rust-cases/namespace.rs
pub struct S {
    pub a: i32,
}

pub static S: (i32, S) = (42, S { a: 42 });
⬢[acme@toolbox pahole]$

⬢[acme@toolbox pahole]$ pahole --show_private_classes ../pahole-rust-cases/namespace.o
struct S {
	i32                        a __attribute__((__aligned__(4))); /*     0     4 */

	/* size: 4, cachelines: 1, members: 1 */
	/* forced alignments: 1 */
	/* last cacheline: 4 bytes */
} __attribute__((__aligned__(4)));
struct (i32, namespace::S) {
	i32                        __0 __attribute__((__aligned__(4))); /*     0     4 */
	struct S                   __1 __attribute__((__aligned__(4))); /*     4     4 */

	/* size: 8, cachelines: 1, members: 2 */
	/* forced alignments: 2 */
	/* last cacheline: 8 bytes */
} __attribute__((__aligned__(4)));
⬢[acme@toolbox pahole]$

And encoding/decoding BTF for it:

⬢[acme@toolbox pahole]$ cp ../pahole-rust-cases/namespace.o .
⬢[acme@toolbox pahole]$ pahole --btf_encode namespace.o
⬢[acme@toolbox pahole]$ pahole -F btf namespace.o
struct S {
	i32                        a;                    /*     0     4 */

	/* size: 4, cachelines: 1, members: 1 */
	/* last cacheline: 4 bytes */
};
struct (i32, namespace::S) {
	i32                        __0;                  /*     0     4 */
	struct S                   __1;                  /*     4     4 */

	/* size: 8, cachelines: 1, members: 2 */
	/* last cacheline: 8 bytes */
};
⬢[acme@toolbox pahole]$ readelf -SW namespace.o | grep BTF
  [18] .BTF              PROGBITS        0000000000000000 00065c 000089 00      0   0  1
⬢[acme@toolbox pahole]$


The core one needs work:

⬢[acme@toolbox pahole]$ pahole ../pahole-rust-cases/core.o |& head
die__process_class: tag not supported 0x2f (template_type_parameter)!
die__process_class: tag not supported 0x33 (variant_part)!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2fd8d> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2fdf7> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2fe61> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2fecb> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2ff35> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x2ff9f> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x30009> not handled!
die__create_new_enumeration: DW_TAG_subprogram (0x2e) @ <0x30073> not handled!
⬢[acme@toolbox pahole]$

 <1><90>: Abbrev Number: 7 (DW_TAG_namespace)
    <91>   DW_AT_name        : (indirect string, offset: 0x147): core
 <2><95>: Abbrev Number: 7 (DW_TAG_namespace)
    <96>   DW_AT_name        : (indirect string, offset: 0x14c): str
 <3><9a>: Abbrev Number: 7 (DW_TAG_namespace)
    <9b>   DW_AT_name        : (indirect string, offset: 0x150): iter
 <4><9f>: Abbrev Number: 8 (DW_TAG_structure_type)
    <a0>   DW_AT_name        : (indirect string, offset: 0x2e1): Split<core::str::IsWhitespace>
    <a4>   DW_AT_byte_size   : 64
    <a5>   DW_AT_alignment   : 8
 <5><a6>: Abbrev Number: 9 (DW_TAG_template_type_param)
    <a7>   DW_AT_type        : <0x41fc>
    <ab>   DW_AT_name        : (indirect string, offset: 0x162): P
 <5><af>: Abbrev Number: 4 (DW_TAG_member)
    <b0>   DW_AT_name        : (indirect string, offset: 0x164): __0
    <b4>   DW_AT_type        : <0xbb>
    <b8>   DW_AT_alignment   : 8
    <b9>   DW_AT_data_member_location: 0
 <5><ba>: Abbrev Number: 0
 <4><bb>: Abbrev Number: 8 (DW_TAG_structure_type)
    <bc>   DW_AT_name        : (indirect string, offset: 0x2ba): SplitInternal<core::str::IsWhitespace>
    <c0>   DW_AT_byte_size   : 64
    <c1>   DW_AT_alignment   : 8
 <5><c2>: Abbrev Number: 9 (DW_TAG_template_type_param)
    <c3>   DW_AT_type        : <0x41fc>
    <c7>   DW_AT_name        : (indirect string, offset: 0x162): P

- Arnaldo

  reply	other threads:[~2023-02-13 12:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-11 15:20 [PATCH v3] scripts: Exclude Rust CUs with pahole Martin Rodriguez Reboredo
2023-01-11 15:22 ` Eric Curtin
2023-01-11 15:34 ` Neal Gompa
2023-01-11 16:16   ` Eric Curtin
2023-01-11 16:21     ` Neal Gompa
2023-01-16 16:37 ` Daniel Borkmann
2023-01-16 16:52   ` Miguel Ojeda
2023-01-16 17:06     ` Daniel Borkmann
2023-01-16 17:19       ` Miguel Ojeda
2023-02-10 20:48         ` [PATCH 1/1] pahole/Rust: Check that we're adding DW_TAG_member sorted by byte offset Arnaldo Carvalho de Melo
2023-02-13 12:09           ` Arnaldo Carvalho de Melo [this message]
2023-02-13 12:45             ` pahole issues with Rust DWARF was: " Miguel Ojeda
2023-02-13 12:53               ` Eric Curtin
2023-02-13 21:53                 ` Arnaldo Carvalho de Melo
2023-02-13 21:05               ` Arnaldo Carvalho de Melo
2023-02-14 21:22           ` Arnaldo Carvalho de Melo
2023-01-16 19:22   ` [PATCH v3] scripts: Exclude Rust CUs with pahole Arnaldo Carvalho de Melo
2023-01-17 16:40 ` patchwork-bot+netdevbpf

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=Y+oofL/aJmUjcxIR@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=ecurtin@redhat.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=neal@gompa.dev \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=yakoyoku@gmail.com \
    --cc=yhs@fb.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 NNTP newsgroup(s).