public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration
@ 2007-04-24 9:54 tobivollebregt at gmail dot com
2007-04-24 10:01 ` [Bug c/31680] " tobivollebregt at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: tobivollebregt at gmail dot com @ 2007-04-24 9:54 UTC (permalink / raw)
To: gcc-bugs
Take the following C test code. I want to make a DLL which exports stdcall
HelloWorld function.
test.c:
__attribute__((dllexport)) void __attribute__((__stdcall__)) HelloWorld()
{
}
Compiling & linking it gives the following error during linking with GCC 4.3.0,
while it works fine with GCC 3.4.5.
$ i586-mingw32msvc-gcc -c -o test.o test.c
$ i586-mingw32msvc-gcc -shared -o test.dll test.o
Cannot export HelloWorld: symbol not found
collect2: ld returned 1 exit status
Examining the object file seems to reveal the problem, especially when compared
to the GCC 3.4.5 mingw crosscompiler which is in Debian.
GCC 4.3.0:
$ i586-mingw32msvc-nm test.o | grep HelloWorld
00000000 T _HelloWorld@0
$ strings test.o | grep HelloWorld
-export:HelloWorld
_HelloWorld@0
GCC 3.4.5:
$ i586-mingw32msvc-nm test.o | grep HelloWorld
00000000 T _HelloWorld@0
$ strings test.o | grep HelloWorld
-export:HelloWorld@0
_HelloWorld@0
Notice the subtle difference in output of the last command. Between 3.4.5 and
4.3.0 the @0 stdcall decoration in the -export:HelloWorld@0 line got lost,
which makes it impossible to link DLLs with exported stdcall functions.
Here are some details about the compiler versions used for testing:
$ i586-mingw32msvc-gcc-4.3.0 -v
Using built-in specs.
Target: i586-mingw32msvc
Configured with: ../gcc/configure --prefix=/opt/mingw --target=i586-mingw32msvc
--enable-languages=c --disable-multilib --disable-shared --enable-threads=win32
--enable-version-specific-runtime-libs --enable-sjlj-exceptions :
(reconfigured) ../gcc/configure --prefix=/opt/mingw --target=i586-mingw32msvc
--enable-languages=c,c++ --disable-multilib --disable-shared
--enable-threads=win32 --enable-version-specific-runtime-libs
--enable-sjlj-exceptions
Thread model: win32
gcc version 4.3.0 20070424 (experimental)
$ i586-mingw32msvc-gcc-3.4.5 -v
Reading specs from /usr/lib/gcc/i586-mingw32msvc/3.4.5/specs
Configured with:
/build/buildd/mingw32-3.4.5.20060117.1.dfsg/build_dir/src/gcc-3.4.5-20060117-1-dfsg/configure
-v --prefix=/usr --target=i586-mingw32msvc --enable-languages=c,c++
--enable-threads --enable-sjlj-exceptions --disable-multilib
--enable-version-specific-runtime-libs
Thread model: win32
gcc version 3.4.5 (mingw special)
--
Summary: Cannot create DLL with exported stdcall functions
because compiler exports the functions without the @N
decoration
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobivollebregt at gmail dot com
GCC build triplet: i486-linux-gnu
GCC host triplet: i486-linux-gnu
GCC target triplet: i586-mingw32msvc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/31680] Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration
2007-04-24 9:54 [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration tobivollebregt at gmail dot com
@ 2007-04-24 10:01 ` tobivollebregt at gmail dot com
2007-04-24 10:06 ` tobivollebregt at gmail dot com
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: tobivollebregt at gmail dot com @ 2007-04-24 10:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from tobivollebregt at gmail dot com 2007-04-24 11:01 -------
Created an attachment (id=13434)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13434&action=view)
Shell script which I used to create the 4.3.0 cross compiler
The used binutils are the "official" binutils. The mingw-runtime and w32-api
came from http://sourceforge.net/project/showfiles.php?group_id=2435.
Just FYI, the md5sums of the respective files I used, are:
e26e2e06b6e4bf3acf1dc8688a94c0d1 binutils-2.17.tar.bz2
a9fdbd5162aa1ae0171c47f929adf938 mingw-runtime-3.12-src.tar.gz
be0b0219645a4ee0f3495c2abf90b5ad w32api-3.9-src.tar.gz
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/31680] Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration
2007-04-24 9:54 [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration tobivollebregt at gmail dot com
2007-04-24 10:01 ` [Bug c/31680] " tobivollebregt at gmail dot com
@ 2007-04-24 10:06 ` tobivollebregt at gmail dot com
2007-04-25 8:58 ` [Bug target/31680] " dannysmith at users dot sourceforge dot net
2007-04-25 10:17 ` dannysmith at users dot sourceforge dot net
3 siblings, 0 replies; 5+ messages in thread
From: tobivollebregt at gmail dot com @ 2007-04-24 10:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from tobivollebregt at gmail dot com 2007-04-24 11:06 -------
Created an attachment (id=13435)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13435&action=view)
Log of the compiler build.
Maybe the most useful line in the log:
Checked out revision 124096.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/31680] Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration
2007-04-24 9:54 [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration tobivollebregt at gmail dot com
2007-04-24 10:01 ` [Bug c/31680] " tobivollebregt at gmail dot com
2007-04-24 10:06 ` tobivollebregt at gmail dot com
@ 2007-04-25 8:58 ` dannysmith at users dot sourceforge dot net
2007-04-25 10:17 ` dannysmith at users dot sourceforge dot net
3 siblings, 0 replies; 5+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2007-04-25 8:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from dannysmith at users dot sourceforge dot net 2007-04-25 09:57 -------
Testing a patch.
Danny
--
dannysmith at users dot sourceforge dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |dannysmith at users dot
|dot org |sourceforge dot net
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-04-25 09:57:55
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug target/31680] Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration
2007-04-24 9:54 [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration tobivollebregt at gmail dot com
` (2 preceding siblings ...)
2007-04-25 8:58 ` [Bug target/31680] " dannysmith at users dot sourceforge dot net
@ 2007-04-25 10:17 ` dannysmith at users dot sourceforge dot net
3 siblings, 0 replies; 5+ messages in thread
From: dannysmith at users dot sourceforge dot net @ 2007-04-25 10:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dannysmith at users dot sourceforge dot net 2007-04-25 11:17 -------
Fixed.
Author: dannysmith
Date: Wed Apr 25 11:06:28 2007
New Revision: 124149
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124149
Log:
* config/i386/winnt.c (i386_pe_file_end): Strip only
USER_LABEL_PREFIX when writing export name.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/winnt.c
--
dannysmith at users dot sourceforge dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.3.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31680
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-04-25 10:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-24 9:54 [Bug c/31680] New: Cannot create DLL with exported stdcall functions because compiler exports the functions without the @N decoration tobivollebregt at gmail dot com
2007-04-24 10:01 ` [Bug c/31680] " tobivollebregt at gmail dot com
2007-04-24 10:06 ` tobivollebregt at gmail dot com
2007-04-25 8:58 ` [Bug target/31680] " dannysmith at users dot sourceforge dot net
2007-04-25 10:17 ` dannysmith at users dot sourceforge dot net
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).