[PATCH 1/1] abg-writer.cc: Track types by plain address
Wed Aug 5 05:38:09 GMT 2020
Giuliano Procida <firstname.lastname@example.org> a écrit:
> The XML writer tracks the state of referenced and emitted types so it
> can emit the right types with no repetitions or omissions.
> The sets and maps are keyed using type_hasher and deep_ptr_eq_functor,
> effectively resulting in structural equality checks in some cases.
> The helper function type_is_emitted looks up types in a set but the
> corresponding record_type_as_emitted stores the canonical pointer
> where possible.
AFAIU, the look-up process of type_is_emitted uses the canonical type of
the type stored in the set. So record_type_as_emitted storing the
canonical pointer should not be a problem.
> Any discrepancy between structural and canonical equality may result
> in types being treated as emitted when there are not or vice versa,
> resulting in duplicate or omitted type ids.
There should not be a discrepancy between structural canonical equality.
If there is, then it's a bug that ought to be fixed at that level.
> Together, the result is that some types are unexpectedly conflated.
I'd like to see an example binary of that, please. If two types are
structurally equivalent, it's expected that they are treated equal, for
ABI purposes. And so, only one instance of that type is kept in the
resulting abixml, by design. I am not sure what you mean by "conflated"
would be pathological in that case. If it is, then I suspect there is
an underlying problem that ought to be fixed.
> Also, depending on the toolchain and libraries, some types are not
> emitted even when referred to elsewhere in the XML.
> * src/abg-writer.cc (writer_context): Change type_ptr_map,
> type_ptr_set_type and fn_type_ptr_set_type to use plain
> pointer equality and hashing. (type_is_emitted): Look up
> canonical type if it exists, to match record_type_as_emitted,
> get_id_for_type etc.
Doing this looks like papering over an underlying issue that would need
to be fixed. If that is possible, I'd prefer to have access to the
binary that reveals the issue so I can have a look at it.
More information about the Libabigail