https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116159
--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:2003f890b13b8ec35b6112fc13c7e69e61cd9162 commit r14-10663-g2003f890b13b8ec35b6112fc13c7e69e61cd9162 Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue Sep 10 14:36:26 2024 +0100 libstdc++: Only use std::ios_base_library_init() for ELF [PR116159] The undefined std::ios_base_library_init() symbol that is referenced by <iostream> is only supposed to be used for targets where symbol versioning is supported. The mingw-w64 target defaults to --enable-symvers=gnu due to using GNU ld but doesn't actually support symbol versioning. This means it tries to emit references to the std::ios_base_library_init() symbol, which isn't really defined in the library. This causes problems when using lld to link user binaries. Disable the undefined symbol reference for non-ELF targets. libstdc++-v3/ChangeLog: PR libstdc++/116159 * include/std/iostream (ios_base_library_init): Only define for ELF targets. * src/c++98/ios_init.cc (ios_base_library_init): Likewise. (cherry picked from commit fc7a1fb0238e379d466316aa219734ac61f4bc0e)