This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[patch 2/3] unordered FAILs: .debug_info section alignment (alpha-linux-gnu)
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: binutils at sourceware dot org
- Date: Mon, 7 Sep 2009 05:33:19 +0200
- Subject: [patch 2/3] unordered FAILs: .debug_info section alignment (alpha-linux-gnu)
Hi,
alpha-linux-gnu still produces:
readelf: Warning: Debug info is corrupted, length of CU at 17 extends beyond end of section (length = 95d70000)
As if .debug_info length is odd the section length gets even and readelf tries
to interpret the single trailing zero byte as a new CU.
Patch makes readelf compliant with DWARF:
DWARF3 7.5.2.:
On some architectures, there are alignment constraints on section boundaries.
To make it easier to pad debugging information sections to satisfy such
constraints, the abbreviation code 0 is reserved. Debugging information
entries consisting of only the abbreviation code 0 are considered null
entries.
No regressions found.
Thanks,
Jan
readelf: Warning: Debug info is corrupted, length of CU at 17 extends beyond end of section (length = 95d70000)
binutils/
2009-08-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* dwarf.c (process_debug_info): Support section padding abbrev codes.
binutils/testsuite/
2009-08-31 Jan Kratochvil <jan.kratochvil@redhat.com>
* binutils-all/testranges.s (.debug_info): Pad the only CU.
--- binutils/dwarf.c 17 Jul 2009 15:19:21 -0000 1.52
+++ binutils/dwarf.c 31 Aug 2009 17:47:37 -0000
@@ -1985,9 +1985,22 @@ process_debug_info (struct dwarf_section
abbrev_number = read_leb128 (tags, & bytes_read, 0);
tags += bytes_read;
- /* A null DIE marks the end of a list of siblings. */
+ /* A null DIE marks the end of a list of siblings or it may also be
+ a section padding. */
if (abbrev_number == 0)
{
+ /* Check if it can be a section padding for the last CU. */
+ if (level == 0 && start == end)
+ {
+ unsigned char *chk;
+
+ for (chk = tags; chk < start; chk++)
+ if (*chk != 0)
+ break;
+ if (chk == start)
+ break;
+ }
+
--level;
if (level < 0)
{
--- binutils/testsuite/binutils-all/testranges.s-0 2009-08-31 19:44:06.000000000 +0200
+++ binutils/testsuite/binutils-all/testranges.s 2009-08-31 19:47:06.000000000 +0200
@@ -32,6 +32,10 @@ debugS:
.uleb128 0x2 ;# (DIE (0x6d) DW_TAG_subprogram)
.ascii "A\0" ;# DW_AT_name
.4byte range_sub - range ;# DW_AT_ranges
+
+ ;# minimal section alignment on alpha-* is 2, ensure no new invalid CU
+ ;# will be started.
+ .balign 2
debugE:
.section .debug_abbrev,"",%progbits