public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/20515] New: "stdcall" imports are not handled correctly
@ 2005-03-17  9:20 sbellon at sbellon dot de
  2005-03-17  9:58 ` [Bug ada/20515] " charlet at adacore dot com
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: sbellon at sbellon dot de @ 2005-03-17  9:20 UTC (permalink / raw)
  To: gcc-bugs

When using a GCC cross-compiler from GNU/Linux to Windows with Ada support, the
link names of pragma Import with Convention "stdcall" are not mangled correctly
and thus linking to the Windows API does not work.

A small example is:

bellonsn@pscube$ cat time.adb
with Ada.Calendar;
procedure Time is
   T : Ada.Calendar.Time;
begin
   T := Ada.Calendar.Clock;
end Time;
bellonsn@pscube$ i586-mingw32msvc-gnatmake -f time
i586-mingw32msvc-gcc -c time.adb
i586-mingw32msvc-gnatbind -x time.ali
i586-mingw32msvc-gnatlink time.ali
Warning: resolving _Sleep by linking to _Sleep@4
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
/usr/lib/gcc/i586-mingw32msvc/3.4.2/adalib/libgnat.a(s-osprim.o): In function `s
ystem__os_primitives__clock':
/tmp/bellonsn-mingw32/mingw32-3.4.2.20040916.1/build_dir/objs/gcc/ada/rts/s-ospr
im.adb:147: undefined reference to `_QueryPerformanceCounter'
/tmp/bellonsn-mingw32/mingw32-3.4.2.20040916.1/build_dir/objs/gcc/ada/rts/s-ospr
im.adb:151: undefined reference to `_GetSystemTimeAsFileTime'
... and so on ...

Danny Smith of MinGW suggested a small patch which works for me:

--- gcc-3.4.2-20040916-1/gcc/ada/decl.c 2005-03-17 07:11:51.208188883 +0100
+++ gcc-3.4.2-20040916-1/gcc/ada/decl.c.patched 2005-03-17 07:11:40.675851093 +0100
@@ -3509,7 +3509,7 @@
        if (list_length (gnu_return_list) == 1)
          gnu_return_type = TREE_TYPE (TREE_PURPOSE (gnu_return_list));

-#ifdef _WIN32
+#if TARGET_IS_PE_COFF
        if (Convention (gnat_entity) == Convention_Stdcall)
          {
            struct attrib *attr

I hope you can apply this patch.

-- 
           Summary: "stdcall" imports are not handled correctly
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sbellon at sbellon dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20515


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2005-06-27 18:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-17  9:20 [Bug ada/20515] New: "stdcall" imports are not handled correctly sbellon at sbellon dot de
2005-03-17  9:58 ` [Bug ada/20515] " charlet at adacore dot com
2005-03-18  3:30 ` dannysmith at users dot sourceforge dot net
2005-03-18  4:23 ` dannysmith at users dot sourceforge dot net
2005-03-19 13:08 ` p dot obry at wanadoo dot fr
2005-03-19 14:52 ` p dot obry at wanadoo dot fr
2005-03-19 20:54 ` dannysmith at users dot sourceforge dot net
2005-04-06 18:14 ` p dot obry at wanadoo dot fr
2005-04-07  8:29 ` dannysmith at users dot sourceforge dot net
2005-06-16  8:57 ` cvs-commit at gcc dot gnu dot org
2005-06-16  9:11 ` charlet at gcc dot gnu dot org
2005-06-25 12:20 ` dannysmith at users dot sourceforge dot net
2005-06-27 18:50 ` p dot obry at wanadoo dot fr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).