ir: Use linkage name to sort virtual function members

There is some instability in the abixml output whenever two virtual
member functions have the same vtable offset and different mangling
name.  This patch takes the mangling into account.

	* src/abg-ir.cc (virtual_member_function_less_than::operator()):
	Take the linkage name into account during sorting before taking
	into account the presence of elf symbols.
	* tests/data/test-read-dwarf/test12-pr18844.so.abi: Adjust.
	* tests/data/test-read-dwarf/test9-pr18818-clang.so.abi: Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Dodji Seketeli 2024-02-27 17:56:28 +01:00
parent f17027fc74
commit bdce453d8c
3 changed files with 12 additions and 13 deletions

View File

@ -25006,6 +25006,10 @@ struct virtual_member_function_less_than
if (f_offset != s_offset) return f_offset < s_offset;
string fn, sn;
// Try the linkage names (important for destructors).
fn = f.get_linkage_name();
sn = s.get_linkage_name();
if (fn != sn) return fn < sn;
// If the functions have symbols, then compare their symbol-id
// string.
@ -25019,11 +25023,6 @@ struct virtual_member_function_less_than
if (fn != sn) return fn < sn;
}
// Try the linkage names (important for destructors).
fn = f.get_linkage_name();
sn = s.get_linkage_name();
if (fn != sn) return fn < sn;
// None of the functions have symbols or linkage names that
// distinguish them, so compare their pretty representation.
fn = f.get_pretty_representation();

View File

@ -25632,18 +25632,18 @@
<typedef-decl name='BSONElementMSet' type-id='type-id-3494' filepath='src/mongo/bson/bsonobj.h' line='53' column='1' id='type-id-3523'/>
<namespace-decl name='repl'>
<class-decl name='ScatterGatherAlgorithm' size-in-bits='64' visibility='default' filepath='src/mongo/db/repl/scatter_gather_algorithm.h' line='55' column='1' id='type-id-3475'>
<member-function access='public' vtable-offset='0'>
<function-decl name='getRequests' mangled-name='_ZNK5mongo4repl22ScatterGatherAlgorithm11getRequestsEv' filepath='src/mongo/db/repl/scatter_gather_algorithm.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
<parameter type-id='type-id-3477' is-artificial='yes'/>
<return type-id='type-id-3498'/>
</function-decl>
</member-function>
<member-function access='protected' destructor='yes' vtable-offset='0'>
<function-decl name='~ScatterGatherAlgorithm' mangled-name='_ZN5mongo4repl22ScatterGatherAlgorithmD0Ev' filepath='src/mongo/db/repl/scatter_gather_algorithm.h' line='76' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN5mongo4repl22ScatterGatherAlgorithmD2Ev'>
<parameter type-id='type-id-3478' is-artificial='yes'/>
<return type-id='type-id-2697'/>
</function-decl>
</member-function>
<member-function access='public' vtable-offset='0'>
<function-decl name='getRequests' mangled-name='_ZNK5mongo4repl22ScatterGatherAlgorithm11getRequestsEv' filepath='src/mongo/db/repl/scatter_gather_algorithm.h' line='60' column='1' visibility='default' binding='global' size-in-bits='64'>
<parameter type-id='type-id-3477' is-artificial='yes'/>
<return type-id='type-id-3498'/>
</function-decl>
</member-function>
<member-function access='public' vtable-offset='1'>
<function-decl name='processResponse' mangled-name='_ZN5mongo4repl22ScatterGatherAlgorithm15processResponseERKNS_8executor20RemoteCommandRequestERKNS_10StatusWithINS2_21RemoteCommandResponseEEE' filepath='src/mongo/db/repl/scatter_gather_algorithm.h' line='65' column='1' visibility='default' binding='global' size-in-bits='64'>
<parameter type-id='type-id-3478' is-artificial='yes'/>

View File

@ -4804,13 +4804,13 @@
</function-decl>
</member-function>
<member-function access='public' destructor='yes' vtable-offset='0'>
<function-decl name='~system_error' mangled-name='_ZN5boost6system12system_errorD2Ev' filepath='src/third_party/boost-1.56.0/boost/system/system_error.hpp' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
<function-decl name='~system_error' mangled-name='_ZN5boost6system12system_errorD0Ev' filepath='src/third_party/boost-1.56.0/boost/system/system_error.hpp' line='47' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN5boost6system12system_errorD2Ev'>
<parameter type-id='type-id-206' is-artificial='yes'/>
<return type-id='type-id-118'/>
</function-decl>
</member-function>
<member-function access='public' destructor='yes' vtable-offset='0'>
<function-decl name='~system_error' mangled-name='_ZN5boost6system12system_errorD0Ev' filepath='src/third_party/boost-1.56.0/boost/system/system_error.hpp' line='47' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='_ZN5boost6system12system_errorD2Ev'>
<function-decl name='~system_error' mangled-name='_ZN5boost6system12system_errorD2Ev' filepath='src/third_party/boost-1.56.0/boost/system/system_error.hpp' line='47' column='1' visibility='default' binding='global' size-in-bits='64'>
<parameter type-id='type-id-206' is-artificial='yes'/>
<return type-id='type-id-118'/>
</function-decl>