/* TLS emulation.
- Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 2006-2014 Free Software Foundation, Inc.
Contributed by Jakub Jelinek <jakub@redhat.com>.
This file is part of GCC.
#include "tsystem.h"
#include "coretypes.h"
#include "tm.h"
+#include "libgcc_tm.h"
#include "gthr.h"
typedef unsigned int word __attribute__((mode(word)));
#ifndef __GTHREADS
abort ();
#else
- pointer offset = obj->loc.offset;
+ pointer offset = __atomic_load_n (&obj->loc.offset, __ATOMIC_ACQUIRE);
if (__builtin_expect (offset == 0, 0))
{
if (offset == 0)
{
offset = ++emutls_size;
- obj->loc.offset = offset;
+ __atomic_store_n (&obj->loc.offset, offset, __ATOMIC_RELEASE);
}
__gthread_mutex_unlock (&emutls_mutex);
}