public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch 2/3] unordered FAILs: .debug_info section alignment  (alpha-linux-gnu)
@ 2009-09-07  3:33 Jan Kratochvil
  2009-09-07  7:43 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kratochvil @ 2009-09-07  3:33 UTC (permalink / raw)
  To: binutils

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/3] unordered FAILs: .debug_info section alignment  (alpha-linux-gnu)
  2009-09-07  3:33 [patch 2/3] unordered FAILs: .debug_info section alignment (alpha-linux-gnu) Jan Kratochvil
@ 2009-09-07  7:43 ` Alan Modra
  2009-09-07 18:07   ` Jan Kratochvil
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2009-09-07  7:43 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: binutils

On Mon, Sep 07, 2009 at 05:33:19AM +0200, Jan Kratochvil wrote:
> 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.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch 2/3] unordered FAILs: .debug_info section alignment  (alpha-linux-gnu)
  2009-09-07  7:43 ` Alan Modra
@ 2009-09-07 18:07   ` Jan Kratochvil
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kratochvil @ 2009-09-07 18:07 UTC (permalink / raw)
  To: binutils

On Mon, 07 Sep 2009 09:43:36 +0200, Alan Modra wrote:
> On Mon, Sep 07, 2009 at 05:33:19AM +0200, Jan Kratochvil wrote:
> > 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.
> 
> OK.

Checked-in:
	http://sourceware.org/ml/binutils-cvs/2009-09/msg00103.html


Thanks,
Jan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-07 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-07  3:33 [patch 2/3] unordered FAILs: .debug_info section alignment (alpha-linux-gnu) Jan Kratochvil
2009-09-07  7:43 ` Alan Modra
2009-09-07 18:07   ` Jan Kratochvil

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).