summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDave Watson <davejwatson@fb.com>2019-04-03 08:55:28 -0700
committerGitHub <noreply@github.com>2019-04-03 08:55:28 -0700
commitf2931b349c1d00f8539fc989d32f8ff270e4f7a0 (patch)
tree40b4327dbe27d197aeef262405b99394a568dd61 /include
parent334047a04e59287463348a9e333947b5e59ddd91 (diff)
downloadlibunwind-f2931b349c1d00f8539fc989d32f8ff270e4f7a0.tar.gz
Tsan (#109)
x86_64: tsan clean
Diffstat (limited to 'include')
-rw-r--r--include/libunwind_i.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/libunwind_i.h b/include/libunwind_i.h
index 36cf7a14..e0f45401 100644
--- a/include/libunwind_i.h
+++ b/include/libunwind_i.h
@@ -140,6 +140,7 @@ cmpxchg_ptr (void *addr, void *old, void *new)
}
# define fetch_and_add1(_ptr) AO_fetch_and_add1(_ptr)
# define fetch_and_add(_ptr, value) AO_fetch_and_add(_ptr, value)
+# define atomic_read(ptr) (AO_load(ptr))
/* GCC 3.2.0 on HP-UX crashes on cmpxchg_ptr() */
# if !(defined(__hpux) && __GNUC__ == 3 && __GNUC_MINOR__ == 2)
# define HAVE_CMPXCHG
@@ -164,10 +165,14 @@ cmpxchg_ptr (void *addr, void *old, void *new)
}
# define fetch_and_add1(_ptr) __sync_fetch_and_add(_ptr, 1)
# define fetch_and_add(_ptr, value) __sync_fetch_and_add(_ptr, value)
+# define atomic_read(ptr) (__atomic_load_n(ptr,__ATOMIC_RELAXED))
# define HAVE_CMPXCHG
# define HAVE_FETCH_AND_ADD
#endif
+
+#ifndef atomic_read
#define atomic_read(ptr) (*(ptr))
+#endif
#define UNWI_OBJ(fn) UNW_PASTE(UNW_PREFIX,UNW_PASTE(I,fn))
#define UNWI_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_UI,UNW_TARGET),_), fn)