Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to choose the assembler GCC uses?

Tags:

gcc

assembly

Is there an option to GCC that changes the path of the assembler it uses? I'm getting errors from Solaris /usr/ccs/bin/as when using GCC to attempt to compile Haskell, but I've got a copy of GNU as in my path so when I type which as and as --version they use the GNU version, not the Solaris version. Unfortunately it seems GCC ignores the GNU version in the path and goes to the Solaris version. I'm trying to build Haskell on Solaris and I don't think it sits well with the Solaris assembler. I hope I can change this behaviour with a simple wrapper script so I don't have to recompile GCC.

like image 934
Clinton Avatar asked Jan 22 '13 08:01

Clinton


1 Answers

Specifying the assembler to be used is not possible at run time. It has to be done when configuring gcc:

--with-gnu-as

Specify that the compiler should assume that the assembler it finds is the GNU assembler. However, this does not modify the rules to find an assembler and will result in confusion if the assembler found is not actually the GNU assembler. (Confusion may also result if the compiler finds the GNU assembler but has not been configured with --with-gnu-as.)

Note the part I've put in italics. Of course you could temporarily change /usr/ccs/bin/as to call the gnu assembler (provided you have the necessary permissions), but the above seems to suggest that you'll very likely run into problems. The gcc build process actually checks the features the assembler supports and generates code for exactly that assembler.

I suggest you build a new version of gcc first (configured to use the gnu tools), and then use that to build ghc.

like image 70
Chris Avatar answered Sep 19 '22 14:09

Chris