public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "gprocida+abigail at google dot com" <sourceware-bugzilla@sourceware.org>
To: libabigail@sourceware.org
Subject: [Bug default/26591] detect pathologically redundant types in abixml
Date: Tue, 06 Apr 2021 20:56:07 +0000	[thread overview]
Message-ID: <bug-26591-9487-Wv5HssUKOB@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-26591-9487@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=26591

--- Comment #8 from Giuliano Procida <gprocida+abigail at google dot com> ---
I am trying to tackle one source of duplicate type ids: write_decl_in_scope.

The current behaviour likely reflects an implicit design choice, one which I
would like some clarification on. Consider the case of code like this:

= test.h =
struct N {
 struct A {
  struct B {
   typedef int C;
   ...
  };
  ...
 };
 ...
};

= foo.cc =
N::A::B::C foo;

= bar.cc =
N::A::B bar;

The variable foo has a type which doesn't depend on the "...", but B depends on
the first "..." but not the later ones.

If foo were the only symbol, we would could choose to omit the other bits of
the types. (I'm not sure if libabigail does this.)

If bar were the only symbol, we should emit B's definition in full, but could
chose to omit the rest of A. (libabigail actually omits C, but it could be like
that in the DWARF.)

If both foo and bar are processed in that order, it would be good not to
duplicate the definition of C. libabigail currently does duplicate this.
There's no duplication if bar precedes foo.

I see two ways forward:

1. Somehow work out that an enclosing type definition will be emitted anyway
(so just emit that instead, now or later). I can see this being a bit tricky
with multiply-nested types. However, there is probably some existing logic
there already (compare ABIs from g++ -Wall -Wextra -g -shared foo.cc bar.cc -o
test.o and g++ -Wall -Wextra -g -shared bar.cc foo.cc -o test.o).

2. Always emit the outermost enclosing types, now, and not later. This will
make some ABI files larger but should stop there being multiple definitions of
types like C. In the case of the foo, bar example, this would mean additionally
exposing the last "..." in the ABI, even if it's not directly reachable from
the symbols.

I have a tentative patch that does 2. I'll post it for review soon.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-04-06 20:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-09 15:18 [Bug default/26591] New: " dodji at redhat dot com
2020-09-09 15:18 ` [Bug default/26591] " dodji at redhat dot com
2020-09-10 13:56 ` dodji at redhat dot com
2021-03-02 15:31 ` gprocida+abigail at google dot com
2021-03-05 16:58 ` gprocida+abigail at google dot com
2021-03-05 17:09 ` gprocida+abigail at google dot com
2021-03-05 17:15 ` gprocida+abigail at google dot com
2021-03-20 10:32 ` gprocida+abigail at google dot com
2021-03-31 16:40 ` gprocida+abigail at google dot com
2021-04-06 20:56 ` gprocida+abigail at google dot com [this message]
2021-04-06 21:24 ` gprocida+abigail at google dot com
2021-08-12 22:09 ` gprocida at google dot com
2021-12-01 10:19 ` maennich at android dot com
2021-12-03  9:38 ` mark at klomp dot org
2021-12-03 10:25 ` gprocida at google dot com
2022-07-08 11:13 ` gprocida at google dot com

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=bug-26591-9487-Wv5HssUKOB@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=libabigail@sourceware.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).