This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch gthr.h]: Fix PR libstdc++/52300 Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Henderson <rth at redhat dot com>
- Date: Mon, 20 Feb 2012 21:14:53 +0100
- Subject: [patch gthr.h]: Fix PR libstdc++/52300 Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
- Authentication-results: mr.google.com; spf=pass (google.com: domain of ktietz70@googlemail.com designates 10.60.22.228 as permitted sender) smtp.mail=ktietz70@googlemail.com; dkim=pass header.i=ktietz70@googlemail.com
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