[fpc-devel] Same 64bit assembly code compiles under windows but not in linux (fpc 260)

Jonas Maebe jonas.maebe at elis.ugent.be
Wed Oct 3 12:01:59 CEST 2012

On 03 Oct 2012, at 03:29, luiz americo pereira camara wrote:

> I'm porting some Delphi assembly code.
> It worked fine with fpc 2.6.0 i386-64bit windows compiler
> When i tried the same code with fpc 2.6.0 i386-64bit for linux it  
> failed to
> compile with the following error:
> Error: Asm: 16 or 32 Bit references not supported
> at the line
>         // Load XMM5 with the bias value.
>        MOVD        XMM5, [Bias]  //Bias = Integer
> Is it a know issue or a limitation of linux version?

Win64 uses a different calling convention compared to every other  
x86-64 operating system (Microsoft probably started working on it  
before the x86-64 ABI was finalized). One of the differences is that  
only passes the first three integer parameters in registers, while  
other operating systems pass the first six integer parameters in  
registers. This means that on Win64, the above translates into

   movd xmm5, [rpb + some_offset]

while on other platforms, it translates into

   movd xmm5, [r8d]

So you are creating a reference with r8d as base register, which is  
invalid (because it's a 32 bit register)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20121003/30171cdf/attachment.html>

More information about the fpc-devel mailing list