[cfe-users] clang and intel syntax assembly

Fish Wang via cfe-users cfe-users at lists.llvm.org
Wed Sep 21 00:27:02 PDT 2016


Hi Jeffrey,

Thank you very much for your timely response. Unfortunately, I don't think your answer is helpful for my issue in any way. I believe the behavior that I described in the previous email is a legit bug in Clang, or rather, in llvm-as.

For future reference, we ended up (reluctantly) converting all Intel syntax assembly files to AT&T style, and fed AT&T style assemblies to Clang. Involving an extra conversion and having ugly AT&T style output was sub-optimal, but it worked, and worked well.

Best,
Fish

-----Original Message-----
From: Jeffrey Walton [mailto:noloader at gmail.com] 
Sent: Tuesday, September 20, 2016 9:53 PM
To: Fish Wang <fish.thss at gmail.com>
Cc: CFE-Users (Clang) <cfe-users at lists.llvm.org>; Aravind Machiry <machiry at cs.ucsb.edu>
Subject: Re: [cfe-users] clang and intel syntax assembly

> - 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",
https://llvm.org/bugs/show_bug.cgi?id=24232.

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).

Jeff




More information about the cfe-users mailing list