This is the mail archive of the gcc-patches@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]

[debug] dwarf2out emits unnecessary null byte in empty .debug_abbrev section


Hi,

Detected by the elfutils dwarflint tool.

Example:
$ echo > empty.c 
$ gcc -g -c empty.c 
$ readelf -x .debug_abbrev empty.o
Hex dump of section '.debug_abbrev':
  0x00000000 00                                  .

Although harmless it might add up if a project has a lot of objects without any
real debuginfo in them. There might not actually be many such projects though.

2011-03-24  Mark Wielaard  <mjw@redhat.com>

    PR debug/48041
    * dwarf2out.c (output_abbrev_section): Only terminate table when
    abbrev_die_table_in_use > 1.

Bootstraps fine on x86_64-gnu-linux and no regressions seen with make check -k

OK, to commit?

Thanks,

Mark

--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -11084,7 +11084,8 @@ output_abbrev_section (void)
     }
 
   /* Terminate the table.  */
-  dw2_asm_output_data (1, 0, NULL);
+  if (abbrev_die_table_in_use > 1)
+    dw2_asm_output_data (1, 0, NULL);
 }
 
 /* Output a symbol we can use to refer to this DIE from another CU.  */



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