[drow@mvista.com: Re: [hjl@lucon.org: Re: PATCH: Output dwarf debug info only when needed]]

Daniel Jacobowitz drow@mvista.com
Thu Aug 1 06:18:00 GMT 2002


I hate blacklists.


----- Forwarded message from Daniel Jacobowitz <drow@mvista.com> -----

Date: Thu, 1 Aug 2002 08:44:30 -0400
From: Daniel Jacobowitz <drow@mvista.com>
Subject: Re: [hjl@lucon.org: Re: PATCH: Output dwarf debug info only when needed]
To: Nick Clifton <nickc@redhat.com>
Cc: Richard Henderson <rth@redhat.com>, "H . J . Lu" <hjl@lucon.org>,
	binutils@sources.redhat.com
Mail-Followup-To: Nick Clifton <nickc@redhat.com>,
	Richard Henderson <rth@redhat.com>, "H . J . Lu" <hjl@lucon.org>,
	binutils@sources.redhat.com

On Thu, Aug 01, 2002 at 07:35:23AM +0100, Nick Clifton wrote:
> Hi Daniel,
> 
> > Oops, that's right.  How about:
> >   /* We don't need to do anything unless:
> >      - Some debug information was recorded via .file/.loc
> >      - or, we are generating DWARF2 information ourself (--gdwarf2)
> >      - or, there is a user-provided .debug_info section which could
> >        reference the file table in the .debug_line section we generate
> >        below.  */
> >   if (all_segs == NULL
> >       && debug_type != DEBUG_DWARF2
> >       && )
> > 
> > Where the bit after the last && is "there is no user .debug_info"
> > section (which I can't figure out how to say in gas).
> 
> How about:
> 
>         bfd_get_section_by_name (stdoutput, ".debug_info") == NULL

Ah, right, dwarf2dbg is only used for BFD_ASSEMBLER.  Thanks.  This
copy look better?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-08-01  H.J. Lu  <hjl@gnu.org>
            Daniel Jacobowitz  <drow@mvista.com>

	* dwarf2dbg.c (dwarf2_finish): Don't emit unreferenced
	.debug_line section unless it has line information.

Index: dwarf2dbg.c
===================================================================
RCS file: /cvs/src/src/gas/dwarf2dbg.c,v
retrieving revision 1.51
diff -u -p -r1.51 dwarf2dbg.c
--- dwarf2dbg.c	14 Jun 2002 14:08:51 -0000	1.51
+++ dwarf2dbg.c	1 Aug 2002 12:41:09 -0000
@@ -1248,8 +1248,15 @@ dwarf2_finish ()
   segT line_seg;
   struct line_seg *s;
 
-  /* If no debug information was recorded, nothing to do.  */
-  if (all_segs == NULL && files_in_use <= 1)
+  /* We don't need to do anything unless:
+     - Some debug information was recorded via .file/.loc
+     - or, we are generating DWARF2 information ourself (--gdwarf2)
+     - or, there is a user-provided .debug_info section which could
+       reference the file table in the .debug_line section we generate
+       below.  */
+  if (all_segs == NULL
+      && debug_type != DEBUG_DWARF2
+      && bfd_get_section_by_name (stdoutput, ".debug_info") == NULL)
     return;
 
   /* Calculate the size of an address for the target machine.  */

----- End forwarded message -----

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer



More information about the Binutils mailing list