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

_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to