Skip to content
Browse files

[ios] fix deprecated swp{b} spew for arm6+

  • Loading branch information...
1 parent 84efcf8 commit d9b5260e01de75c4966c9e80b69cfc4e0cdc7126 @davilla davilla committed Apr 28, 2012
View
2 tools/darwin/depends/boost/Makefile
@@ -19,6 +19,8 @@ $(TARBALLS_LOCATION)/$(ARCHIVE):
sed -e "s?@boost_flags@?$(boost_flags)?g" \
-e "s?@platform_gcc_version@?$(platform_gcc_version)?g" \
user-config.jam.in >> $(SOURCE)/tools/build/v2/user-config.jam
+ cd $(SOURCE); patch -p1 < ../add-arm-mem-barrier.patch
+ cd $(SOURCE); patch -p1 < ../fix-deprecated-swp.patch
cd $(SOURCE); ./bootstrap.sh --prefix=$(PREFIX) --with-libraries=thread,date_time
cd $(SOURCE); ./bjam --prefix=$(PREFIX) $(bjam_args) install
# boost builds .so instead of .dylib for iphone, fix it.
View
73 tools/darwin/depends/boost/add-arm-mem-barrier.patch
@@ -0,0 +1,73 @@
+From c87ad09331d239d6566e5eb409898ae38f04799a Mon Sep 17 00:00:00 2001
+From: Peter Dimov <pdimov@boostpro.com>
+Date: Mon, 7 Nov 2011 17:50:31 +0000
+Subject: [PATCH] Add ARM memory barriers. Refs #5372.
+
+SVN-Revision: 75389
+---
+ boost/smart_ptr/detail/spinlock_gcc_arm.hpp | 23 ++++++++++++++++++++---
+ 1 file changed, 20 insertions(+), 3 deletions(-)
+
+diff --git a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+index ba6c511..f58ea44 100644
+--- a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
++++ b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+@@ -2,7 +2,7 @@
+ #define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
+
+ //
+-// Copyright (c) 2008 Peter Dimov
++// Copyright (c) 2008, 2011 Peter Dimov
+ //
+ // Distributed under the Boost Software License, Version 1.0.
+ // See accompanying file LICENSE_1_0.txt or copy at
+@@ -11,6 +11,20 @@
+
+ #include <boost/smart_ptr/detail/yield_k.hpp>
+
++#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)
++
++# define BOOST_SP_ARM_BARRIER "dmb"
++
++#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__)
++
++# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5"
++
++#else
++
++# define BOOST_SP_ARM_BARRIER ""
++
++#endif
++
+ namespace boost
+ {
+
+@@ -30,7 +44,8 @@ class spinlock
+ int r;
+
+ __asm__ __volatile__(
+- "swp %0, %1, [%2]":
++ "swp %0, %1, [%2]\n\t"
++ BOOST_SP_ARM_BARRIER :
+ "=&r"( r ): // outputs
+ "r"( 1 ), "r"( &v_ ): // inputs
+ "memory", "cc" );
+@@ -48,7 +63,7 @@ class spinlock
+
+ void unlock()
+ {
+- __asm__ __volatile__( "" ::: "memory" );
++ __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" );
+ *const_cast< int volatile* >( &v_ ) = 0;
+ }
+
+@@ -82,4 +97,6 @@ class spinlock
+
+ #define BOOST_DETAIL_SPINLOCK_INIT {0}
+
++#undef BOOST_SP_ARM_BARRIER
++
+ #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
+--
+1.7.10
+
View
58 tools/darwin/depends/boost/fix-deprecated-swp.patch
@@ -0,0 +1,58 @@
+From 8d1ba081260f98d879759433a9d7248d6bd98966 Mon Sep 17 00:00:00 2001
+From: Peter Dimov <pdimov@boostpro.com>
+Date: Mon, 12 Mar 2012 17:31:21 +0000
+Subject: [PATCH] Apply patch from #5331. Refs #5331.
+
+SVN-Revision: 77315
+---
+ boost/smart_ptr/detail/spinlock_gcc_arm.hpp | 29 +++++++++++++++++++++++++--
+ 1 file changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+index f58ea44..f1bbaf6 100644
+--- a/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
++++ b/boost/smart_ptr/detail/spinlock_gcc_arm.hpp
+@@ -43,13 +43,38 @@ class spinlock
+ {
+ int r;
+
++#if defined(__ARM_ARCH_6__) \
++ || defined(__ARM_ARCH_6J__) \
++ || defined(__ARM_ARCH_6K__) \
++ || defined(__ARM_ARCH_6Z__) \
++ || defined(__ARM_ARCH_6ZK__) \
++ || defined(__ARM_ARCH_6T2__) \
++ || defined(__ARM_ARCH_7__) \
++ || defined(__ARM_ARCH_7A__) \
++ || defined(__ARM_ARCH_7R__) \
++ || defined(__ARM_ARCH_7M__) \
++ || defined(__ARM_ARCH_7EM__)
++
++ __asm__ __volatile__(
++ "ldrex %0, [%2]; \n"
++ "cmp %0, %1; \n"
++ "strexne %0, %1, [%2]; \n"
++ BOOST_SP_ARM_BARRIER :
++ "=&r"( r ): // outputs
++ "r"( 1 ), "r"( &v_ ): // inputs
++ "memory", "cc" );
++
++#else
++
+ __asm__ __volatile__(
+- "swp %0, %1, [%2]\n\t"
+- BOOST_SP_ARM_BARRIER :
++ "swp %0, %1, [%2];\n"
++ BOOST_SP_ARM_BARRIER :
+ "=&r"( r ): // outputs
+ "r"( 1 ), "r"( &v_ ): // inputs
+ "memory", "cc" );
+
++#endif
++
+ return r == 0;
+ }
+
+--
+1.7.10
+

0 comments on commit d9b5260

Please sign in to comment.
Something went wrong with that request. Please try again.