public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [4.6] Fix PR libgcc/48076
@ 2012-11-29 21:21 Richard Henderson
  0 siblings, 0 replies; only message in thread
From: Richard Henderson @ 2012-11-29 21:21 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 90 bytes --]

A different fix is required for 4.6, because the __atomic
functions don't exist yet.


r~

[-- Attachment #2: z --]
[-- Type: text/plain, Size: 569 bytes --]

        PR libgcc/48076
        * emutls.c (__emutls_get_address): Add memory barrier before
        referencing emutls_key.


diff --git a/gcc/emutls.c b/gcc/emutls.c
index b7ee3bd..fcf6eb5 100644
--- a/gcc/emutls.c
+++ b/gcc/emutls.c
@@ -151,6 +151,9 @@ __emutls_get_address (struct __emutls_object *obj)
       __gthread_mutex_unlock (&emutls_mutex);
     }
 
+  /* Do not allow emutls_key to be loaded before offset.  */
+  __sync_synchronize();
+
   struct __emutls_array *arr = __gthread_getspecific (emutls_key);
   if (__builtin_expect (arr == NULL, 0))
     {

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-29 21:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-29 21:21 [4.6] Fix PR libgcc/48076 Richard Henderson

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).