public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
@ 2012-02-17 20:26 i.nixman at gmail dot com
  2012-02-19 17:14 ` [Bug libstdc++/52300] " ktietz at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: i.nixman at gmail dot com @ 2012-02-17 20:26 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

             Bug #: 52300
           Summary: Gthreads functions linking error at dynamic linking
                    with libstdc++ when using MinGW.
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: i.nixman@gmail.com


When using std::threads for example, the program is compiled correctly. But
when running I get segfolts. If the program is linked with -static - all the
problem disappears.

If in the file gthr-posix.h I change this line:
> # If SUPPORTS_WEAK && GTHREAD_USE_WEAK
on this:
> # If SUPPORTS_WEAK && GTHREAD_USE_WEAK && !defined(__MINGW32__)
- the problem is solved.

Is there any way to fix this?

niXman.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/52300] Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
  2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
@ 2012-02-19 17:14 ` ktietz at gcc dot gnu.org
  2012-02-19 17:20 ` i.nixman at gmail dot com
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-02-19 17:14 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-02-19
                 CC|                            |ktietz at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #1 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-19 17:12:13 UTC ---
As pe-coff doesn't have fully compatible support for weaks to ELF ones, we
should disable it.  In static version it works, but when used in shared variant
it doesn't.

I suggest the following patch to solve this problem:

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/52300] Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
  2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
  2012-02-19 17:14 ` [Bug libstdc++/52300] " ktietz at gcc dot gnu.org
@ 2012-02-19 17:20 ` i.nixman at gmail dot com
  2012-02-20 21:29 ` ktietz at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: i.nixman at gmail dot com @ 2012-02-19 17:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

--- Comment #2 from niXman <i.nixman at gmail dot com> 2012-02-19 17:14:03 UTC ---
Thanks Kai!


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/52300] Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
  2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
  2012-02-19 17:14 ` [Bug libstdc++/52300] " ktietz at gcc dot gnu.org
  2012-02-19 17:20 ` i.nixman at gmail dot com
@ 2012-02-20 21:29 ` ktietz at gcc dot gnu.org
  2012-02-20 21:30 ` ktietz at gcc dot gnu.org
  2012-02-20 21:40 ` ktietz at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-02-20 21:29 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

--- Comment #3 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-20 21:22:11 UTC ---
Author: ktietz
Date: Mon Feb 20 21:22:07 2012
New Revision: 184406

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184406
Log:
       PR libstdc++/52300
       * gthr.h (GTHREAD_USE_WEAK): Define as zero for mingw.

Modified:
    trunk/libgcc/ChangeLog
    trunk/libgcc/gthr.h


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/52300] Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
  2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
                   ` (2 preceding siblings ...)
  2012-02-20 21:29 ` ktietz at gcc dot gnu.org
@ 2012-02-20 21:30 ` ktietz at gcc dot gnu.org
  2012-02-20 21:40 ` ktietz at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-02-20 21:30 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

--- Comment #4 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-20 21:28:41 UTC ---
Author: ktietz
Date: Mon Feb 20 21:28:36 2012
New Revision: 184408

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=184408
Log:
        PR libstdc++/52300
        * gthr.h (GTHREAD_USE_WEAK): Define as zero for mingw.

Modified:
    branches/gcc-4_6-branch/gcc/ChangeLog
    branches/gcc-4_6-branch/gcc/gthr.h


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug libstdc++/52300] Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW.
  2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
                   ` (3 preceding siblings ...)
  2012-02-20 21:30 ` ktietz at gcc dot gnu.org
@ 2012-02-20 21:40 ` ktietz at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ktietz at gcc dot gnu.org @ 2012-02-20 21:40 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52300

Kai Tietz <ktietz at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #5 from Kai Tietz <ktietz at gcc dot gnu.org> 2012-02-20 21:29:21 UTC ---
Fixed.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-02-20 21:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-17 20:26 [Bug libstdc++/52300] New: Gthreads functions linking error at dynamic linking with libstdc++ when using MinGW i.nixman at gmail dot com
2012-02-19 17:14 ` [Bug libstdc++/52300] " ktietz at gcc dot gnu.org
2012-02-19 17:20 ` i.nixman at gmail dot com
2012-02-20 21:29 ` ktietz at gcc dot gnu.org
2012-02-20 21:30 ` ktietz at gcc dot gnu.org
2012-02-20 21:40 ` ktietz at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).