[Bug default/28584] Clang doesn't emit DW_AT_external for some global variables so they are dropped by libabigail

gprocida at google dot com sourceware-bugzilla@sourceware.org
Mon Nov 15 21:05:13 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=28584

gprocida at google dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |REOPENED

--- Comment #4 from gprocida at google dot com ---
Hi.

I don't think DW_AT_external is the real cause.

For the second example below. Here are what GCC 10 and Clang 11 both give me as
debug_info. They have exactly one DW_AT_external attribute.

GCC

COMPILE_UNIT<header overall offset = 0x00000000>:
< 0><0x0000000b>  DW_TAG_compile_unit
                    DW_AT_producer              GNU C++14 10.3.0 -mtune=generic
-march=x86-64 -g -fasynchronous-unwind-tables
                    DW_AT_language              DW_LANG_C_plus_plus
                    DW_AT_name                  smv.cc
                    DW_AT_comp_dir             
/usr/local/google/home/gprocida/dev/stg/static_member_variable
                    DW_AT_stmt_list             0x00000000

LOCAL_SYMBOLS:
< 1><0x0000001d>    DW_TAG_namespace
                      DW_AT_name                  N
                      DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/stg/static_member_variable/smv.cc
                      DW_AT_decl_line             0x00000001
                      DW_AT_decl_column           0x0000000b
                      DW_AT_sibling               <0x0000003a>
< 2><0x00000027>      DW_TAG_structure_type
                        DW_AT_name                  S
                        DW_AT_byte_size             0x00000001
                        DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/stg/static_member_variable/smv.cc
                        DW_AT_decl_line             0x00000002
                        DW_AT_decl_column           0x00000008
< 3><0x0000002e>        DW_TAG_member
                          DW_AT_name                  D
                          DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/stg/static_member_variable/smv.cc
                          DW_AT_decl_line             0x00000002
                          DW_AT_decl_column           0x00000017
                          DW_AT_type                  <0x0000003a>
                          DW_AT_external              yes(1)
                          DW_AT_declaration           yes(1)
< 1><0x0000003a>    DW_TAG_base_type
                      DW_AT_byte_size             0x00000004
                      DW_AT_encoding              DW_ATE_signed
                      DW_AT_name                  int
< 1><0x00000041>    DW_TAG_variable
                      DW_AT_specification         <0x0000002e>
                      DW_AT_decl_line             0x00000003
                      DW_AT_decl_column           0x00000005
                      DW_AT_linkage_name          _ZN1N1S1DE
                      DW_AT_location              len 0x0009:
0x030000000000000000: 
                          DW_OP_addr 0x00000000

Clang

COMPILE_UNIT<header overall offset = 0x00000000>:
< 0><0x0000000b>  DW_TAG_compile_unit
                    DW_AT_producer              Debian clang version
11.1.0-4+build1
                    DW_AT_language              DW_LANG_C_plus_plus_14
                    DW_AT_name                  smv.cc
                    DW_AT_stmt_list             0x00000000
                    DW_AT_comp_dir             
/usr/local/google/home/gprocida/dev/stg/static_member_variable

LOCAL_SYMBOLS:
< 1><0x0000001e>    DW_TAG_namespace
                      DW_AT_name                  N
< 2><0x00000023>      DW_TAG_variable
                        DW_AT_specification         <0x0000003f>
                        DW_AT_location              len 0x0009:
0x030000000000000000: 
                            DW_OP_addr 0x00000000
                        DW_AT_linkage_name          _ZN1N1S1DE
< 2><0x00000036>      DW_TAG_structure_type
                        DW_AT_calling_convention    DW_CC_pass_by_value
                        DW_AT_name                  S
                        DW_AT_byte_size             0x00000001
                        DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/stg/static_member_variable/smv.cc
                        DW_AT_decl_line             0x00000002
< 3><0x0000003f>        DW_TAG_member
                          DW_AT_name                  D
                          DW_AT_type                  <0x0000004c>
                          DW_AT_decl_file             0x00000001
/usr/local/google/home/gprocida/dev/stg/static_member_variable/smv.cc
                          DW_AT_decl_line             0x00000002
                          DW_AT_external              yes(1)
                          DW_AT_declaration           yes(1)
< 1><0x0000004c>    DW_TAG_base_type
                      DW_AT_name                  int
                      DW_AT_encoding              DW_ATE_signed
                      DW_AT_byte_size             0x00000004

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libabigail mailing list