This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR52569
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Mar 2012 10:59:38 +0100 (CET)
- Subject: [PATCH] Fix PR52569
Some targets avoid using gthr.h for some weird reason when compiling
included unwind-dw2-fde.c. But they do so violating gthrs expectations
as they neither define __GTHREAD_MUTEX_INIT nor
__GTHREAD_MUTEX_INIT_FUNCTION.
The following patch restores the carefully crafted workaround for
that to make the carefully crafted hacks work again. It also adds
a comment that hints at this.
I wonder why those targets do not simply include gthr-single.h
in their unwind-dw2 glue!? What a mess!
Compiled libgcc for x86_64-darwin10, bootstrapped on
x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2012-03-13 Richard Guenther <rguenther@suse.de>
PR target/52569
* unwind-dw2-fde.c: Make avoid-include-gthr.h hacks work again.
Index: libgcc/unwind-dw2-fde.c
===================================================================
--- libgcc/unwind-dw2-fde.c (revision 185319)
+++ libgcc/unwind-dw2-fde.c (working copy)
@@ -49,6 +49,7 @@ static struct object *seen_objects;
static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT;
#define init_object_mutex_once()
#else
+#ifdef __GTHREAD_MUTEX_INIT_FUNCTION
static __gthread_mutex_t object_mutex;
static void
@@ -63,6 +64,12 @@ init_object_mutex_once (void)
static __gthread_once_t once = __GTHREAD_ONCE_INIT;
__gthread_once (&once, init_object_mutex);
}
+#else
+/* ??? Several targets include this file with stubbing parts of gthr.h
+ and expect no locking to be done. */
+#define init_object_mutex_once()
+static __gthread_mutex_t object_mutex;
+#endif
#endif
/* Called from crtbegin.o to register the unwind info for an object. */