Opened 5 years ago

Last modified 5 years ago

#9322 new Bugs

spinlock_gcc_arm.hpp fails when building iOS arm64

Reported by: Joe Radjavitch <joerad11@…> Owned by: Peter Dimov
Milestone: To Be Determined Component: smart_ptr
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:


I am using boost in my iOS and Android applications and building for arm64 in iOS fails in spinlock_gcc_arm because the the SWP instruction and LDREX are not part of the arm64 instruction set. I do not have enough knowledge about the ARM assembly instructions to implement a proper fix for this myself and was hopeful someone with more expertise could provide a fix for the next release (or a patch for the current, if possible).

Change History (11)

comment:1 Changed 5 years ago by viboes

Component: Nonesmart_ptr
Owner: set to Peter Dimov

comment:2 Changed 5 years ago by Peter Dimov

What compiler are you using?

comment:3 Changed 5 years ago by anonymous

Hello...I am trying to build using Xcode 5, which uses LLVM 5.0. Thanks.

comment:4 Changed 5 years ago by Peter Dimov

Does it support std::atomic?

comment:5 Changed 5 years ago by anonymous

Yes, I believe it does.

comment:6 Changed 5 years ago by Peter Dimov

I've added the ability to direct shared_ptr to use an std::atomic implementation by using #define BOOST_SP_USE_STD_ATOMIC. You can find the commit at Eventually, this implementation will be selected by default when std::atomic is autodetected to be present and functional, but for now, you can apply this patch, define the macro and see if that helps.

comment:7 Changed 5 years ago by anonymous

Running clang Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) like this:

clang++ -fvisibility=hidden" "-fvisibility-inlines-hidden" "-DBOOST_SP_USE_STD_ATOMIC" "-std=c++11" "-stdlib=libc++"

I get the following error:

In file included from ./boost/shared_ptr.hpp:17:
In file included from ./boost/smart_ptr/shared_ptr.hpp:34:
./boost/smart_ptr/detail/spinlock_pool.hpp:80:89: error: call to deleted constructor of 'std::atomic_flag' (aka 'std::__1::atomic_flag')
./boost/smart_ptr/detail/spinlock_std_atomic.hpp:81:38: note: expanded from macro 'BOOST_DETAIL_SPINLOCK_INIT'
/Applications/ note: expanded from macro 'ATOMIC_FLAG_INIT'
#define ATOMIC_FLAG_INIT {false}
/Applications/ note: function has been explicitly marked deleted here
    atomic_flag(const atomic_flag&) = delete;

comment:8 Changed 5 years ago by Peter Dimov

I get the same with clang 3.4 for Windows; looks like a clang bug, as MSVC and g++ have no problems with this code.

comment:10 Changed 5 years ago by Peter Dimov

What is the actual .cpp file that fails with the above error?

Note: See TracTickets for help on using tickets.