From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12957 invoked by alias); 28 Feb 2014 04:38:40 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 12946 invoked by uid 89); 28 Feb 2014 04:38:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pb0-f45.google.com Received: from mail-pb0-f45.google.com (HELO mail-pb0-f45.google.com) (209.85.160.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 28 Feb 2014 04:38:38 +0000 Received: by mail-pb0-f45.google.com with SMTP id un15so229142pbc.32 for ; Thu, 27 Feb 2014 20:38:36 -0800 (PST) X-Received: by 10.68.134.8 with SMTP id pg8mr1102711pbb.84.1393562316385; Thu, 27 Feb 2014 20:38:36 -0800 (PST) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id ha2sm1480080pbb.8.2014.02.27.20.38.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 27 Feb 2014 20:38:35 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id DD277EA00D2; Fri, 28 Feb 2014 15:08:30 +1030 (CST) Date: Fri, 28 Feb 2014 04:38:00 -0000 From: Alan Modra To: Ed Maste Cc: binutils@sourceware.org Subject: Re: gas emits incorrect .debug_line prologue header length for 64-bit DWARF Message-ID: <20140228043830.GH14922@bubble.grove.modra.org> Mail-Followup-To: Ed Maste , binutils@sourceware.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2014-02/txt/msg00174.txt.bz2 On Thu, Feb 27, 2014 at 01:03:23PM -0500, Ed Maste wrote: > The header_length field is supposed to be the number of bytes > following the field to the first byte of the line number program, but > dwarf2dbg.c:out_debug_line has hard-coded constants that are correct > only for 32-bit DWARF. > > I've fixed it in FreeBSD here in SVN r256692: > http://svnweb.freebsd.org/base?view=revision&revision=256692 Thanks for the heads-up. I'm committing the following to mainline that calculates the length as a simple difference of two symbols. * dwarf2dbg.c (out_debug_line): Correct .debug_line header_length field for 64-bit dwarf. diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c index 6d6ee2d..ac6148f 100644 --- a/gas/dwarf2dbg.c +++ b/gas/dwarf2dbg.c @@ -1515,7 +1515,7 @@ static void out_debug_line (segT line_seg) { expressionS exp; - symbolS *prologue_end; + symbolS *prologue_start, *prologue_end; symbolS *line_end; struct line_seg *s; int sizeof_offset; @@ -1527,10 +1527,14 @@ out_debug_line (segT line_seg) out_two (DWARF2_LINE_VERSION); /* Length of the prologue following this length. */ + prologue_start = symbol_temp_make (); prologue_end = symbol_temp_make (); + exp.X_op = O_subtract; exp.X_add_symbol = prologue_end; - exp.X_add_number = - (4 + 2 + 4); + exp.X_op_symbol = prologue_start; + exp.X_add_number = 0; emit_expr (&exp, sizeof_offset); + symbol_set_value_now (prologue_start); /* Parameters of the state machine. */ out_byte (DWARF2_LINE_MIN_INSN_LENGTH); -- Alan Modra Australia Development Lab, IBM