This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Question about extra debug (DWARF) info generated by gcc6/7


Hi,

With a test code like so:

struct foo {
   int fooMember;
};

extern struct foo fooDeclared;

void asymbol() { }

We find that gcc6 (or even gcc7) generates a lot more debug
information. "readelf -wi <.o file>" shows the following.

 <1><2d>: Abbrev Number: 2 (DW_TAG_structure_type)
    <2e>   DW_AT_name        : foo
    <32>   DW_AT_byte_size   : 4
    <33>   DW_AT_decl_file   : 1
    <34>   DW_AT_decl_line   : 1
    <35>   DW_AT_sibling     : <0x46>
 <2><39>: Abbrev Number: 3 (DW_TAG_member)
    <3a>   DW_AT_name        : (indirect string, offset: 0xc): fooMember
    <3e>   DW_AT_decl_file   : 1
    <3f>   DW_AT_decl_line   : 2
    <40>   DW_AT_type        : <0x46>
    <44>   DW_AT_data_member_location: 0
 <2><45>: Abbrev Number: 0
 <1><46>: Abbrev Number: 4 (DW_TAG_base_type)
    <47>   DW_AT_byte_size   : 4
    <48>   DW_AT_encoding    : 5 (signed)
    <49>   DW_AT_name        : int
 <1><4d>: Abbrev Number: 5 (DW_TAG_variable)
    <4e>   DW_AT_name        : (indirect string, offset: 0x0): fooDeclared
    <52>   DW_AT_decl_file   : 1
    <53>   DW_AT_decl_line   : 5
    <54>   DW_AT_type        : <0x2d>
    <58>   DW_AT_external    : 1
    <58>   DW_AT_declaration : 1

The compilation line is: "gcc -o t.o -c -g t.c" in all attempts.

It is not at all obvious why there is debug information being
generated for an unused "extern" (struct foo, "fooDeclared")

We don't observe this with gcc4 or gcc5. In our environment this seems
to result in the non-trivial increase of object file size (on disk),
resulting in other downstream issues.

So we are trying to understand if some config option has some how
become default.

gcc 5.4 version, built from Fedora based sources: gcc version 5.4.0
20160603 (Red Hat 5.4.0-6) (GCC) - does not produce this behavior.

gcc 6.3 version which exhibits this new behavior: gcc version 6.3.1
20170216 (Red Hat 6.3.1-3) (GCC). We picked the source rpm for this
from F25.

We also tested on gcc 6.2 (Ubuntu Yakkety, and observed the same new
behavior): gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)

Many thanks.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]