From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D4ED33858C20; Wed, 6 Jul 2022 12:31:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D4ED33858C20 From: "maennich at android dot com" To: libabigail@sourceware.org Subject: [Bug default/29322] New: Missing type information for common symbols Date: Wed, 06 Jul 2022 12:31:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: libabigail X-Bugzilla-Component: default X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: maennich at android dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dodji at redhat dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: libabigail@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list of the Libabigail project List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 06 Jul 2022 12:31:59 -0000 https://sourceware.org/bugzilla/show_bug.cgi?id=3D29322 Bug ID: 29322 Summary: Missing type information for common symbols Product: libabigail Version: unspecified Status: NEW Severity: normal Priority: P2 Component: default Assignee: dodji at redhat dot com Reporter: maennich at android dot com CC: libabigail at sourceware dot org Target Milestone: --- Consider the following example test.c ------- int arg_common1[2]; int arg_common2[2]; ------- Compiled with=20 $ gcc -fcommon test.c -o test.o -c -g abidw is not able to connect the DWARF type information with the symbols. That is because of two issues: The section index of the symbol is 'COM' $ readelf -sW test.o Symbol table '.symtab' contains 9 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS test.c 2: 0000000000000000 0 SECTION LOCAL DEFAULT 4 .debug_info 3: 0000000000000000 0 SECTION LOCAL DEFAULT 6 .debug_abbrev 4: 0000000000000000 0 SECTION LOCAL DEFAULT 9 .debug_line 5: 0000000000000000 0 SECTION LOCAL DEFAULT 11 .debug_str 6: 0000000000000000 0 SECTION LOCAL DEFAULT 12 .debug_line_str 7: 0000000000000008 8 OBJECT GLOBAL DEFAULT COM arg_common1 8: 0000000000000008 8 OBJECT GLOBAL DEFAULT COM arg_common2 That makes the lookup of the section via elfutils fail and the address 0000000000000008 is used. The address as such can't be used as it might collide with non-common symbo= ls actually being defined at the same address. But even then, the lookup of the symbol fails and is also ambiguous as comm= on symbols might be located at the same address. In order to address one would need to make the symbol lookup also carry a name in the key. That is quite intrusive for libabigail. $ dwarfdump test.o .debug_info COMPILE_UNIT
: < 0><0x0000000c> DW_TAG_compile_unit DW_AT_producer GNU C17 11.3.0 -mtune=3Dgen= eric -march=3Dx86-64 -g -fcommon -fasynchronous-unwind-tables DW_AT_language DW_LANG_C11 DW_AT_name test.c DW_AT_comp_dir /ws/contrib/libabigail DW_AT_stmt_list 0x00000000 LOCAL_SYMBOLS: < 1><0x0000001e> DW_TAG_array_type DW_AT_type <0x00000035> DW_AT_sibling <0x0000002e> < 2><0x00000027> DW_TAG_subrange_type DW_AT_type <0x0000002e> DW_AT_upper_bound 1 < 1><0x0000002e> DW_TAG_base_type DW_AT_byte_size 0x00000008 DW_AT_encoding DW_ATE_unsigned DW_AT_name long unsigned int < 1><0x00000035> DW_TAG_base_type DW_AT_byte_size 0x00000004 DW_AT_encoding DW_ATE_signed DW_AT_name int < 1><0x0000003c> DW_TAG_variable DW_AT_name arg_common1 DW_AT_decl_file 0x00000001 DW_AT_decl_line 0x00000001 DW_AT_decl_column 0x00000005 DW_AT_type <0x0000001e> DW_AT_external yes(1) DW_AT_location len 0x0009: 0x030800000000000000: DW_OP_addr 0x00000008 < 1><0x00000050> DW_TAG_variable DW_AT_name arg_common2 DW_AT_decl_file 0x00000001 DW_AT_decl_line 0x00000002 DW_AT_decl_column 0x00000005 DW_AT_type <0x0000001e> DW_AT_external yes(1) DW_AT_location len 0x0009: 0x030800000000000000: DW_OP_addr 0x00000008 Given that -fcommon is not a default flag, is rarely used (apparently) and particularly not in any of my use cases, I do not intend to work on this. I just reported the bug for posterity. --=20 You are receiving this mail because: You are on the CC list for the bug.=