From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13455 invoked by alias); 17 Feb 2014 09:19:35 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 13442 invoked by uid 89); 17 Feb 2014 09:19:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 17 Feb 2014 09:19:33 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 25F07116671; Mon, 17 Feb 2014 04:19:31 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 4wZuJ+P2xw-l; Mon, 17 Feb 2014 04:19:31 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 0147511666C; Mon, 17 Feb 2014 04:19:30 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id B56BCE0644; Mon, 17 Feb 2014 10:19:29 +0100 (CET) Date: Mon, 17 Feb 2014 09:19:00 -0000 From: Joel Brobecker To: Mark Wielaard Cc: gdb-patches@sourceware.org Subject: Re: [RFA/DWARF] constant class of DW_AT_high_pc is offset for version >=4 only. Message-ID: <20140217091929.GB5006@adacore.com> References: <1392478818-30320-1-git-send-email-brobecker@adacore.com> <1392578342.21975.12.camel@bordewijk.wildebeest.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1392578342.21975.12.camel@bordewijk.wildebeest.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-02/txt/msg00529.txt.bz2 Hi Mark, > Sorry about that. I read the spec as disallowing anything except > DW_FORM_addr to encode class address. And since before DWARF4 > DW_AT_high_pc only allowed class address it hadn't occurred to me that > it could have been encoded differently. I do think this really is a bug > in the compiler that generated this. Not to worry! I did find the use of data4 for a high_pc to be unusual, for sure, and had to read the DWARF standard a couple of times to make sure there was no such restriction. I'm pretty sure that I would have made the same decision. > > This patch fixes it by ammending a bit the changes from the commit > > mentioned above to use the new interpretation of a relative address > > only when the CU's DWARF version is 4 or greater. > > That should work fine. GCC at least doesn't generate DW_AT_high_pc > attributes as offsets (constant class) unless it generates DWARF4+. Yes, I forgot to mention that I double-checked that it wouldn't break GCC-compiled binaries. Thanks! -- Joel PS: Since I have you - do you think binutils would need the same sort of change? I thought so too, when I looked at the code, but I couldn't get readelf to print the wrong address. Do you happen to know?