public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/27554] New: abidw emits unreachable types and declarations
@ 2021-03-09 23:22 gprocida+abigail at google dot com
  2021-03-09 23:30 ` [Bug default/27554] " gprocida+abigail at google dot com
  2021-03-16 17:17 ` gprocida+abigail at google dot com
  0 siblings, 2 replies; 3+ messages in thread
From: gprocida+abigail at google dot com @ 2021-03-09 23:22 UTC (permalink / raw)
  To: libabigail

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

            Bug ID: 27554
           Summary: abidw emits unreachable types and declarations
           Product: libabigail
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: gprocida+abigail at google dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

A fairly common thing to do is to expose C bindings only, even if a library is
written in C++ (or some other language).

We noticed that ABI XML contains all (or at least very many) of the C++
declarations and their type dependencies found in the DWARF, even if none of
these contribute to the ABI of such a library.

For one AOSP library, a rough analysis I did suggested that of the 153358 types
emitted in the XML, only 103 of them are reachable from the exported library
symbols. Similarly, there are 15261 declarations with mangled-name attributes,
but only 66 exported symbols. There are clearly massive space savings possible.

Dodji, do you think this would be a lot of work to implement within libabigail
itself?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug default/27554] abidw emits unreachable types and declarations
  2021-03-09 23:22 [Bug default/27554] New: abidw emits unreachable types and declarations gprocida+abigail at google dot com
@ 2021-03-09 23:30 ` gprocida+abigail at google dot com
  2021-03-16 17:17 ` gprocida+abigail at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: gprocida+abigail at google dot com @ 2021-03-09 23:30 UTC (permalink / raw)
  To: libabigail

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

--- Comment #1 from Giuliano Procida <gprocida+abigail at google dot com> ---
I am currently looking (fairly casually) at achieving this kind of reachability
analysis and garbage collection with XML post-processing.

It would be instructive to do things like:

find tests -name '*.xml' -or -name '*.abi' | while read foo; do
  shrink "$foo" > shrunk
  abidiff --harmless "$foo" shrunk
done

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug default/27554] abidw emits unreachable types and declarations
  2021-03-09 23:22 [Bug default/27554] New: abidw emits unreachable types and declarations gprocida+abigail at google dot com
  2021-03-09 23:30 ` [Bug default/27554] " gprocida+abigail at google dot com
@ 2021-03-16 17:17 ` gprocida+abigail at google dot com
  1 sibling, 0 replies; 3+ messages in thread
From: gprocida+abigail at google dot com @ 2021-03-16 17:17 UTC (permalink / raw)
  To: libabigail

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

--- Comment #2 from Giuliano Procida <gprocida+abigail at google dot com> ---
I've uploaded a script that finds the "reachable" parts of an ABI.

https://sourceware.org/pipermail/libabigail/2021q1/003263.html

A reachable XML element satisfies one of the following:

* it is an ELF library dependency
* it is an ELF symbol
* it is a declaration referring to an ELF symbol
* it is a type referred to by some reachable element
* it is the naming typedef of a reachable anonymous class/struct
* it is contained in a reachable XML element
* it contains a reachable XML element

Unreachable XML elements are removed by the script as are certain empty
elements and blank lines.

The script can be run on existing tests. I did the following:

find tests -name '*.abi' -or -name '*.xml' | while read f; do
  scripts/abiprune.pl <"$f" >/tmp/pruned.xml
  orig=$(wc -c <"$f")
  pruned=$(wc -c </tmp/pruned.xml)
  bytes=$(($orig-$pruned))
  echo "$f ($bytes smaller)"
  if [ -s /tmp/pruned.xml ]; then
    abidiff --harmless "$f" /tmp/pruned.xml || echo "$f has different pruned
ABI"
  else
    echo "$f has empty pruned ABI"
  fi
done | less

If you consider unreachable types in the ABI to be a bug, then there are plenty
of existing examples here already.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-16 17:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09 23:22 [Bug default/27554] New: abidw emits unreachable types and declarations gprocida+abigail at google dot com
2021-03-09 23:30 ` [Bug default/27554] " gprocida+abigail at google dot com
2021-03-16 17:17 ` gprocida+abigail at google dot com

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).