Dwarves Archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Yonghong Song <yhs@fb.com>,
	Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>,
	dwarves@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	bpf@vger.kernel.org, Daniel Borkmann <daniel@iogearbox.net>,
	kernel-team@fb.com
Subject: Re: [PATCH dwarves] dwarf_loader: encode char type as signed
Date: Wed, 10 Aug 2022 15:59:59 -0300	[thread overview]
Message-ID: <YvQAL+8Ah5J0hWAg@kernel.org> (raw)
In-Reply-To: <CAEf4BzYaWboRjHqewen71QZhvQyvtkeE5N43y=NvE+igw4RXYw@mail.gmail.com>

Em Mon, Aug 08, 2022 at 03:52:38PM -0700, Andrii Nakryiko escreveu:
> On Mon, Aug 8, 2022 at 3:52 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
> >
> > On Sun, Aug 7, 2022 at 10:53 AM Yonghong Song <yhs@fb.com> wrote:
> > >
> > > Currently, the pahole treats 'char' or 'signed char' type
> > > as unsigned in BTF generation. The following is an example,
> > >   $ cat t.c
> > >   signed char a;
> > >   char b;
> > >   $ clang -O2 -g -c t.c
> > >   $ pahole -JV t.o
> > >   ...
> > >   [1] INT signed char size=1 nr_bits=8 encoding=(none)
> > >   [2] INT char size=1 nr_bits=8 encoding=(none)
> > > In the above encoding '(none)' implies unsigned type.
> > >
> > > But if the same program is compiled with bpf target,
> > >   $ clang -target bpf -O2 -g -c t.c
> > >   $ bpftool btf dump file t.o
> > >   [1] INT 'signed char' size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
> > >   [2] VAR 'a' type_id=1, linkage=global
> > >   [3] INT 'char' size=1 bits_offset=0 nr_bits=8 encoding=SIGNED
> > >   [4] VAR 'b' type_id=3, linkage=global
> > >   [5] DATASEC '.bss' size=0 vlen=2
> > >           type_id=2 offset=0 size=1 (VAR 'a')
> > >           type_id=4 offset=0 size=1 (VAR 'b')
> > > the 'char' and 'signed char' are encoded as SIGNED integers.
> > >
> > > Encode 'char' and 'signed char' as SIGNED should be a right to
> > > do and it will be consistent with bpf implementation.
> > >
> > > With this patch,
> > >   $ pahole -JV t.o
> > >   ...
> > >   [1] INT signed char size=1 nr_bits=8 encoding=SIGNED
> > >   [2] INT char size=1 nr_bits=8 encoding=SIGNED
> > >
> > > Signed-off-by: Yonghong Song <yhs@fb.com>
> > > ---
> >
> > LGTM.
> 
> Acked-by: Andrii Nakryiko <andrii@kernel.org>

Thanks, tested before/after, applied.

Pushing out next for CI testing.

- Arnaldo

  reply	other threads:[~2022-08-10 19:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-07 17:53 [PATCH dwarves] dwarf_loader: encode char type as signed Yonghong Song
2022-08-08 22:52 ` Andrii Nakryiko
2022-08-08 22:52   ` Andrii Nakryiko
2022-08-10 18:59     ` Arnaldo Carvalho de Melo [this message]
2022-08-09  6:33   ` Yonghong Song

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=YvQAL+8Ah5J0hWAg@kernel.org \
    --to=acme@kernel.org \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=arnaldo.melo@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=dwarves@vger.kernel.org \
    --cc=kernel-team@fb.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 read-only IMAP folder(s) and NNTP newsgroup(s).