https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78968
--- Comment #11 from Kostik Belousov <kostikbel at ukr dot net> --- (In reply to Jonathan Wakely from comment #10) > (In reply to Kostik Belousov from comment #9) > > Would older gcc releases fine if FreeBSD exports __cxa_thread_atexit_impl as > > an alias for __cxa_thread_atexit ? > > I think there would still be a duplicate definition of __cxa_thread_atexit > in that case. Yes, but the definitions will be runtime-identical. I mean that the benefit would be that not patched gcc configure will detect presence of __cxa_thread_atexit_impl and libsupc++ only provide trivial wrapper. This means that both implementations use compatible runtime. I am still somewhat puzzled by the 'duplicate definitions' linker diagnostic. It should be satisfied by whatever implementation it finds first. In the op case, somehow a whole static library is linked in, and we do not even know is it libc or libstdc++. > > > Note that there were no FreeBSD release > > which provided __cxa_thread_atexit, although the symbol is already present > > on the stable/11 branch and cannot be removed due ABI compat guarantees. It > > is used by libc++ already, I believe. > > Is that a local change in FreeBSD's copy of libc++? Because there's no > reference to it in the upstream libc++ repo. No, there is no change in libc++. Compiler generated references to __cxa_thread_atexit() are satisfied by libc directly. This was what asked for by the LLVM dev. > > > Request for __cxa_thread_atexit came directly from one of the LLVM > > developers, at least this is how I see the history. > > I understand the desire to have __cxa_thread_atexit available. The point is > that it belongs in the C++ runtime, and that at least two implementations of > the C++ runtime (libsupc++ and libcxxabi) already do the same thing, > defining __cxa_thread_atexit unconditionally, but making use of > __cxa_thread_atexit_impl if libc provides that. BTW, it was not unnatural to provide __cxa_thread_atexit() from libc, given the precedent of __cxa_atexit(3).