As this question shows, with g++, I can do g++ -S -masm=intel test.cpp
. Also, with clang, I can do clang++ -S test.cpp
, but -masm=intel
is not supported by clang (warning argument unused during compilation: -masm=intel
). How do I get intel syntax with clang?
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.
Supported choices are intel or att (the default one).
g++ command is a GNU c++ compiler invocation command, which is used for preprocessing, compilation, assembly and linking of source code to generate an executable file.
In general, Clang is highly compatible with the GCC inline assembly extensions, allowing the same set of constraints, modifiers and operands as GCC inline assembly.
As noted below by @thakis, newer versions of Clang (3.5+) accept the -masm=intel
argument.
For older versions, this should get clang to emit assembly code with Intel syntax:
clang++ -S -mllvm --x86-asm-syntax=intel test.cpp
You can use -mllvm <arg>
to pass in llvm options from the clang command line. Sadly this option doesn't appear to be well documented, and thus I only found it by browsing through the llvm mailing lists.
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