Commit ab23f787 by Jason Merrill Committed by Jason Merrill

decl2.c (comdat_linkage): Also set DECL_COMDAT.

	* decl2.c (comdat_linkage): Also set DECL_COMDAT.
	(finish_file): Check DECL_COMDAT instead of weak|one_only.
	(import_export_vtable): Use make_decl_one_only instead of
 	comdat_linkage for win32 tweak.
	(import_export_decl): Likewise.
	* pt.c (mark_decl_instantiated): Likewise.

Fix libgcc with -O3.

From-SVN: r17056
parent 74d7ab55
Thu Dec 11 22:18:37 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (comdat_linkage): Also set DECL_COMDAT.
(finish_file): Check DECL_COMDAT instead of weak|one_only.
(import_export_vtable): Use make_decl_one_only instead of
comdat_linkage for win32 tweak.
(import_export_decl): Likewise.
* pt.c (mark_decl_instantiated): Likewise.
* decl2.c (finish_file): Lose handling of templates in pending_statics.
Thu Dec 11 21:12:09 1997 Jason Merrill <jason@yorick.cygnus.com> Thu Dec 11 21:12:09 1997 Jason Merrill <jason@yorick.cygnus.com>
* decl2.c (finish_file): Lose call to expand_builtin_throw. * decl2.c (finish_file): Lose call to expand_builtin_throw.
......
...@@ -2499,6 +2499,9 @@ comdat_linkage (decl) ...@@ -2499,6 +2499,9 @@ comdat_linkage (decl)
make_decl_one_only (decl); make_decl_one_only (decl);
else else
TREE_PUBLIC (decl) = 0; TREE_PUBLIC (decl) = 0;
if (DECL_LANG_SPECIFIC (decl))
DECL_COMDAT (decl) = 1;
} }
/* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL, /* Set TREE_PUBLIC and/or DECL_EXTERN on the vtable DECL,
...@@ -2533,7 +2536,7 @@ import_export_vtable (decl, type, final) ...@@ -2533,7 +2536,7 @@ import_export_vtable (decl, type, final)
linkonce sections. */ linkonce sections. */
if (CLASSTYPE_EXPLICIT_INSTANTIATION (type) if (CLASSTYPE_EXPLICIT_INSTANTIATION (type)
&& supports_one_only () && ! SUPPORTS_WEAK) && supports_one_only () && ! SUPPORTS_WEAK)
comdat_linkage (decl); make_decl_one_only (decl);
} }
else else
{ {
...@@ -2810,7 +2813,7 @@ import_export_decl (decl) ...@@ -2810,7 +2813,7 @@ import_export_decl (decl)
linkonce sections. */ linkonce sections. */
if (CLASSTYPE_EXPLICIT_INSTANTIATION (ctype) if (CLASSTYPE_EXPLICIT_INSTANTIATION (ctype)
&& supports_one_only () && ! SUPPORTS_WEAK) && supports_one_only () && ! SUPPORTS_WEAK)
comdat_linkage (decl); make_decl_one_only (decl);
} }
else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype)) else if (TYPE_BUILT_IN (ctype) && ctype == TYPE_MAIN_VARIANT (ctype))
DECL_NOT_REALLY_EXTERN (decl) = 0; DECL_NOT_REALLY_EXTERN (decl) = 0;
...@@ -2963,18 +2966,6 @@ finish_file () ...@@ -2963,18 +2966,6 @@ finish_file ()
walk_vtables ((void (*) PROTO ((tree, tree))) 0, walk_vtables ((void (*) PROTO ((tree, tree))) 0,
finish_prevtable_vardecl); finish_prevtable_vardecl);
for (vars = pending_statics; vars; vars = TREE_CHAIN (vars))
{
tree decl = TREE_VALUE (vars);
if (DECL_TEMPLATE_INSTANTIATION (decl)
&& ! DECL_IN_AGGR_P (decl))
{
import_export_decl (decl);
DECL_EXTERNAL (decl) = ! DECL_NOT_REALLY_EXTERN (decl);
}
}
for (vars = static_aggregates; vars; vars = TREE_CHAIN (vars)) for (vars = static_aggregates; vars; vars = TREE_CHAIN (vars))
if (! TREE_ASM_WRITTEN (TREE_VALUE (vars))) if (! TREE_ASM_WRITTEN (TREE_VALUE (vars)))
rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1); rest_of_decl_compilation (TREE_VALUE (vars), 0, 1, 1);
...@@ -3255,8 +3246,7 @@ finish_file () ...@@ -3255,8 +3246,7 @@ finish_file ()
*p = TREE_CHAIN (*p); *p = TREE_CHAIN (*p);
else if (DECL_INITIAL (decl) == 0) else if (DECL_INITIAL (decl) == 0)
p = &TREE_CHAIN (*p); p = &TREE_CHAIN (*p);
else if ((TREE_PUBLIC (decl) && ! DECL_WEAK (decl) else if ((TREE_PUBLIC (decl) && ! DECL_COMDAT (decl))
&& ! DECL_ONE_ONLY (decl))
|| TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)) || TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl))
|| flag_keep_inline_functions) || flag_keep_inline_functions)
{ {
......
...@@ -4025,7 +4025,7 @@ mark_decl_instantiated (result, extern_p) ...@@ -4025,7 +4025,7 @@ mark_decl_instantiated (result, extern_p)
/* For WIN32 we also want to put explicit instantiations in /* For WIN32 we also want to put explicit instantiations in
linkonce sections. */ linkonce sections. */
if (supports_one_only () && ! SUPPORTS_WEAK) if (supports_one_only () && ! SUPPORTS_WEAK)
comdat_linkage (result); make_decl_one_only (result);
} }
else if (TREE_CODE (result) == FUNCTION_DECL) else if (TREE_CODE (result) == FUNCTION_DECL)
mark_inline_for_output (result); mark_inline_for_output (result);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment