The Fedora 34 package glibc-debuginfo-2.33-16.fc34.x86_64 package has glibc symbols in /usr/lib/debug/.build-id/08/1490fc18239fa63189a53e526a68ee5d19c571.debug whose .gnu_debugaltlink is /usr/lib/debug/usr/.dwz/glibc-2.33-16.fc34.x86_64. /usr/lib/debug/.build-id/08/1490fc18239fa63189a53e526a68ee5d19c571.debug has a compilation unit that imports the partial unit at 0x1f63c from the .dwz file: UNIT<header overall offset = 0x000795ee>: < 0><0x0000000c GOFF=0x000795fa> DW_TAG_compile_unit DW_AT_producer <.debug_str(sup)+0x0001200e> DW_AT_language DW_LANG_C11 DW_AT_name global-locale.c DW_AT_comp_dir /usr/src/debug/glibc-2.33-16.fc34.x86_64/locale DW_AT_stmt_list <.debug_line+0x0000ce8a> < 1><0x0000001e GOFF=0x0007960c> DW_TAG_imported_unit DW_AT_import <.debug_info(sup)+0x0001f63c> That partial unit contains a variable declaration whose DW_AT_specification (0x1f0d2) lives in another partial compilation unit: UNIT<header overall offset = 0x0001f630>: < 0><0x0000000c GOFF=0x0001f63c> DW_TAG_partial_unit DW_AT_stmt_list <.debug_line+0x00000000> ... < 1><0x00000038 GOFF=0x0001f668> DW_TAG_variable DW_AT_specification <.debug_info+0x0001f0d2> DW_AT_decl_file 0x0000013b /usr/src/debug/glibc-2.33-16.fc34.x86_64/locale/global-locale.c DW_AT_decl_line 0x00000040 DW_AT_decl_column 0x00000013 DW_AT_location len 0x000a: 0e00000000000000009b: DW_OP_const8u 0 DW_OP_form_tls_address UNIT<header overall offset = 0x0001f0c1>: < 0><0x0000000c GOFF=0x0001f0cd> DW_TAG_partial_unit DW_AT_stmt_list <.debug_line+0x00000000> < 1><0x00000011 GOFF=0x0001f0d2> DW_TAG_variable DW_AT_name __libc_tsd_LOCALE DW_AT_decl_file 0x00000089 /usr/src/debug/glibc-2.33-16.fc34.x86_64/locale/localeinfo.h DW_AT_decl_line 0x000000e1 DW_AT_decl_column 0x00000001 DW_AT_type <.debug_info+0x00035fb3> DW_AT_external yes DW_AT_declaration yes However, the partial unit at 0x1f0cd is not imported anywhere in /usr/lib/debug/.build-id/08/1490fc18239fa63189a53e526a68ee5d19c571.debug as far as I can tell. I think the compilation unit at global-locale.c, at least, should be importing it.
This sounds like either a binutils issue or a https://sourceware.org/dwz/ issue or a Fedora issue. Can you rebuild glibc in Fedora and look at the resulting glibc.so file before the dwz and debug info gets stripped?
Good point. It looks correct in the generated .so so it's probably a DWZ bug. I'll repost it there. Sorry for the noise.
Filed https://sourceware.org/bugzilla/show_bug.cgi?id=28000