[cfe-users] clang and intel syntax assembly
Fish Wang via cfe-users
cfe-users at lists.llvm.org
Wed Jun 22 22:31:45 PDT 2016
Hi,
I'm trying to make clang assemble an assembly file that clang generates, and
some weird issues happen. Here are steps to reproduce it.
- Here is the C code I was using:
#include <stdio.h>
char str[] = "HELLO WORLD";
int main() {
printf("%s\n", str);
}
- 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 think clang should always accept the assembly file it generates. Is this a
bug? What workaround can be applied to make clang happy with the
instruction?
Thanks!
Best,
Fish
More information about the cfe-users
mailing list