]> granicus.if.org Git - libatomic_ops/commitdiff
Fix 'atomic_load/store symbols undefined' error on OS X 10.8 i386
authorIvan Maidanski <ivmai@mail.ru>
Thu, 12 Jan 2017 20:36:18 +0000 (23:36 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Thu, 12 Jan 2017 20:49:04 +0000 (23:49 +0300)
Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__]: Include AvailabilityMacros.h
unless MAC_OS_X_VERSION_MIN_REQUIRED already defined.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__
&& MAC_OS_X_VERSION_MIN_REQUIRED < 1090] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define.

src/atomic_ops/sysdeps/gcc/x86.h

index 8d268b6d87318f635b2cedc608551130d3973149..90b64bc7341d5719eb7d68df2faac2f2b2f39fe7 100644 (file)
 #   define AO_GCC_FORCE_HAVE_CAS
 # endif
 
+# if !defined(__x86_64__) && defined(__APPLE__) && defined(__MACH__)
+    /* OS X 10.8 lacks __atomic_load/store symbols for arch i386 (even  */
+    /* with non-Apple clang).                                           */
+#   ifndef MAC_OS_X_VERSION_MIN_REQUIRED
+      /* Include this header just to import the version macro.  */
+#     include <AvailabilityMacros.h>
+#   endif
+#   if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 /* MAC_OS_X_VERSION_10_9 */
+#     define AO_SKIPATOMIC_double_load
+#     define AO_SKIPATOMIC_double_load_acquire
+#     define AO_SKIPATOMIC_double_store
+#     define AO_SKIPATOMIC_double_store_release
+#   endif
+# endif
+
 #else /* AO_DISABLE_GCC_ATOMICS */
 
 /* The following really assume we have a 486 or better.  Unfortunately  */