[patch][pr12684] Use the new mingw abi

NAKAMURA Takumi geek4civic at gmail.com
Tue Nov 19 16:39:19 PST 2013


Rafael,

Oh yeah, ... It seems C++ ABI diverged between Cygwin and Mingw since 4.7...
(FYI, also cygwin64 is different from x86_64-mingw32 in some point...)

For example;
class Foo {
 public:
  int Method(int a, int b, int c);
};

int xxx(Foo *p, int a, int b, int c) {
  return p->Method(a, b, c);
}

; i686-pc-mingw32-g++-4.7.3 (on cygwin)
__Z3xxxP3Fooiii:
LFB0:
        .cfi_startproc
        subl    $28, %esp
        .cfi_def_cfa_offset 32
        movl    44(%esp), %eax
        movl    32(%esp), %ecx
        movl    %eax, 8(%esp)
        movl    40(%esp), %eax
        movl    %eax, 4(%esp)
        movl    36(%esp), %eax
        movl    %eax, (%esp)
        call    __ZN3Foo6MethodEiii
        .cfi_def_cfa_offset 20
        subl    $12, %esp
        .cfi_def_cfa_offset 32
        addl    $28, %esp
        .cfi_def_cfa_offset 4
        ret
        .cfi_endproc

; Cygwin's g++-4.7.3
__Z3xxxP3Fooiii:
LFB0:
        .cfi_startproc
        jmp     __ZN3Foo6MethodEiii
        .cfi_endproc

2013/11/20 Rafael EspĂ­ndola <rafael.espindola at gmail.com>:
> Now that 3.4 branched and we will soon require gcc 4.7 to build, it
> probably makes more sense to use the new gcc 4.7 abi on mingw.
>
> The difference is documented is
> http://gcc.gnu.org/gcc-4.7/changes.html. GCC now uses thiscall by
> default for methods. This also has the benefit of helping shake down
> bugs since this is also true in the win32 abi.
>
> Cheers,
> Rafael




More information about the cfe-commits mailing list