diff options
| author | Ivan Maidanski <ivmai@mail.ru> | 2016-11-24 20:13:06 +0300 |
|---|---|---|
| committer | Ivan Maidanski <ivmai@mail.ru> | 2016-11-24 20:13:06 +0300 |
| commit | 637f7fe16e11118f33e23abd63469229d6df6e08 (patch) | |
| tree | e944a050413d455a0032a1b2c6fd4ddfc449ac91 /src/atomic_ops | |
| parent | f82a19e191b4515f04b3e57b9bab3e73e4c02ca7 (diff) | |
| download | libatomic_ops-637f7fe16e11118f33e23abd63469229d6df6e08.tar.gz | |
Workaround a bug in double-wide intrinsics of Clang/x64 with ASan enabled
As of clang-3.8, double-wide arguments are incorrectly passed to
atomic intrinsic operations for x64 target if Address Sanitizer is
enabled.
* src/atomic_ops.h [__has_feature(address_sanitizer)]
(AO_ADDRESS_SANITIZER): New internal macro.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && __x86_64__ && !__ILP32__]
(AO_SKIPATOMIC_double_compare_and_swap_ANY, AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define also if AO_ADDRESS_SANITIZER;
update comment.
Diffstat (limited to 'src/atomic_ops')
| -rw-r--r-- | src/atomic_ops/sysdeps/gcc/x86.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/atomic_ops/sysdeps/gcc/x86.h b/src/atomic_ops/sysdeps/gcc/x86.h index 166e353..ded34ac 100644 --- a/src/atomic_ops/sysdeps/gcc/x86.h +++ b/src/atomic_ops/sysdeps/gcc/x86.h @@ -25,11 +25,15 @@ /* TODO: Refine for newer clang releases. */ # if defined(__clang__) \ - && !(defined(__x86_64__) || defined(__APPLE_CC__) \ - || defined(__CYGWIN__) || defined(AO_PREFER_BUILTIN_ATOMICS)) + && (!(defined(__x86_64__) || defined(__APPLE_CC__) \ + || defined(__CYGWIN__) || defined(AO_PREFER_BUILTIN_ATOMICS)) \ + || (defined(AO_ADDRESS_SANITIZER) && defined(__x86_64__) \ + && !defined(__ILP32__))) /* As of clang-3.8 i686 (NDK r11c), it requires -latomic for all */ /* the double-wide operations. For now, we fall back to the */ /* non-intrinsic implementation by default. */ + /* As of clang-3.8, double-wide arguments are incorrectly passed to */ + /* atomic intrinsic operations for x64 target if ASan is enabled. */ # define AO_SKIPATOMIC_double_compare_and_swap_ANY # define AO_SKIPATOMIC_double_load # define AO_SKIPATOMIC_double_load_acquire |
