This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

patch: Win32 explicit template instantiation


This patch fixes explicitly instantiation of a template with either/both of 
the following data members:

    - static const
    - static initialized 

This patch enables both of these to be emitted in unique linkonce sections 
and handled by the linker. See my previous message to egcs-bugs with the
subject "(980205) PE-COFF/Win32 static template data broken" on 2/11/98
for details.

The static const data members get placed in the .rdata$* sections, which
unfortunately tweaks a bug in the linker. Currently, Win32 gcc doesn't
use .rdata at all (READONLY_DATA_SECTION not defined) and so this bug
never really showed up before. Ian Taylor has a tentative patch, but
to be on the safe side, I've disabled using .rdata section altogether
(conditionalized by READONLY_DATA_SECTION). See patch for linker bug
workaround in next message.

Thu Feb 19 16:04:13 1998  Mumit Khan <khan@xraylith.wisc.edu>

	* pt.c (mark_decl_instantiated): Use comdat_linkage instead of
	make_decl_one_only for win32 tweak.

Index: gcc/cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.68
diff -u -p -r1.68 pt.c
--- pt.c	1998/02/14 15:49:20	1.68
+++ pt.c	1998/02/19 22:05:32
@@ -5240,7 +5240,7 @@ mark_decl_instantiated (result, extern_p
       /* For WIN32 we also want to put explicit instantiations in
 	 linkonce sections.  */
       if (supports_one_only () && ! SUPPORTS_WEAK && TREE_PUBLIC (result))
-	make_decl_one_only (result);
+	comdat_linkage (result);
     }
   else if (TREE_CODE (result) == FUNCTION_DECL)
     mark_inline_for_output (result);

Regards,
Mumit -- khan@xraylith.wisc.edu
http://www.xraylith.wisc.edu/~khan/



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]