AMD64 ABI compatibility
Nicolas Alt
nalt@apple.com
Mon Jul 9 20:19:00 GMT 2007
Thanks for your reply. The gcc compiler uses %rdi, %rsi, %rdx, %rcx
with -mregparm=4, but MS uses %rcx, %rdx, %r8, %r9, so that won't be
enough. Also MS requires some space on the stack to be reserved for
the 4 regs.
Someone has written a wrapper:
http://people.freebsd.org/~wpaul/winx64_wrap.S
On Jul 9, 2007, at 12:58 , Dave Korn wrote:
> On 09 July 2007 20:48, Nicolas Alt wrote:
>
>> Hi!
>>
>> On the AMD64 / x86-64Bit architecture, some arguments of a functions
>> are passed using registers, but there seem to be two different
>> conventions out there. The standard ABI uses 6 registers, but
>> Microsoft compilers use only 4. Because of that, code compiled with
>> gcc cannot call code compiled with a MS compiler without an ugly
>> wrapper.
>>
>> Have there been any efforts to make gcc do function calls the MS way?
>> I guess this would be an important feature for mingw on AMD64.
>
>
> Does -mregparm=4 do what you want?
>
>
> cheers,
> DaveK
> --
> Can't think of a witty .sigline today....
>
More information about the Gcc
mailing list