https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63781
Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #12 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- (In reply to howarth from comment #10) > So the compiler will emit the ___cxa_tm_cleanup to resolve the undefined > symbol in libitm? Maybe I should be more explicit: ___cxa_tm_cleanup comes from libstdc++. It is not an undefined reference, but a weak one. 1. If you compile/link C code with libitm, ___cxa_tm_cleanup is guaranteed not to be called. Because it's a weak reference, it doesn't matter that it wouldn't be found. No problem. 2. If you compile/link C++ code with libitm, the g++ driver will link in libstdc++. So, when ___cxa_tm_cleanup gets called from libitm, the weak reference will correctly call the symbol from libstdc++. No problem. Given that Iain validates my analysis, let's close this one.