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) <sample> <File fn="Makefile"> 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 </File> <File fn="dllcode.c"> extern __declspec(dllimport) level2; int somebss; int somedata=2; int sometext() { return(level2); } </File> <File fn="dllcode2.c"> __declspec(dllexport) int level2=1; </File> <File fn="maincode.c"> 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()); } </File> </sample> 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/