Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm 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 X-Scanned-By: AMaViS at pumpkin.vmfacility.fr From: "Ivan Warren" To: Subject: Library strip, automatic imports and specific imports Date: Wed, 17 Sep 2003 11:11:22 +0200 Message-ID: <000101c37cfb$a9a675c0$1411d0d4@vmfacility.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Priority: 3 (Normal) X-MSMail-Priority: Normal Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h8H9Bfgw002058 Hello, First of all, my apologies if this isssue has already been addressed. I searched the archive but couldn't find anything relevant. I am running into the following problem : If I issue a 'strip --strip-unneeded' to a DLL import library (created with --out-implib), Most .data and/or .bss external references generate linking errors. Furthermore, if I specify a __declspec(dllimport) to the reference *AND* the symbol is referenced by a DLL itself, the application raises SIGSEGV upon attempting to access the symbol. I am not sure binary attachments are allowed on this list, so here is a copy & paste of the files necessary to reproduce the problem : (note : the Makefile should have the spaces changed to a tab character) maincode: maincode.o libmydll.dll.a $(CC) $(CFLAGS) -o maincode maincode.o -L. -lmydll libmydll.dll.a: dllcode.o libmydll2.dll.a $(CC) dllcode.o -o cygmydll.dll -shared -L. -lmydll2 -Wl,--out-implib -Wl,libmydll.dll.a strip --strip-unneeded libmydll.dll.a libmydll2.dll.a: dllcode2.o $(CC) dllcode2.o -o cygmydll2.dll -shared -Wl,--out-implib -Wl,libmydll2.dll.a strip --strip-unneeded libmydll2.dll.a clean: rm -f *.o rm -f *.a rm -f *.dll rm -f *.exe rm -f *.stackdump extern __declspec(dllimport) level2; int somebss; int somedata=2; int sometext() { return(level2); } __declspec(dllexport) int level2=1; extern __declspec(dllimport) int somebss; extern __declspec(dllimport) int somedata; extern __declspec(dllimport) int sometext(); int main() { printf("%d\n",somebss); printf("%d\n",somedata); printf("%d\n",sometext()); } If you run './maincode' after make, the programs crashes. If you remove '__declspec(dllimport) from file 'dllcode.c' the link fails. If you comment out the 'strip' from the Makefile, the program links AND runs to completion. My questions is : Is this a 'binutil' core issue or something introduced by cygwin ? Is there a workaround (besides NOT stripping the import library) ? Note : this issues is a main concern when using 'libtool' because this behaviour is shown when using a libtool in confunction with automake/autoconf and a 'make install-strip' is issued. Thanks, --Ivan -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/