Date: Tue, 12 Oct 2021 08:56:05 +0000 From: bugzilla-noreply@freebsd.org To: toolchain@FreeBSD.org Subject: [Bug 236344] [toolchain] gcc-built shared library crashes in static object constructors when dynamically loaded Message-ID: <bug-236344-29464-xGrB8xagBi@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-236344-29464@https.bugs.freebsd.org/bugzilla/> References: <bug-236344-29464@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236344 David Chisnall <theraven@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |theraven@FreeBSD.org --- Comment #9 from David Chisnall <theraven@FreeBSD.org> --- >From the stack trace, it looks as if this is linking both from the base sys= tem libcxxrt.so and libstdc++.so from the gcc8 port. The version of libstdc++.= so from the base system was modified to link libcxxrt.so but I believe the versions from ports embed libsupc++.a. Both libcxxrt and libsupc++ define = the same symbols and so you end up with a mixture of them being called. In particular, you're mixing part of the `dynamic_cast` implementation from libsupc++ (frame #1) with part from libcxxrt (frame #0). This is very unli= kely to work. The correct fix for this would be to make the GCC ports link libstdc++.so against libcxxrt.so instead of building libsupc++.a, but that probably requ= ires some invasive changes to the build system. In general, mixing code linked against libc++ and libstdc++ is unlikely to work. There are three ways of fixing this: - Teach the libstdc++ build to use libcxxrt - Teach gcc to support -stdlib=3Dlibc++ - Use something like `-nostdinc++ -nodefaultlibs -isystem <install>/include/c++/v1 -lc++ -lcxxrt -lm -lc -lgcc_s -lgcc` when compi= ling / linking C++ things with gcc. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236344-29464-xGrB8xagBi>