Print assembly output of a compiled file from clang

Hey guys,

I'm looking for a way to print assembly output of a file being compiled by clang. I've tried the -masm=intel and -x86-asm-syntax=intel flags. Can anyone clue me in on how to do this?

Thanks very much,


Not sure if you want anything more than -S? (eg: “clang foo.c -S” - produces “foo.s”, an assembly file)

I don’t think Clang/LLVM supports intel assembly syntax, probably only gnu/gas syntax. But perhaps someone else can confirm.

It's not piped through to Clang in a friendly way, but that's what
"-mllvm -x86-asm-syntax=intel" should do. If the question really was
about the syntax variant, Kim might have forgotten the "-mllvm"?



Oh no, turns out I was wrong and that's exactly what -masm=intel does.
My bet's now on your -S suggestion.


-S -masm=intel prints assembly in intel syntax.

Hey guys,

I tried the following at the command prompt:

F:\Clanggit\build\32\debug\bin>clang++ source.cpp -v -S -masm=intel

I’m expecting this to output the assembly for my compiled source.cpp translation unit but I don’t get anything. Any ideas?


Hi Kim,