public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PATCH: Have readelf report unused bytes at the end of a .debug_loc  section
@ 2007-11-21 11:57 Nick Clifton
  2007-11-21 13:55 ` Bobby McNulty
  2007-11-21 17:52 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 6+ messages in thread
From: Nick Clifton @ 2007-11-21 11:57 UTC (permalink / raw)
  To: binutils

Hi Guys,

  I am checking in the attached patch to add a warning message to
  display_debug_loc() if it detects that there are unused bytes at the
  end of the .debug_loc section.

Cheers
  Nick
    
binutils/ChangeLog
2007-11-20  Nick Clifton  <nickc@redhat.com>

	* dwarf.c (display_debug_loc): Issue a warning if there are bytes
	at the end of the .debug_loc section which are not referenced by
	any attribute in the .debug_info section.

Index: binutils/dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 dwarf.c
*** binutils/dwarf.c	16 Nov 2007 15:36:21 -0000	1.20
--- binutils/dwarf.c	21 Nov 2007 11:55:38 -0000
*************** display_debug_loc (struct dwarf_section 
*** 2624,2629 ****
--- 2624,2633 ----
  	    }
  	}
      }
+ 
+   if (start < section_end)
+     warn (_("There are %ld unused bytes at the end of section %s\n"),
+ 	  section_end - start, section->name);
    return 1;
  }
  

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

* Re: PATCH: Have readelf report unused bytes at the end of a .debug_loc  section
  2007-11-21 11:57 PATCH: Have readelf report unused bytes at the end of a .debug_loc section Nick Clifton
@ 2007-11-21 13:55 ` Bobby McNulty
  2007-11-21 16:37   ` Dave Korn
  2007-11-21 17:52 ` Hans-Peter Nilsson
  1 sibling, 1 reply; 6+ messages in thread
From: Bobby McNulty @ 2007-11-21 13:55 UTC (permalink / raw)
  To: binutils


----- Original Message ----- 
From: "Nick Clifton" <nickc@redhat.com>
To: <binutils@sourceware.org>
Sent: Wednesday, November 21, 2007 5:57 AM
Subject: PATCH: Have readelf report unused bytes at the end of a .debug_loc 
section


> Hi Guys,
>
>  I am checking in the attached patch to add a warning message to
>  display_debug_loc() if it detects that there are unused bytes at the
>  end of the .debug_loc section.
>
> Cheers
>  Nick
>
> binutils/ChangeLog
> 2007-11-20  Nick Clifton  <nickc@redhat.com>
>
> * dwarf.c (display_debug_loc): Issue a warning if there are bytes
> at the end of the .debug_loc section which are not referenced by
> any attribute in the .debug_info section.
>
> Index: binutils/dwarf.c
> ===================================================================
> RCS file: /cvs/src/src/binutils/dwarf.c,v
> retrieving revision 1.20
> diff -c -3 -p -r1.20 dwarf.c
> *** binutils/dwarf.c 16 Nov 2007 15:36:21 -0000 1.20
> --- binutils/dwarf.c 21 Nov 2007 11:55:38 -0000
> *************** display_debug_loc (struct dwarf_section
> *** 2624,2629 ****
> --- 2624,2633 ----
>      }
>  }
>      }
> +
> +   if (start < section_end)
> +     warn (_("There are %ld unused bytes at the end of section %s\n"),
> +   section_end - start, section->name);
>    return 1;
>  }
>
that broke cygwin 1.5.24-2.
I am compiling cygwin 1.7.0 and installing it on Vista home premium. Will 
report back in about an hour.
bobby 

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

* RE: PATCH: Have readelf report unused bytes at the end of a .debug_loc  section
  2007-11-21 13:55 ` Bobby McNulty
@ 2007-11-21 16:37   ` Dave Korn
  2007-11-21 16:58     ` Bobby McNulty
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Korn @ 2007-11-21 16:37 UTC (permalink / raw)
  To: binutils

On 21 November 2007 13:56, Bobby McNulty wrote:

  Hi Bobby,

>> * dwarf.c (display_debug_loc): Issue a warning if there are bytes
>> at the end of the .debug_loc section which are not referenced by
>> any attribute in the .debug_info section.

> that broke cygwin 1.5.24-2.

  Can you go into a bit more detail?  What error happened?  Do you mean broke
cygwin-1.5.24-2 during building it, or during using it?


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* Re: PATCH: Have readelf report unused bytes at the end of a .debug_loc  section
  2007-11-21 16:37   ` Dave Korn
