* [Bug default/29322] New: Missing type information for common symbols
@ 2022-07-06 12:31 maennich at android dot com
0 siblings, 0 replies; only message in thread
From: maennich at android dot com @ 2022-07-06 12:31 UTC (permalink / raw)
To: libabigail
https://sourceware.org/bugzilla/show_bug.cgi?id=29322
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
$ 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 symbols
actually being defined at the same address.
But even then, the lookup of the symbol fails and is also ambiguous as common
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<header overall offset = 0x00000000>:
< 0><0x0000000c> DW_TAG_compile_unit
DW_AT_producer GNU C17 11.3.0 -mtune=generic
-march=x86-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.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-06 12:31 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06 12:31 [Bug default/29322] New: Missing type information for common symbols maennich at android dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).