Commits

Iain Buclaw  committed f03006f

Put one-only decls on comdat, mark emitted as referenced.

  • Participants
  • Parent commits b5399a7

Comments (0)

Files changed (1)

File d/d-objfile.cc

                 || DECL_INITIAL(decl_tree) == error_mark_node)
             DECL_COMMON(decl_tree) = 1;
     }
+    DECL_COMDAT(decl_tree) = 1;
 }
 
 void
     if (s->prettyIdent)
         DECL_NAME(t) = get_identifier(s->prettyIdent);
 
+    mark_decl_referenced(t);
+
     d_add_global_declaration(t);
 
     // %% Hack
     Symbol * s = f->toSymbol();
     tree t = s->Stree;
 
+    gcc_assert(TREE_CODE(t) == FUNCTION_DECL);
+
     // Write out _tlsstart/_tlsend.
     if (f->isMain() || f->isWinMain() || f->isDllMain())
         obj_tlssections();
     if (s->prettyIdent)
         DECL_NAME(t) = get_identifier(s->prettyIdent);
 
+    mark_decl_referenced(t);
+
     d_add_global_declaration(t);
 
-    if (TREE_CODE(t) == FUNCTION_DECL)
+    if (!targetm.have_ctors_dtors)
     {
         if (DECL_STATIC_CONSTRUCTOR(t))
-        {
-            // %% check for nested function -- error
-            // otherwise, shouldn't be in a function, so safe to do asm_out
-            if (targetm.have_ctors_dtors)
-            {
-                // handled in d_expand_function
-            }
-            else
-            {   // %% assert FuncDeclaration
-                staticCtorList.push(f);
-                // %%TODO: fallback if ! targetm.have_ctors_dtors
-            }
-        }
+            staticCtorList.push(f);
         if (DECL_STATIC_DESTRUCTOR(t))
-        {
-            if (targetm.have_ctors_dtors)
-            {
-                // handled in d_expand_function
-            }
-            else
-            {   // %% assert FuncDeclaration
-                staticDtorList.push(f);
-                // %%TODO: fallback if ! targetm.have_ctors_dtors
-            }
-        }
+            staticDtorList.push(f);
     }
 
     if (! gen.functionNeedsChain(f))