From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27803 invoked by alias); 5 Apr 2006 15:52:55 -0000 Received: (qmail 27795 invoked by uid 22791); 5 Apr 2006 15:52:54 -0000 X-Spam-Check-By: sourceware.org Received: from CPE-144-136-172-108.sa.bigpond.net.au (HELO grove.modra.org) (144.136.172.108) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Apr 2006 15:52:54 +0000 Received: by bubble.grove.modra.org (Postfix, from userid 500) id BB4611DD4C4; Thu, 6 Apr 2006 01:22:50 +0930 (CST) Date: Wed, 05 Apr 2006 15:55:00 -0000 From: Alan Modra To: Eric Botcazou Cc: binutils@gcc.gnu.org, Arnaud Charlet Subject: Re: [PATCH] New option --print-gc-sections Message-ID: <20060405155250.GX9418@bubble.grove.modra.org> Mail-Followup-To: Eric Botcazou , binutils@gcc.gnu.org, Arnaud Charlet References: <200603281131.41402.ebotcazou@adacore.com> <200604050951.19920.ebotcazou@adacore.com> <20060405151011.GV9418@bubble.grove.modra.org> <200604051738.16307.ebotcazou@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604051738.16307.ebotcazou@adacore.com> User-Agent: Mutt/1.4i X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00068.txt.bz2 On Wed, Apr 05, 2006 at 05:38:16PM +0200, Eric Botcazou wrote: > > > + if ((bfd_get_section_flags (abfd, section) & SEC_ALLOC) == 0) > > > + return; > > > + > > > + size = bfd_get_section_size (section); > > > + if (pc >= size) > > > + return; > > > + > > > + found = bfd_find_nearest_line (abfd, section, syms, pc, > > > + &filename, &functionname, &line); > > > +} > > > > It would be better to check that pc is not less than section vma, then > > use "off = pc - vma" for size check and bfd_find_nearest_line. That way > > --section lets you specify a section relative offset in an executable. > > That's precisely what find_address_in_section does, isn't it? Here 'pc' is > already an offset. I'm thinking of "addr2line -e some_exe -j .data 0 4 8 12 16". .data might start at 0x123456789abcdef0 and the user wants to minimize typing. ie. make --section work on both executables and relocatable object files. > > > @@ -276,12 +314,12 @@ process_file (const char *file_name, con > > > bfd_close (abfd); > > > } > > > > > > -int main (int, char **); > > > > Don't delete this. I believe it is there to quash warnings generated by > > some versions of gcc. > > Note that objdump.c doesn't have it. Hmm, well then deleting the prototype is probably OK. -- Alan Modra IBM OzLabs - Linux Technology Centre