Boost logo

Boost :

From: Schrader, Glenn (gschrad_at_[hidden])
Date: 2008-04-04 08:35:31


> -----Original Message-----
> From: boost-bounces_at_[hidden] [mailto:boost-bounces_at_[hidden]]
> On Behalf Of Peter Dimov
> Sent: Thursday, April 03, 2008 1:42 PM
> To: boost_at_[hidden]
> Subject: Re: [boost] ARM platform: undefined reference to
> __sync_fetch_and_add_4
>
> Rob Desbois wrote:
> > I cannot link against Boost libraries 1.35.0 built with CodeSourcery's
> > ARM/GNU toolchain, although the build is successful.
> ...
>
> > undefined reference to `__sync_fetch_and_add_4'
> > collect2: ld returned 1 exit status
> >
> > With assistance on the boost-build list I've ascertained that the
> > problem is that GCC doesn't support __sync_fetch_and_add and the other
> > atomic built-ins on ARM.
> > An additional case for this may need to be added to
> > boost/detail/sp_counted_base.hpp
> >
> > I don't know enough to patch boost for this, short-term or otherwise;
> > can anyone offer any advice?
>
> Two workarounds are available: define BOOST_SP_DISABLE_THREADS to disable
> MT-safety for the reference count, or define BOOST_SP_USE_PTHREADS to use
> a
> pthread_mutex.
>
Another option would be to just supply the __sync_fetch_and_add_4 function that gcc is trying to link in. When gcc doesn't support the builtin it assumes that a function exists with that name. A snippet of ARM assembly to implement the atomic operation shouldn't be that difficult.


Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk