cinvoke-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cinvoke-dev] i686-pc-mingw32-gcc calling convention


From: Dwight Schauer
Subject: [cinvoke-dev] i686-pc-mingw32-gcc calling convention
Date: Sat, 15 Jan 2011 09:08:48 -0600

I added tool prefix functional to configure.pl and the Makefile
templates so that I can cross compile from Linux.

https://bitbucket.org/bogen/cinvoke/changeset/2e5f387b77aa
https://bitbucket.org/bogen/cinvoke/downloads (tag 1.03c)

I also made the following two fixes:

https://bitbucket.org/bogen/cinvoke/changeset/8cc4a9f17c34 Eliminated
printf error for windows (I64 vs ll)
https://bitbucket.org/bogen/cinvoke/changeset/1c1d36f6a300 Eliminated
assembly warning on call indirection

The issue I have is this:

./configure.pl --tool-prefix=i686-pc-mingw32-
Using platform 'X86_WIN'
...

Ok, that is fine.

However, the macro output from gcc_x86_win.h:

---< start clip >---
#define ARCH_CALL(regparms, ep) \
        __asm__("mov %0, %%ecx; \
                        mov %1, %%edx; \
                        call *%2" : \
                        : \
                                "m"((regparms).first), \
                                "m"((regparms).second), \
                 "m"(ep));
---< end clip >---

cl_x86_win.h appears to be the same, just a different assembler syntax.

---< start clip >---
#define ARCH_CALL(regparms, ep) \
        __asm mov ecx, [(regparms).first] \
        __asm mov edx, [(regparms).second] \
        __asm call dword ptr [ep]
---< end clip >---


Neither don't seem to match the calling convention that
i686-pc-mingw32-gcc is laying down:

---< start clip >--- // snippets from cinvoke.s
        .loc 1 41 0
        movl    8(%ebp), %eax
        movl    4(%eax), %eax
        movl    %eax, (%esp)
        call    _arch_free_errstr
L2:
...
        .loc 1 50 0
        movl    $0, 12(%esp)
        movl    $LC0, 8(%esp)
        movl    $0, 4(%esp)
        movl    8(%ebp), %eax
        movl    %eax, (%esp)
        call    _context_set_error
        .loc 1 51 0
...
        .loc 1 54 0
        movl    $12, (%esp)
        call    _malloc
        movl    %eax, -12(%ebp)
---
        .loc 1 66 0
        movl    8(%ebp), %eax
        movl    %eax, (%esp)
        call    _free
        .loc 1 67 0
---< end clip >---

I'm assuming I'll need to make another arch .h/.c file to match that
calling calling convention, as i686-pc-mingw32-gcc is what I'm using
to target 32 bit windows.

i686-pc-mingw32-gcc --version
i686-pc-mingw32-gcc (GCC) 4.5.2

i686-pc-mingw32-gcc -dumpmachine
i686-pc-mingw32

I'm using http://www.gtk.org/download-windows.html and my cross
compiled programs that link against glib/gtk/etc do work.

Any thoughts or comments concerning this?

--DAS



reply via email to

[Prev in Thread] Current Thread [Next in Thread]