binutils: dlltool DATA exports incompatible with auto-import
Yaakov (Cygwin/X)
yselkowitz@users.sourceforge.net
Wed Nov 4 02:29:00 GMT 2009
GNOME Evolution contains several interdependent libraries, so on
Cygwin/MinGW the build creates artificial import libraries with dlltool
from .def files. While trying to build 2.28 I came across a possible
incompatibility between the implib generated by dlltool and auto-import
linkage:
$ gcc -shared -Wl,--out-implib,libtest.dll.a -o cygtest.dll libtest.c
Creating library file: libtest.dll.a
$ nm libtest.dll.a | grep -v ' [bdit] '
d000003.o:
00000000 I _cygtest_dll_iname
d000000.o:
00000000 I __head_cygtest_dll
U _cygtest_dll_iname
d000002.o:
U __head_cygtest_dll
00000000 I __imp__test_func
00000000 T _test_func
d000001.o:
U __head_cygtest_dll
00000000 I __imp__test_data
00000000 I __nm__test_data
$ gcc -o test.exe test.c libtest.dll.a
# now let's try with dlltool
$ dlltool --dllname cygtest.dll --input-def libtest.def --output-lib
libtest.dll.a
$ nm libtest.dll.a | grep -v ' [bdit] '
deobt.o:
00000000 I __libtest_dll_a_iname
deobh.o:
00000000 I __head_libtest_dll_a
U __libtest_dll_a_iname
deobs00001.o:
U __head_libtest_dll_a
00000000 I __imp__test_func
00000000 T _test_func
deobs00000.o:
U __head_libtest_dll_a
00000000 I __imp__test_data
# Note no __nm__test_data auto-import here
$ gcc -o test.exe test.c libtest.dll.a
fu000001.o:(.idata$2+0xc): undefined reference to `_libtest_dll_a_iname'
nmth000000.o:(.idata$4+0x0): undefined reference to `__nm__test_data'
collect2: ld returned 1 exit status
Yaakov
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libtest.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20091104/0afbb081/attachment.c>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: libtest.def
URL: <http://cygwin.com/pipermail/cygwin/attachments/20091104/0afbb081/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c
URL: <http://cygwin.com/pipermail/cygwin/attachments/20091104/0afbb081/attachment-0001.c>
-------------- next part --------------
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list