[cfe-users] clang and intel syntax assembly

Jeffrey Walton via cfe-users cfe-users at lists.llvm.org
Tue Sep 20 21:52:45 PDT 2016

> - Compile the code using clang with the following command. An assembly
> manifest hello.s will be generated
> clang -m32 -S -masm=intel hello.c -O1
> - Assemble the asm file using clang:
> clang -m32 -mllvm --x86-asm-syntax=intel hello.s
> It fails with the following error output:
> hello.s:10:2: error: invalid operand for instruction
>         mov     dword ptr [esp], str
>         ^

I don't know if its your problem, but be careful of using Intel
syntax. You should prefer AT&T syntax. Also see "Inline assembly
operands don't work with .intel_syntax",

We try to support Clang in a cross-platform library. On Windows we had
to break the compile and error with "Unsupported configuration"
because we have thousands of lines of Intel assembly meant to be
consumed by MS tools (or compatible tools). Clang would be fine if it
stopped pretending to be other compilers and took the code paths
written for it (on Windows Clang defines _MSC_VER and it wanders into
MS code paths).


More information about the cfe-users mailing list