Boost logo

Boost :

Subject: Re: [boost] Boost trunk on Solaris 10 sparc
From: Peter Dimov (pdimov_at_[hidden])
Date: 2012-03-05 08:59:47


Maciej (Matchek) Bliziński wrote:
> 2012/3/1 Maciej (Matchek) Bliziński <maciej_at_[hidden]>
> > /var/tmp//ccU7e2QF.s: Assembler messages:
> > /var/tmp//ccU7e2QF.s:401: Error: Architecture mismatch on "cas".
> > /var/tmp//ccU7e2QF.s:401: (Requires v9|v9a|v9b; requested architecture
> > is v8.)
>
> It sounds like there's assembler code which requires the v9
> architecture, while v9 is 64-bit. To build 32-bit binaries, I need to
> build for the v8 (or v8+) architecture.

This comes from shared_ptr, boost/smart_ptr/detail/sp_counted_base.hpp, line
59:

#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 )
&& ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) )
# include <boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp>

The problem here is that basically all Sparcs currently in existence support
the V9 instruction set, but the GCC architecture macros denote an ABI and
not an instruction set, and the V9 ABI is 64 bit. When you compile
with -mcpu=v9 -m32, which enables the CAS instruction but still compiles for
32 bit and the V8 ABI, __sparcv8 is set. So there's no way to determine, on
the basis of the predefined macros, whether shared_ptr should use CAS or
not.

The reason that the above line checks for GCC 4.2 or later is that 4.2+
should automatically build for the V9 ISA by default. However, it's possible
that gcc.jam overrides this for some reason, as it contains, at line 1135:

# Sparc
cpu-flags gcc OPTIONS : sparc : c3 : -mcpu=c3 : default ;
cpu-flags gcc OPTIONS : sparc : v7 : -mcpu=v7 ;
cpu-flags gcc OPTIONS : sparc : cypress : -mcpu=cypress ;
cpu-flags gcc OPTIONS : sparc : v8 : -mcpu=v8 ;
cpu-flags gcc OPTIONS : sparc : supersparc : -mcpu=supersparc ;
cpu-flags gcc OPTIONS : sparc : sparclite : -mcpu=sparclite ;
cpu-flags gcc OPTIONS : sparc : hypersparc : -mcpu=hypersparc ;
cpu-flags gcc OPTIONS : sparc : sparclite86x : -mcpu=sparclite86x ;
cpu-flags gcc OPTIONS : sparc : f930 : -mcpu=f930 ;
cpu-flags gcc OPTIONS : sparc : f934 : -mcpu=f934 ;
cpu-flags gcc OPTIONS : sparc : sparclet : -mcpu=sparclet ;
cpu-flags gcc OPTIONS : sparc : tsc701 : -mcpu=tsc701 ;
cpu-flags gcc OPTIONS : sparc : v9 : -mcpu=v9 ;
cpu-flags gcc OPTIONS : sparc : ultrasparc : -mcpu=ultrasparc ;
cpu-flags gcc OPTIONS : sparc : ultrasparc3 : -mcpu=ultrasparc3 ;

I have no idea what -mcpu=c3 does here, or why is it set as default. The
default should be v9. c3 is the VIA C3, a x86 CPU.

It's also possible that you've requested v8 explicitly, with
instruction-set=v8. Change that to v9, if so. address-model=32 should still
produce 32 bit binaries. Or, if you for some reason don't want to use V9
instructions, #define BOOST_SP_USE_PTHREADS.


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