Boost logo

Boost :

Subject: Re: [boost] ARM thumb support in spinlock_gcc_arm.hpp
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2008-09-05 16:45:06


Jerry Napoli wrote:
> I'm trying to compile using boost 1_36_0 for ARMv6 Thumb for iPhone
> development. The compiler used is gcc 4.0.x supplied with the iphone sdk.
>
> I run into issues with the inline assembly inside
> boost/detail/spinlock_gcc_arm.hpp. It generates a SWP instruction which
> (AFAIK) is not supported in thumb mode.

I haven't checked, but I can believe that.

> The gnu arm assembler gives me
> a 'bad instruction ...' error. I'm able to work around it by modifying
> spinlock.hpp to include spinlock_sp.hpp instead.

That is probably the simplest approach if you are not doing anything
that makes significant use of locking.

Do you know what macros spinlock.hpp should test to determine ARM vs.
Thumb mode? There is some magic rune that makes gcc dump all of the
pre-defined macros; maybe you could do that and grep for something thumb-related.

Otherwise, I think you need to get it to compile that function in
non-thumb mode and ensure that all of the callers are in "interworking"
mode. I have no idea how that copes with inlining though. It would
not be good to break inlining on non-thumb platforms.

Another thought: does whatever processor you have in the iphone have
the new compare-and-swap instructions?

Regards, Phil.


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