Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use custom assembler for clang?

I've compiled clang to use it as a cross compiler for ARM (by configuring it with ./configure --target=armv7l-unknown-linux-gnueabihf ), but when I try to compile any C code, it tries to use /usr/bin/as. I already have binutils compiled for ARM, and they are in a separate directory. How do I direct clang (or llvm) to use the assembler that I specify?

like image 374
JosephH Avatar asked Dec 24 '12 22:12

JosephH


People also ask

Which assembler does Clang use?

Assembler. Clang can either use LLVM's integrated assembler or an external system-specific tool (for instance, the GNU Assembler on GNU OSes) to produce machine code from assembly. By default, Clang uses LLVM's integrated assembler on all targets where it is supported.

Does LLVM generate assembly?

The llc command compiles LLVM source inputs into assembly language for a specified architecture. The assembly language output can then be passed through a native assembler and linker to generate a native executable.

Is Clang better than GCC?

Clang is much faster and uses far less memory than GCC. Clang aims to provide extremely clear and concise diagnostics (error and warning messages), and includes support for expressive diagnostics. GCC's warnings are sometimes acceptable, but are often confusing and it does not support expressive diagnostics.


1 Answers

try passing the --host option to configure which will cause all the cc ar etc utilities to prefix with armv7l-unknown-linux-gnueabihf- eg:

./configure --host=armv7l-unknown-linux-gnueabihf --build=i686-unknown-linux-gnu 

Since you are using configure with hopefully autotools take a look at: automake Cross compiling

like image 198
Kieran Avatar answered Nov 08 '22 09:11

Kieran