@ 2007-11-21 16:58     ` Bobby McNulty
  0 siblings, 0 replies; 6+ messages in thread
From: Bobby McNulty @ 2007-11-21 16:58 UTC (permalink / raw)
  To: Dave Korn, binutils


----- Original Message ----- 
From: "Dave Korn" <dave.korn@artimi.com>
To: <binutils@sourceware.org>
Sent: Wednesday, November 21, 2007 10:37 AM
Subject: RE: PATCH: Have readelf report unused bytes at the end of a 
.debug_loc section


> On 21 November 2007 13:56, Bobby McNulty wrote:
>
>  Hi Bobby,
>
>>> * dwarf.c (display_debug_loc): Issue a warning if there are bytes
>>> at the end of the .debug_loc section which are not referenced by
>>> any attribute in the .debug_info section.
>
>> that broke cygwin 1.5.24-2.
>
>  Can you go into a bit more detail?  What error happened?  Do you mean 
> broke
> cygwin-1.5.24-2 during building it, or during using it?
>
>
>    cheers,
>      DaveK
> -- 
> Can't think of a witty .sigline today....
>
building it.
I was compiling binutils, just updated from this morning, dawrf.c.
I was using gcc trunk in Cygwin under Vista Home Premium.
I think its probably my fault. I am rebuilding binutils with the compiler 
that came with cygwin.
If it shows again, I will snapshot the error from the scree, and send that 
in.
From what I could tell, it was a syntax error (sorry for the term, I am an 
old BASIC programmer, though I've not used that in years. No need to)

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

* Re: PATCH: Have readelf report unused bytes at the end of a .debug_loc  section
  2007-11-21 11:57 PATCH: Have readelf report unused bytes at the end of a .debug_loc section Nick Clifton
  2007-11-21 13:55 ` Bobby McNulty
@ 2007-11-21 17:52 ` Hans-Peter Nilsson
  2007-11-21 19:32   ` Nick Clifton
  1 sibling, 1 reply; 6+ messages in thread
From: Hans-Peter Nilsson @ 2007-11-21 17:52 UTC (permalink / raw)
  To: nickc; +Cc: binutils

> From: Nick Clifton <nickc@redhat.com>
> Date: Wed, 21 Nov 2007 11:57:16 +0000

> +   if (start < section_end)
> +     warn (_("There are %ld unused bytes at the end of section %s\n"),
> + 	  section_end - start, section->name);
>     return 1;
>   }

For a build of cris-elf (unimportant) this broke where long !=
int with certain gcc versions, like gcc 4.0.2-8 (RH) with
'CC=gcc -O2 -m32'.  Perhaps add an iteration with -m32 to your
build variants?

I get:

gcc -O2 -m32 -DHAVE_CONFIG_H -I. -I/tmp/hpautotest-binutils/bsrc/src/binutils -I. -I. -I/tmp/hpautotest-binutils/bsrc/src/binutils -I../bfd -I/tmp/hpautotest-binutils/bsrc/src/binutils/../bfd -I/tmp/hpautotest-binutils/bsrc/src/binutils/../include -DLOCALEDIR="\"/usr/local/share/locale\"" -Dbin_dummy_emulation=bin_vanilla_emulation   -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Werror -g -O2 -c /tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c
/tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c: In function `display_debug_loc':
/tmp/hpautotest-binutils/bsrc/src/binutils/dwarf.c:2630: warning: long int format, int arg (arg 2)
make[4]: *** [dwarf.o] Error 1

Committed as obvious after testing for cris-elf.  I believe this
is the same problem the other person tried to report.

	* dwarf.c (display_debug_loc): Cast section_end - start to long
	for output format.

Index: dwarf.c
===================================================================
RCS file: /cvs/src/src/binutils/dwarf.c,v
retrieving revision 1.21
diff -p -u -r1.21 dwarf.c
--- dwarf.c	21 Nov 2007 11:58:00 -0000	1.21
+++ dwarf.c	21 Nov 2007 17:46:22 -0000
@@ -2627,7 +2627,7 @@ display_debug_loc (struct dwarf_section 
 
   if (start < section_end)
     warn (_("There are %ld unused bytes at the end of section %s\n"),
-	  section_end - start, section->name);
+	  (long) (section_end - start), section->name);
   return 1;
 }
 

brgds, H-P

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

* Re: PATCH: Have readelf report unused bytes at the end of a .debug_loc   section
  2007-11-21 17:52 ` Hans-Peter Nilsson
@ 2007-11-21 19:32   ` Nick Clifton
  0 siblings, 0 replies; 6+ messages in thread
From: Nick Clifton @ 2007-11-21 19:32 UTC (permalink / raw)
  To: Hans-Peter Nilsson; +Cc: binutils

Hi Hans-Peter,

> 	* dwarf.c (display_debug_loc): Cast section_end - start to long
> 	for output format.

Thanks.

Cheers
   Nick

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

end of thread, other threads:[~2007-11-21 19:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-21 11:57 PATCH: Have readelf report unused bytes at the end of a .debug_loc section Nick Clifton
2007-11-21 13:55 ` Bobby McNulty
2007-11-21 16:37   ` Dave Korn
2007-11-21 16:58     ` Bobby McNulty
2007-11-21 17:52 ` Hans-Peter Nilsson
2007-11-21 19:32   ` Nick Clifton

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