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.)
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.
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With