Have GCC uses NASM as the assembler?

Marc Glisse marc.glisse@inria.fr
Thu Dec 28 22:43:00 GMT 2017


On Thu, 28 Dec 2017, Jeffrey Walton wrote:

> We are trying to build a library on Solaris 11.3. We installed GCC 5.4
> so we have an update compiler available.

Did you follow the recommendations at 
https://gcc.gnu.org/install/specific.html#ix86-x-solaris210 ?
"It is recommended that you configure GCC to use the GNU assembler"

> g++ -g2 -O3 -fPIC -m64 -Wa,--divide -msse4.2 -msha -c sha-simd.cpp
> {standard input}: Assembler messages:
> {standard input}:166: Error: no such instruction: `sha1rnds4 $0,%xmm0,%xmm7'
> {standard input}:199: Error: no such instruction: `sha1nexte %xmm0,%xmm2'
> {standard input}:206: Error: no such instruction: `sha1msg1 %xmm0,%xmm10'
> {standard input}:212: Error: no such instruction: `sha1rnds4 $0,%xmm2,%xmm9'
> {standard input}:239: Error: no such instruction: `sha1nexte %xmm2,%xmm7'
> ...
>
> It seems the Solaris assembler cannot handle SHA extensions at this time:
>
> /usr/bin/as -V </dev/null
> as: Studio 12.5 Compiler Common 12.5 SunOS_i386 s11_3sru9_2 05/16/2016

It is better to compile a dummy program with g++ -v, it ensures that you 
get version info about the assembler that g++ actually calls.

> We would like to ask GCC to use NASM instead of 'as'.

I don't think nasm is supported, try gas instead.

> Is there a way to tell GCC to use a different assembler?

If the compiler is really different (not just a newer version with 
compatible options), you need to recompile gcc.

-- 
Marc Glisse



More information about the Gcc-help mailing list