public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@seketeli.org>
To: Mark Wielaard <mark@klomp.org>
Cc: libabigail@sourceware.org
Subject: Re: Surprising behavior of suppress_type drop = yes
Date: Thu, 09 Apr 2020 15:52:51 +0200	[thread overview]
Message-ID: <86k12oojf0.fsf@seketeli.org> (raw)
In-Reply-To: <52c5ab9801899f080f4e7838ded9ea64f78317c9.camel@klomp.org> (Mark Wielaard's message of "Wed, 08 Apr 2020 16:32:53 +0200")

[-- Attachment #1: Type: text/plain, Size: 3372 bytes --]

Hello Mark,

Mark Wielaard <mark@klomp.org> a écrit:

> Hi Dodji,
>
> On Mon, 2020-04-06 at 19:15 +0200, Dodji Seketeli wrote:
>> > Note how abidiff treats the function return type and parameters changed
>> > from void * to Foo * as disappearing.
>> > 
>> > Is there another way to achieve what I want/need?
>> 
>> I think there is a non-documented way to do this, yes.  It hasn't been
>> yet documented because nobody expressed the need for it yet.
>> 
>> Basically you want to do this:
>> 
>> [suppress_type]
>>   label = "Artificial·private·types·suppression·specification"
>
> Assuming those fancy dots are actually spaces.

Pfff, sorry, my copy-paste-fu failed miserably there.

I am attaching below the libfoo.supp suppression file I used. Actually,
there are no '"' delimitation character either.

[...]


> It doesn't seem to change anything for my example.  I assume it does
> for you?

Yes, sorry, it's my fault.  I hope with suppression file below it gets
better.

> Can you attach the xml abi file it is supposed to generate? Mine still
> looks like the attached with missing return types and arguments where
> there should be pointers to Foo. Maybe my suppression file still isn't
> correct? I attached both.

I attached the resulting abixml file I am getting below as well.


>> > Or can we have a "drop mode" that treats handles to dropped types a
>> > simple void pointers instead?
>> 
>> I think what you'd need, really, is a combination of:
>> 
>>     1/ a new --header-files{1,2} option
>>     2/ an "opaque = yes" attribute in the suppression specification.
>> 
>> I think either 1/ or 2/ should work, but it'd be nice to have both.
>> 
>> If you think that suggession holds water, then we should probably
>> file a
>> bug to add this new feature.
>
> Why not fix the default?

I am not sure what you mean by default.

"drop = yes" in the [suppress_type] section of a suppression
specification is not meant to be the same feature as
--header-files{1,2}.

drop = yes really drops *all* types that match the suppression
specification.  Those types disappear completement from the internal
representation.  This can be useful to aggressively reduce the size of
the internal representation.

--header-files{1,2} generates a suppression specification that drop all
types that are not defined in header files, but, for class/struct/
types, it does something different.  Rather than just droping those
struct/class types from the internal representation, it replaces them by
a (forward) declaration -- as opposed to the full type definition.  So a
pointer to that declaration becomes a pointer to an opaque type, in
practise.

These two features are useful to people in different use cases.

If your question is "how to do exactly what --headers-files{1,2} does
using suppression specfications", then the official answer today is "you
can't".


> I am trying to figure out why the command line option is different from
> the suppress_type default way of handling drop. And when that default
> way of working is actually useful?

Being able completly drop types from the IR is mainly used for size
optimization purposes.  And in that case, you really want to drop the
type on the floor, not replace it with something else.

I hope this is useful.

Cheers,


[-- Attachment #2: libfoo.supp --]
[-- Type: application/octet-stream, Size: 223 bytes --]

[suppress_function]
  file_name_not_regexp = foo.c
  drop = yes


[suppress_type]
  label = Artificial private types suppression specification
  source_location_not_in = foo.h, list.h, of.h, public.h, headers.h
  drop = yes

[-- Attachment #3: libfoo.so.suppr.abi --]
[-- Type: application/octet-stream, Size: 3932 bytes --]

<abi-corpus path='libfoo.so' architecture='elf-amd-x86_64'>
  <elf-needed>
    <dependency name='libc.so.6'/>
  </elf-needed>
  <elf-function-symbols>
    <elf-symbol name='create_foo' version='FOOLIB_1.0' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
    <elf-symbol name='destroy_foo' version='FOOLIB_1.0' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
    <elf-symbol name='get_foo' version='FOOLIB_1.0' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
    <elf-symbol name='set_foo' version='FOOLIB_1.0' is-default-version='yes' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
  </elf-function-symbols>
  <abi-instr version='1.0' address-size='64' path='foo.c' comp-dir-path='/home/dodji/tests/foolib/foolib' language='LANG_C89'>
    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
    <type-decl name='unsigned long int' size-in-bits='64' id='type-id-2'/>
    <type-decl name='void' id='type-id-3'/>
    <typedef-decl name='Foo' type-id='type-id-4' filepath='/home/dodji/tests/foolib/foolib/foo.h' line='1' column='1' id='type-id-5'/>
    <typedef-decl name='size_t' type-id='type-id-2' filepath='/usr/lib/gcc/x86_64-redhat-linux/4.8.5/include/stddef.h' line='212' column='1' id='type-id-6'/>
    <pointer-type-def type-id='type-id-5' size-in-bits='64' id='type-id-7'/>
    <pointer-type-def type-id='type-id-3' size-in-bits='64' id='type-id-8'/>
    <function-decl name='create_foo' mangled-name='create_foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='5' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='create_foo@@FOOLIB_1.0'>
      <return type-id='type-id-7'/>
    </function-decl>
    <function-decl name='destroy_foo' mangled-name='destroy_foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='14' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='destroy_foo@@FOOLIB_1.0'>
      <parameter type-id='type-id-7' name='foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='14' column='1'/>
      <return type-id='type-id-3'/>
    </function-decl>
    <function-decl name='set_foo' mangled-name='set_foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='20' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='set_foo@@FOOLIB_1.0'>
      <parameter type-id='type-id-7' name='foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='20' column='1'/>
      <parameter type-id='type-id-1' name='num' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='20' column='1'/>
      <return type-id='type-id-3'/>
    </function-decl>
    <function-decl name='get_foo' mangled-name='get_foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='27' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='get_foo@@FOOLIB_1.0'>
      <parameter type-id='type-id-7' name='foo' filepath='/home/dodji/tests/foolib/foolib/foo.c' line='27' column='1'/>
      <return type-id='type-id-1'/>
    </function-decl>
    <function-decl name='malloc' filepath='/usr/include/stdlib.h' line='465' column='1' visibility='default' binding='global' size-in-bits='64'>
      <parameter type-id='type-id-6'/>
      <return type-id='type-id-8'/>
    </function-decl>
    <function-decl name='free' filepath='/usr/include/stdlib.h' line='482' column='1' visibility='default' binding='global' size-in-bits='64'>
      <parameter type-id='type-id-8'/>
      <return type-id='type-id-3'/>
    </function-decl>
    <class-decl name='foo' is-struct='yes' is-artificial='yes' visibility='default' filepath='/home/dodji/tests/foolib/foolib/fooP.h' line='3' column='1' is-declaration-only='yes' id='type-id-4'/>
  </abi-instr>
</abi-corpus>

[-- Attachment #4: Type: text/plain, Size: 13 bytes --]


-- 
		Dodji

  reply	other threads:[~2020-04-09 13:52 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-05 14:38 Mark Wielaard
2020-04-06 17:15 ` Dodji Seketeli
2020-04-08 14:32   ` Mark Wielaard
2020-04-09 13:52     ` Dodji Seketeli [this message]
2020-04-12  1:44       ` Mark Wielaard
2020-04-12  1:47         ` [PATCH 1/2] Add --header-file option to add individual public header files Mark Wielaard
2020-04-12  1:47           ` [PATCH 2/2] Add --drop-private-types to abidw Mark Wielaard
2020-04-14 15:37             ` Dodji Seketeli
2020-04-14 15:19           ` [PATCH 1/2] Add --header-file option to add individual public header files Dodji Seketeli

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=86k12oojf0.fsf@seketeli.org \
    --to=dodji@seketeli.org \
    --cc=libabigail@sourceware.org \
    --cc=mark@klomp.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).