Bug 21263 - Provide finer redundant type detection from DWARF
Summary: Provide finer redundant type detection from DWARF
Status: RESOLVED FIXED
Alias: None
Product: libabigail
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 enhancement
Target Milestone: ---
Assignee: Dodji Seketeli
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-17 13:49 UTC by Dodji Seketeli
Modified: 2017-07-18 11:15 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dodji Seketeli 2017-03-17 13:49:55 UTC
When analyzing C binaries, the redundant type detector only looks at the kind of the type, its name and its location.

That is, if a struct named foo and defined at file blah.c, line 5 column 1 is seen twice, the second occurrence of that type is considered to be a duplicate of the first one.  So the internal representation of the first occurrence of the type is re-used instead of constructing an internal representation for the second type as well.

But then, it can happen that the first struct foo defined in file blah.c:5:1 is *different* (has a different layout, size or whatever) from the second occurrence of foo defined at the *same* location.

In that case, today, libabigail wrongly drops the second occurrence.

The goal of this enhancement request is to improve the redundant type detector to make it actually compare the DIEs of the two "struct foo", to see if they are equal.

The redundant type detector would still index those types using their name and kind.  But it would associate the name of the type to a vector of types having the same name.
Comment 1 Dodji Seketeli 2017-03-31 13:34:51 UTC
I think we'd even need to code a comparison engine that can compare a DIE with an ABI artefact living in the abigail::ir namespace.
Comment 2 Dodji Seketeli 2017-06-01 15:00:04 UTC
So I have implemented a fix for this in the dodji/kabidiff branch in commit https://sourceware.org/git/gitweb.cgi?p=libabigail.git;a=commit;h=f88ecac536024c6b70a605f0c1e0cc662a26914e.

So, here, to detect that two type DIEs of the same name and kind are different, there are compared structurally (member-wise and recursively).

So we wrote an additional comparison-engine that operates in DIEs directly and de-duplicates them before creating and IR for them.

This is hopefully going to be merged into master soon.
Comment 3 Dodji Seketeli 2017-07-18 11:15:27 UTC
This has been merged into master at https://sourceware.org/git/gitweb.cgi?p=libabigail.git;a=commit;h=b555713b4792f7892b9e03a51c9059a5e1f9fdd2