> From: Kuba Ober <kuba(a)mareimbrium.org>
>
> I'm currently hacking on gcc for an embedded target (Z8
> Encore), but I wouldn't mind giving it a try while I'm
> digging in the gcc tree.
Cool!
> I'd like to hear any suggestions as to how to tell the
> compiler to use that calling convention (I'm not talking
> about implementation, just how the compiler used would tell it).
>
> I presume it'd need to be something that can be set globally
> per each compiler invocation, as well as a per declaration override.
>
> I'm thinking of "-msvc" (like -liberty ;) compiler option to
> force a MSVC-compatible ABI, and for now that'd only apply to
> 64 bit code (i.e. with -m64). Maybe in the future it could
> enable something special for 32 bit code as well.
>
> I'm all ears about the per-declaration override (a pragma? an
> __attribute__?), and about alternatives to -msvc.
__attribute__ seems most logical to me. Perhaps __attribute__(__msvccall__)
(in the __attribute__(__stdcall__) tradition? An alternative to -msvc could
perhaps be -mrtd ("Alternate calling convention"). For i386 builds of gcc,
-mrtd makes stdcall the default calling convention. It is currently a noop
for x86_64. I kind of like your -msvc though :-)
For Wine the compiler option seems more important then the override.
> I'd be submitting a patch to mingw32 people as soon as it's
> done, in addition to posting it here. Note that the only way
> for me to test it would be to inspect the assembly output, as
> I'm not running 64 bit environment here (even though I'm on a
> 64 bit AMD processor). So it'd need testing from 64 bit
> people here at least.
I'm volunteering. I could also give you ssh access to a 64 bit environment.
Ge van Geldorp.