[committed 1/2] libstdc++: Fix multiple definitions of std::exception_ptr functions [PR 97729]

Jonathan Wakely jwakely@redhat.com
Mon Nov 9 14:31:05 GMT 2020


On 05/11/20 18:03 +0000, Jonathan Wakely wrote:
>This fixes some multiple definition errors caused by the changes for
>PR libstdc++/90295. The previous solution for inlining the members of
>std::exception_ptr but still exporting them from the library was to
>suppress the 'inline' keyword on those functions when compiling
>libsupc++/eh_ptr.cc, so they get defined in that file. That produces ODR
>violations though, because there are now both inline and non-inline
>definitions in the library, due to the use of std::exception_ptr in
>other files sucg as src/c++11/future.cc.
>
>The new solution is to define all the relevant members as 'inline'
>unconditionally, but use __attribute__((used)) to cause definitions to
>be emitted in libsupc++/eh_ptr.cc as before. This doesn't quite work
>however, because PR c++/67453 means the attribute is ignored on
>constructors and destructors. As a workaround, the old solution
>(conditionally inline) is still used for those members, but they are
>given the always_inline attribute so that they aren't emitted in
>src/c++11/future.o as inline definitions.

That workaround can be removed now.

Tested powerpc64le-linux. Committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 1853 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201109/b3248678/attachment.bin>


More information about the Gcc-patches mailing list