OSDN Git Service

PR libgcc/48076
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Nov 2012 21:11:00 +0000 (21:11 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 29 Nov 2012 21:11:00 +0000 (21:11 +0000)
        * emutls.c (__emutls_get_address): Add memory barrier before
        referencing emutls_key.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@193959 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/emutls.c

index 33a8b4f..2eb5a7e 100644 (file)
@@ -1,3 +1,9 @@
+2012-11-24  Richard Henderson  <rth@redhat.com>
+
+       PR libgcc/48076
+       * emutls.c (__emutls_get_address): Add memory barrier before
+       referencing emutls_key.
+
 2012-11-09  Eric Botcazou  <ebotcazou@adacore.com>
 
        * doc/install.texi (sparc64-x-solaris2): Mention MPC as well.
index b7ee3bd..fcf6eb5 100644 (file)
@@ -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))
     {