https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101905
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
assemble_decl isn't even called for DECL_HARD_REGISTER global vars:
if (DECL_HARD_REGISTER (node->decl)
|| DECL_HAS_VALUE_EXPR_P (node->decl))
continue;
if (node->definition)
changed |= node->assemble_decl ();
else
assemble_undefined_decl (node->decl);
and even if it would be, it wouldn't get into the spot that calls the debug
hook:
/* Hard register vars do not need to be output. */
if (DECL_HARD_REGISTER (decl))
return false;
...
debug_hooks->late_global_decl (decl);
return true;
So, either we should make sure that those vars get DW_AT_location already
during early debug (IMHO best, as the location should be known then already),
or we need to call late_global_decl on those somewhere else.