<div dir="ltr">The assembly support in LLVM is all oriented around gas-compatibility. We have some support for Intel syntax assembly, but even in that area, we can only parse gas style directives.</div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Sun, Aug 10, 2014 at 6:46 AM, Thiago Farina <span dir="ltr"><<a href="mailto:tfransosi@gmail.com" target="_blank">tfransosi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="">On Sun, Aug 10, 2014 at 9:21 AM, Anton Korobeynikov<br>
<<a href="mailto:anton@korobeynikov.info">anton@korobeynikov.info</a>> wrote:<br>
>> How can I change the syntax used by clang, so yasm accepts it without<br>
>> having to pass -p gas?<br>
> No way. yasm uses nasm syntax by default.<br>
><br>
</div>So the solution seems to be use 'as'.<br>
<br>
This worked for me:<br>
<br>
$ clang -S -O0 -masm=intel add.c -o add-intel.s<br>
$ cat add-intel.s<br>
.globl add<br>
add:<br>
push rbp<br>
mov rbp, rsp<br>
mov dword ptr [rbp - 4], edi<br>
mov dword ptr [rbp - 8], esi<br>
mov esi, dword ptr [rbp - 4]<br>
add esi, dword ptr [rbp - 8]<br>
mov eax, esi<br>
pop rbp<br>
ret<br>
<br>
$ as -mnaked-reg -msyntax=intel add-intel.s -o add_def.o<br>
<br>
Simpler, this also worked:<br>
<br>
$ clang -S -O0 add.c -o add-att.s<br>
$ cat add-att.s<br>
<div class="">.globl add<br>
add:<br>
pushq %rbp<br>
movq %rsp, %rbp<br>
movl %edi, -4(%rbp)<br>
movl %esi, -8(%rbp)<br>
movl -4(%rbp), %esi<br>
addl -8(%rbp), %esi<br>
movl %esi, %eax<br>
popq %rbp<br>
retq<br>
</div>$ as add-att.s -o add_def.o<br>
<br>
--<br>
Thiago<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>