This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/20515] New: "stdcall" imports are not handled correctly
- From: "sbellon at sbellon dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Mar 2005 09:19:50 -0000
- Subject: [Bug ada/20515] New: "stdcall" imports are not handled correctly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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