diff options
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r-- | gcc/varasm.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c index 77798286ba5..e7a566359ad 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -1175,15 +1175,20 @@ assemble_variable (decl, top_level, at_end, dont_output_data) && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0)) sdbout_symbol (decl, 0); #endif +#ifdef DWARF_DEBUGGING_INFO + if (write_symbols == DWARF_DEBUG && top_level + && DECL_CONTEXT (decl)) + dwarfout_file_scope_decl (decl, 0); +#endif } - /* Don't output any DWARF debugging information for variables here. - In the case of local variables, the information for them is output - when we do our recursive traversal of the tree representation for - the entire containing function. In the case of file-scope variables, - we output information for all of them at the very end of compilation - while we are doing our final traversal of the chain of file-scope - declarations. */ + /* Only output DWARF debugging information for record-scope variables + here. In the case of function-scope variables, the information + for them is output when we do our recursive traversal of the tree + representation for the entire containing function. In the case of + file-scope variables, we output information for all of them at the + very end of compilation while we are doing our final traversal of + the chain of file-scope declarations. */ return; } @@ -1298,14 +1303,19 @@ assemble_variable (decl, top_level, at_end, dont_output_data) && (TREE_PUBLIC (decl) == 0 || DECL_INITIAL (decl) == 0)) sdbout_symbol (decl, 0); #endif +#ifdef DWARF_DEBUGGING_INFO + if (write_symbols == DWARF_DEBUG && top_level + && DECL_CONTEXT (decl)) + dwarfout_file_scope_decl (decl, 0); +#endif - /* Don't output any DWARF debugging information for variables here. - In the case of local variables, the information for them is output - when we do our recursive traversal of the tree representation for - the entire containing function. In the case of file-scope variables, - we output information for all of them at the very end of compilation - while we are doing our final traversal of the chain of file-scope - declarations. */ + /* Only output DWARF debugging information for record-scope variables + here. In the case of function-scope variables, the information + for them is output when we do our recursive traversal of the tree + representation for the entire containing function. In the case of + file-scope variables, we output information for all of them at the + very end of compilation while we are doing our final traversal of + the chain of file-scope declarations. */ #if 0 /* ??? We should either delete this or add a comment describing what it was intended to do and why we shouldn't delete it. */ |