Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to switch off LLVM's integrated assembler?

I have a project involving hand-written assembly—AT&T syntax, works fine with GCC, but not done by me plus I know very little about assembly—which exhibits a weird problem when trying to build it with Clang.

LLVM documentation mentions that "most X86 targets" use LLVM's integrated assembler as opposed to the system assembler; as a possible workaround I would like to explicitly use the latter. I (well, Google) haven't been successful in finding information on how to do this.

Question: Is there a way to ask or rather force Clang / LLVM to use the system assembler instead of the integrated one?

(I know I could always go and Read The Source™, but I want to know whether there's a documented approach.)

like image 888
hermannloose Avatar asked Jun 20 '12 11:06

hermannloose


People also ask

What is LLVM assembly code?

LLVM is an SSA based representation that provides type safety, low-level operations, flexibility, and the capability of representing 'all' high-level languages cleanly. It is the common code representation used throughout all phases of the LLVM compilation strategy. Introduction.

Which assembler does Clang use?

By default, Clang uses LLVM's integrated assembler on all targets where it is supported. If you wish to use the system assembler instead, use the -fno-integrated-as option.

Does GCC use LLVM?

The difference is that GCC supports a number of programming languages while LLVM isn't a compiler for any given language. LLVM is a framework to generate object code from any kind of source code. While LLVM and GCC both support a wide variety languages and libraries, they are licensed and developed differently.


1 Answers

Turns out I completely missed this in the man page:

-integrated-as -no-integrated-as

Used to enable and disable, respectively, the use of the integrated assembler. Whether the integrated assembler is on by default is target dependent.

To disable it at compiler invocation:

clang -no-integrated-as -c foo.c

Or:

export CC="clang -no-integrated-as"
make
like image 84
hermannloose Avatar answered Sep 19 '22 00:09

hermannloose