This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug debug/48041] New: dwarf2out emits unnecessary null byte in empty .debug_abbrev section
- From: "mark at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 9 Mar 2011 09:55:53 +0000
- Subject: [Bug debug/48041] New: dwarf2out emits unnecessary null byte in empty .debug_abbrev section
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48041
Summary: dwarf2out emits unnecessary null byte in empty
.debug_abbrev section
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: mark@gcc.gnu.org
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.
The fix seems easy:
Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c (revision 170813)
+++ gcc/dwarf2out.c (working copy)
@@ -11058,7 +11058,8 @@
}
/* 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. */
Bootstraps fine on x86_64-gnu-linux and no regressions seen with make check -k
I'll submit it to gcc-patches when the tree opens up again for stage one.