https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63546
--- Comment #8 from Jan Hubicka <hubicka at ucw dot cz> --- Hi, this patch should avoid production of RTL only for those vars that we know are never used by real code. Index: dwarf2out.c =================================================================== --- dwarf2out.c (revision 216317) +++ dwarf2out.c (working copy) @@ -15755,7 +15755,9 @@ rtl_for_decl_location (tree decl) && TREE_STATIC (decl) && DECL_NAME (decl) && !DECL_HARD_REGISTER (decl) - && DECL_MODE (decl) != VOIDmode) + && DECL_MODE (decl) != VOIDmode + && (symtab->state <= CONSTRUCTION + || varpool_node::get (decl))) { rtl = make_decl_rtl_for_debug (decl); if (!MEM_P (rtl)