ir: Use canonical types in comparison when --enable-debug-type-canonicalization
The commit below introduced the fact that we now always use canonical
types for comparisons (when possible) in try_canonical_compare even
when there is only one type that is canonicalized.
That hasn't been done for when the code has been configured with
--enable-debug-type-canonicalization, leading to binutils failing
comparison in fc36 on aarch64 in that case.
Fixed thus.
Here is the commit I am talking about:
commit 8b3b3d89b3
Author: Dodji Seketeli <dodji@redhat.com>
Date: Fri Sep 27 12:14:23 2024 +0200
ir: Always use canonical types in comparison when possible
After staring at DWARF and ABIXML dumps for a while, I realized that
in the current (non-perfect) state of things, comparing type A and
type B can be slightly different from comparing canonical_type_of(A)
against type B, for instance. This is essentially because comparing
canonical_type_of(A) against B rather than A against B changes the
order in which the nodes of the graph of types are visited. Because
that graph has cycles, the order of visiting would essentially change
the value of the hashes that we compute during those visits.
This in turn changes the value of the comparisons depending on the
order of the comparisons.
So, to avoid those subtle changes, this patch ensures that whenever a
type has a canonical type, then it's that canonical type that is
always used in comparison. This ensures that types coming from ABIXML
(as they are all canonical types) are compared in the same order as
types coming from the ELF binaries.
This fixes the self-comparison of the infinipath-psm package from
fc36, referenced in bug https://sourceware.org/bugzilla/show_bug.cgi?id=29413.
* src/abg-ir.cc (try_canonical_compare): When
--enable-debug-type-canonicalization is activated use canonical
types for structural comparison.
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
parent
ff0180b605
commit
67519edb2c
|
@ -949,6 +949,10 @@ try_canonical_compare(const T *l, const T *r)
|
|||
if (l_hash != r_hash)
|
||||
ABG_RETURN_FALSE;
|
||||
|
||||
// If a type has a canonical type, use its canonical type, always.
|
||||
l = maybe_get_canonical_type(l);
|
||||
r = maybe_get_canonical_type(r);
|
||||
|
||||
return equals(*l, *r, 0);
|
||||
#else
|
||||
if (const type_base *lc = l->get_naked_canonical_type())
|
||||
|
|
Loading…
Reference in New Issue