Both `memory_resource` and `monotonic_buffer_resource` have all virtual methods inline, so their vtables (and rtti) are not pinned to libstdc++.so, but are duplicated in each executable (.so or application), causing minor executable code bloat and false negative dynamic_casts. Expected: At least their dtor should be out-of-line, so the vtable and the type_info object are emitted in libstdc++.so, and only there.
Also in 9.1, according to gotbolt.org. Making the dtors out-of-line should be a binary-compatible.
(In reply to Marc Mutz from comment #0) > false negative dynamic_casts. That shouldn't happen on sane platforms. (In reply to Marc Mutz from comment #1) > Also in 9.1, according to gotbolt.org. Making the dtors out-of-line should > be a binary-compatible. We've already bumped the library version to libstdc++.so.6.0.26 for the GCC 9.3 release, so we could add another symbol to it now. That could cause problems for distros already shipping 9.2.1 snapshots though. It would be safer to only change it on trunk.
(In reply to Jonathan Wakely from comment #2) > We've already bumped the library version to libstdc++.so.6.0.26 Typo! That should be libstdc++.so.6.0.27
Author: redi Date: Thu Jan 9 13:18:20 2020 New Revision: 280044 URL: https://gcc.gnu.org/viewcvs?rev=280044&root=gcc&view=rev Log: libstdc++: Define memory resource key functions non-inline (PR93208) This prevents the vtables and RTTI from being emitted in every object file that uses memory_resource and monotonic_buffer_resource. Objects compiled by GCC 9.1 or 9.2 will contain inline definitions of the destructors, vtable and RTTI, but this is harmless. The inline definitions have identical effects to the ones that are now defined in libstdc++.so so it doesn't matter if the inline ones are used instead of calling the symbols exported from the runtime library. PR libstdc++/93208 * config/abi/pre/gnu.ver: Add new exports. * include/std/memory_resource (memory_resource::~memory_resource()): Do not define inline. (monotonic_buffer_resource::~monotonic_buffer_resource()): Likewise. * src/c++17/memory_resource.cc (memory_resource::~memory_resource()): Define. (monotonic_buffer_resource::~monotonic_buffer_resource()): Define. * testsuite/20_util/monotonic_buffer_resource/93208.cc: New test. Added: trunk/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/93208.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/config/abi/pre/gnu.ver trunk/libstdc++-v3/include/std/memory_resource trunk/libstdc++-v3/src/c++17/memory_resource.cc
Author: redi Date: Thu Jan 9 13:18:37 2020 New Revision: 280045 URL: https://gcc.gnu.org/viewcvs?rev=280045&root=gcc&view=rev Log: libstdc++: Define memory resource key functions non-inline (PR93208) This prevents the vtables and RTTI from being emitted in every object file that uses memory_resource and monotonic_buffer_resource. Objects compiled by GCC 9.1 or 9.2 will contain inline definitions of the destructors, vtable and RTTI, but this is harmless. The inline definitions have identical effects to the ones that are now defined in libstdc++.so so it doesn't matter if the inline ones are used instead of calling the symbols exported from the runtime library. PR libstdc++/93208 * config/abi/pre/gnu.ver: Add new exports. * include/std/memory_resource (memory_resource::~memory_resource()): Do not define inline. (monotonic_buffer_resource::~monotonic_buffer_resource()): Likewise. * src/c++17/memory_resource.cc (memory_resource::~memory_resource()): Define. (monotonic_buffer_resource::~monotonic_buffer_resource()): Define. * testsuite/20_util/monotonic_buffer_resource/93208.cc: New test. Added: branches/gcc-9-branch/libstdc++-v3/testsuite/20_util/monotonic_buffer_resource/93208.cc Modified: branches/gcc-9-branch/libstdc++-v3/ChangeLog branches/gcc-9-branch/libstdc++-v3/config/abi/pre/gnu.ver branches/gcc-9-branch/libstdc++-v3/include/std/memory_resource branches/gcc-9-branch/libstdc++-v3/src/c++17/memory_resource.cc
Fixed for 9.3
Thanks!