- reconsider = 1;
- rest_of_decl_compilation (decl, NULL, 1, 1);
+ bool needed = 1;
+
+ if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
+ /* needed */;
+ else if (DECL_COMDAT (decl))
+ needed = 0;
+ else if (TREE_READONLY (decl) && !TREE_PUBLIC (decl)
+ && (optimize || !flag_keep_static_consts
+ || DECL_ARTIFICIAL (decl)))
+ needed = 0;
+
+ if (needed)
+ {
+ reconsider = 1;
+ rest_of_decl_compilation (decl, NULL, 1, 1);
+ }