Gmane
From: Charles Wilson <cwilso11@...>
Subject: Re: Address fixup applied TWICE
Newsgroups: gmane.comp.gnu.mingw.user
Date: 2007-09-04 03:21:17 GMT (1 year, 5 days and 13 minutes ago)
Danny Smith wrote:
> The reason for this is that the meaning of -Wl,--dll (or -mdll) has
> changed. When dllwrap and this file fragment was written, --dll mean't
> simply to build an executable with appropriate image base for a dll.
> (Do "ld --help | grep dll")  It didn't create a reloc section so that we
> ended up with a non-relocatable dll.   Hence all the crazy dllwrap stuff
> to get a reloc section.
> 
> Then -shared came along  for PE targets,  and sometime later, someone
> decided that --dll should do the same thing as --shared.   I think this
> happened as part of the changes to make relocateble exe files. So now if
> you really want to build a 
> non-relocatable dll, you need to strip the reloc section.  Actually
> there was an Ada bug report about that.  
> 
> <google>
> I thought I had run into this before
> http://sourceware.org/ml/binutils/2003-07/msg00526.html

Thanks for the explanation.  So, something like the attached (UNTESTED!) 
patch would be appropriate?  All it (attempts) to do is use DLLTOOL to 
generate the .def, and then gcc -shared (once) to make the DLL (I added 
the .def file to DLL_CC_STUFF).

I *think* the entry point specified is the default, so that could 
probably be dropped from DLL_CC_STUFF.  Plus, if this works, it's easy 
enough that the whining in the makefile about dllWRAP can be removed...

--
Chuck

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/winsup/mingw/Makefile.in,v
retrieving revision 1.79
diff -u -r1.79 Makefile.in
--- Makefile.in	3 Aug 2007 22:51:23 -0000	1.79
+++ Makefile.in	4 Sep 2007 03:17:31 -0000
@@ -238,32 +238,15 @@
 	$(AR) $(ARFLAGS) $@ crtmt.o
 	$(RANLIB) $@

-# Using dllwrap would be so much easier, but Cygnus top-level configure
-# Makefile.in etc don't pass the right variables yet.
-xx_$(THREAD_DLL_NAME) xx_mingwthrd.def: mthr.o mthr_init.o
-	$(DLLWRAP) $(DLLWRAP_FLAGS) -o $(THREAD_DLL_NAME) \
-		--output-def mingwthrd.def \
-		mthr.o mthr_init.o
-
 DLL_OFILES        = mthr.o mthr_init.o
-DLL_CC_STUFF      = -B./ -mdll $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
+DLL_CC_STUFF      = -B./ -shared $(MNO_CYGWIN) -Wl,--image-base,0x6FBC0000 \
 		    -Wl,--entry,_DllMainCRTStartup <at> 12 \
-                    $(DLL_OFILES) \
+                    $(DLL_OFILES) mingwthrd.def \
 		    -Lmingwex
-DLL_DLLTOOL_STUFF = --as=$(AS) --dllname $(THREAD_DLL_NAME) \
-                    --def mingwthrd.def \
-                    --base-file mingwthrd.base --output-exp mingwthrd.exp

 $(THREAD_DLL_NAME) mingwthrd.def: $(DLL_OFILES) Makefile $(SUBDIRS)
 	$(DLLTOOL) --as $(AS) --output-def mingwthrd.def $(DLL_OFILES)
-	$(CC) -Wl,--base-file=mingwthrd.base $(DLL_CC_STUFF) \
-		-o mingwthrd_dummy.exe
-	$(DLLTOOL) $(DLL_DLLTOOL_STUFF)
-	$(CC) -Wl,--base-file=mingwthrd.base mingwthrd.exp $(DLL_CC_STUFF) \
-		-o mingwthrd_dummy.exe
-	$(DLLTOOL) $(DLL_DLLTOOL_STUFF)
-	$(CC) mingwthrd.exp -o $(THREAD_DLL_NAME) $(DLL_CC_STUFF)
-	rm -f mingwthrd_dummy.exe
+	$(CC) $(DLL_CC_STUFF) -o $(THREAD_DLL_NAME)

 libmingw32.a: $(MINGW_OBJS)
 	$(AR) rc $@ $(MINGW_OBJS)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
MinGW-users mailing list
MinGW-users@...

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users