Re: [PATCH dwarves] dwarf_loader: encode char type as signed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> wrote:
> >
> > On Sun, Aug 7, 2022 at 10:53 AM Yonghong Song <yhs@xxxxxx> 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@xxxxxx>
> > > ---
> >
> > LGTM.
> 
> Acked-by: Andrii Nakryiko <andrii@xxxxxxxxxx>

Thanks, tested before/after, applied.

Pushing out next for CI testing.

- Arnaldo



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux