This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch gthr.h]: Fix PR libstdc++/52300 Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.


Hi,

this patch fixes for mingw target gthread-linking issues about
weak-symbols.  The issue is that pe-coff's weak support is partial
present, but it isn't fully compatible to ELF-version.  For static
libraries it works in this case equivalent, but for shared (DLL)
version it doesn't.  Therefore it makes sense to disable in gthread
the use of WEAK.
This patch fixes libstdc++ and OpenMP issues we recognized using
POSIX-threading API.

ChangeLog libgcc/

2012-02-20  Kai Tietz  <ktietz@redhat.com>

        PR libstdc++/52300
       * gthr.h (GTHREAD_USE_WEAK): Define as zero for mingw.

Tested for i686-w64-mingw32, x86_64-w64-mingw32, and regression-tested
for x86_64-unkown-linux-gnu.  Ok for apply?

Regards,
Kai

Index: gthr.h
===================================================================
--- gthr.h      (revision 184333)
+++ gthr.h      (working copy)
@@ -135,6 +135,14 @@
 */

 #if SUPPORTS_WEAK
+/* The pe-coff weak support isn't fully compatible to ELF's weak.
+   For static libraries it might would work, but as we need to deal
+   with shared versions too, we disable it for mingw-targets.  */
+#ifdef __MINGW32__
+#undef GTHREAD_USE_WEAK
+#define GTHREAD_USE_WEAK 0
+#endif
+
 #ifndef GTHREAD_USE_WEAK
 #define GTHREAD_USE_WEAK 1
 #endif


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]