https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87362
--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following makes it work for a simple C int main() {}. It's also a little
bit less hacky...
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 264418)
+++ gcc/dwarf2out.c (working copy)
@@ -26896,6 +26896,10 @@ dwarf2out_decl (tree decl)
static void
dwarf2out_function_decl (tree decl)
{
+ if (in_lto_p)
+ /* This helps debuggers to build a symbol table. */
+ if (dw_die_ref die = lookup_decl_die (decl))
+ add_linkage_attr (die, decl);
dwarf2out_decl (decl);
call_arg_locations = NULL;
call_arg_loc_last = NULL;