Re: [PATCH dwarves] btf_loader: handle union forward declaration properly

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

 



Em Wed, Oct 21, 2020 at 12:47:30PM -0700, Andrii Nakryiko escreveu:
> On Wed, Oct 21, 2020 at 12:25 PM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > > @@ -313,7 +314,7 @@ static int create_new_subroutine_type(struct btf_elf *btfe, const struct btf_typ
> > >
> > >  static int create_new_forward_decl(struct btf_elf *btfe, const struct btf_type *tp, uint32_t id)
> > >  {
> > > -     struct class *fwd = class__new(tp->name_off, 0);
> > > +     struct class *fwd = class__new(tp->name_off, 0, btf_kind(tp));
 
> *FACEPALM*... This should be btf_kflag(tp) instead. I'll use btfdiff
> on all my patches from now on, sorry about this!

:-)

I'll retest when you resubmit.

One other thing I like to use is 'fullcircle':


<SNIP>
# See how your DW_AT_producer looks like and find the
# right regexp to get after the GCC version string, this one
# seems good enough for Red Hat/Fedora/CentOS that look like:
#
#   DW_AT_producer    : (indirect string, offset: 0x3583): GNU C89 8.2.1 20181215 (Red Hat 8.2.1-6) -mno-sse -mno-mmx
#
# So we need from -mno-sse onwards

CFLAGS=$(readelf -wi $file | grep -w DW_AT_producer | sed -r      's/.*\)( -[[:alnum:]]+.*)+/\1/g')

# Check if we managed to do the sed or if this is something like GNU AS
[ "${CFLAGS/DW_AT_producer/}" != "${CFLAGS}" ] && exit

${pfunct_bin} --compile $file > $c_output
gcc $CFLAGS -c -g $c_output -o $o_output
${codiff_bin} -q -s $file $o_output
<SNIP>


$ pfunct --help |& grep compile
      --compile[=FUNCTION]   Generate compilable source code with types
$

It generates code for all functions in a .o that touch its parameters
and right before those functions it regenerates all the types, so you go
from type information to C code that gets compiled with the same
compiler command line setting (obtained from DW_AT_producer for DWARF)
with type information and then it compares the original type information
with the one generated from the regenerated "original" source code.

Right now it works only with DWARF, because for it we derive the packed
attribute (pahole does that for BTF too) but, unlike bpftool btf it
doesn't add the needed padding for __alignment__ things, and DWARF
provides that info.

I'll work on that eventually and then fullcircle will do it for both
DWARF and for BTF.

- Arnaldo



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux