[cfe-dev] Issues compiling crypto++ inline assembly

Alan Birtles via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 12 06:22:32 PDT 2018


I'm having issues compiling crypto++'s inline assembly with recent  
builds of clang (from my experiments 5.0.0 onwards). The code in  
question is the 32-bit version of  
https://github.com/weidai11/cryptopp/blob/master/sha.cpp#L1005 which  
is failing on line 1005 with the error "error: invalid operand for  
instruction".

I've bolied this code down to:

void test()
{
    __asm__ __volatile__
    (
    ".intel_syntax;\n"
    "0:\n"
    "jnz 0b;\n"
    );
}

This compiles with GCC and clang 4.0.1 but fails with 5.0.0 and 6.0.0  
https://godbolt.org/g/ikFCrk
Changing to AT&T syntax makes it build. Changing the jump to "0f"  
compiles (but obviously generates a jump to nowhere).

Any ideas how to solve this issue or is it a bug in clang's intel  
syntax support?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180412/3ea697ab/attachment.html>


More information about the cfe-dev mailing list