[cfe-dev] Target-Triple changes in assembly; Who is wrong?

via cfe-dev cfe-dev at lists.llvm.org
Mon Feb 12 22:32:03 PST 2018


Hello Clang-People,

I try to understand the system behind the target triple of clang - but I 
don't get it. I used clang to compile the same code with two different 
targets:
--target=x86_64-pc-windows-msvc and --target=x86_64-pc-windows-elf.

I let the dragon compile my code and wished for assembly output. The 
dragon did fine but the output confused me.

When I looked into the functions I discovered strange difference. For 
example:
msvc target generated:
movq    %rdx, %rax

but in elf the same line is:
movq    %rcx, %rax

Why is there (and in other places) such difference? The target is still 
windows, but the elf code is breaking the windows __thiscall calling 
convention. I expected that both output are compatible to windows.

Is the dragon wrong, or is it me?

Kind regards
Björn

Als GmbH eingetragen im Handelsregister Bad Homburg v.d.H. HRB 9816, 
USt.ID-Nr. DE 114 165 789
Geschäftsführer: Dr. Hiroshi Nakamura, Dr. Robert Plank, Markus Bode, 
Heiko Lampert, Hiroshi Kawamura, Takashi Nagano, Takeshi Fukushima.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180213/a9ff0187/attachment.html>


More information about the cfe-dev mailing list