X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Message-ID: <4AF0E721.8000102@users.sourceforge.net> Date: Tue, 03 Nov 2009 20:29:53 -0600 From: "Yaakov (Cygwin/X)" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.4pre) Gecko/20090915 Thunderbird/3.0b4 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: binutils: dlltool DATA exports incompatible with auto-import Content-Type: multipart/mixed; boundary="------------050201050905050707060801" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------050201050905050707060801 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050201050905050707060801 Content-Type: text/plain; name="libtest.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libtest.c" __declspec(dllexport) int test_data = 42; __declspec(dllexport) int test_func(void) { return test_data; } --------------050201050905050707060801 Content-Type: text/plain; name="libtest.def" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="libtest.def" EXPORTS test_func test_data DATA --------------050201050905050707060801 Content-Type: text/plain; name="test.c" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="test.c" extern int test_data; extern int test_func(void); int main(void) { int foo = test_data; test_func(); return 0; } --------------050201050905050707060801 Content-Type: text/plain; charset=us-ascii -- 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 --------------050201050905050707060801--