LLVM fails for inline asm with Link Time Optimization

Hi ,
I am trying to enable link time optimization for my projects. Few of them has inline assembly which works perfectly with clang/llvm but on enabling LTO I get following error

LLVM ERROR: Error parsing inline asm

:103:2 : error 0: unknown use of instruction mnemonic without a size suffix

:104:16 : error 0: invalid operand for instruction

:106:17 : error 0: unexpected token in argument list

& so on

Is this a known issue ? Any workaround for this ?

Thanks
Ashish

My experience is that LTO doesn't break inline assembly.

Thanks for response Francois . Do you have any pointers on what can be the issue here or something I can try out. I saw similar active bug in llvm database

https://llvm.org/bugs/show_bug.cgi?id=5623

Thanks
Ashish

If you are getting a parse error it is very likely a different bug. In
that bug the issue is that we don't parse the function bodies to find
if some inline in them defines (or uses) a given symbol.

Ah , I thought that there is issue while parsing inline asm in function bodies , here are some of instruction where it cribs . Can you make out something of it ?

I am going to try out -no-integrated-as option . Not sure if it will help ?

LLVM ERROR: Error parsing inline asm

1>:1:17 : error 0: unexpected token in argument list

1> mov ebx, dword ptr 16(%esp)

1> ^

1>:2:17 : error 0: unexpected token in argument list

1> mov edi, dword ptr 24(%esp)

1> ^

1>:3:17 : error 0: unexpected token in argument list

1> mov esi, dword ptr 28(%esp)

1> ^

1>:4:21 : error 0: invalid token in expression

1> movq mm1, [edi+ebx-$8]

1> ^

1>:5:12 : error 0: invalid operand for instruction

1> pxor mm0, mm0

Thanks

Ashish

At which stage is this failing? Can you provide an example and commands?

Looks like the information about the use of intel syntax is being
dropped along the way.

It is failing at link time . Examples are what I have given above. There is an compiler option -mllvm --x86-asm-syntax=intel. Is there something similar for linker which I can provide via -plugin-opt ?

Even when I am passing -mllvm --x86-asm-syntax=intel to clang++.exe the assembly is generated in AT&T syntax. When can this happen ?