Boost logo

Boost :

From: Glenn Schrader (gschrad_at_[hidden])
Date: 2006-12-19 05:39:18

I have a strange build error when compiling for sparc solaris. In
particular there are errors of the form:

error: cannot use v8plus instructions in a non-v8plus target binary

After a bit of digging the error is coming from the compare_and_swap
function in boost/detail/sp_counted_base_gcc_sparc.hpp This function has
some inline assembly that uses the "cas" (compare and swap) opcode. The
sparc assembler is effectively complaining that the instruction isn't
supported. If I manually hack the Makefile to give
-sBUILD='<instruction-set>v9' to bjam then everything compiles properly.
I think that boost/detail/sp_counted_base.hpp has a problem in the lines

    #elif defined(__GNUC__) && ( defined( __sparcv8 ) || defined(
__sparcv9 ) )

    # include <boost/detail/sp_counted_base_gcc_sparc.hpp>

The cas instruction is supported on the sparc v8plus and v9. Support for
just sparc v8 is inadequate. In that case you need to use the swap
instruction and some looping to do something similar to a cas. Another
wrinkle is that just removing the defined(__sparcv8) from the above
condition doesn't quite do the right thing with gcc. From what I can
tell gcc is setting __sparcv8 even if -mcpu=v9 is specified. I have a v9
processor but I'm running 32 bit solaris so could gcc be basing the
__sparcv8/v9 defines on the OS rather than the cpu type? The biggest
difference between the v8 and v9 cpus is 64bit support.



Boost list run by bdawes at, gregod at, cpdaniel at, john at