Bug 101141 - Fedora glibc debuginfo .dwz contains a partial unit with needed debuginfo but which is not imported
Summary: Fedora glibc debuginfo .dwz contains a partial unit with needed debuginfo but...
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 11.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-21 02:59 UTC by roc@ocallahan.org
Modified: 2021-06-21 03:36 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2021-06-21 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description roc@ocallahan.org 2021-06-21 02:59:02 UTC
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.
Comment 1 Andrew Pinski 2021-06-21 03:02:56 UTC
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?
Comment 2 roc@ocallahan.org 2021-06-21 03:30:20 UTC
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.
Comment 3 roc@ocallahan.org 2021-06-21 03:36:29 UTC
Filed https://sourceware.org/bugzilla/show_bug.cgi?id=28000