@@ -10124,7 +10124,8 @@ c_write_global_declarations (void)
/* After cgraph has had a chance to emit everything that's going to
be emitted, output debug information for globals. */
- if (!seen_error ())
+ if (debug_hooks->global_decl != &debug_nothing_tree
+ && !seen_error ())
{
timevar_push (TV_SYMOUT);
FOR_EACH_VEC_ELT (*all_translation_units, i, t)
@@ -521,8 +521,10 @@ emit_debug_global_declarations (tree *vec, int len)
{
int i;
- /* Avoid confusing the debug information machinery when there are errors. */
- if (seen_error ())
+ /* Avoid confusing the debug information machinery when there are
+ errors. Don't scan all global declarations for nothing. */
+ if (debug_hooks->global_decl == &debug_nothing_tree
+ || seen_error ())
return;
timevar_push (TV_SYMOUT);