From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17392 invoked by alias); 5 Apr 2006 15:34:25 -0000 Received: (qmail 17384 invoked by uid 22791); 5 Apr 2006 15:34:25 -0000 X-Spam-Check-By: sourceware.org Received: from province.act-europe.fr (HELO province.act-europe.fr) (212.157.227.214) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 05 Apr 2006 15:34:23 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-province.act-europe.fr (Postfix) with ESMTP id F15774ACFB; Wed, 5 Apr 2006 17:34:19 +0200 (CEST) Received: from province.act-europe.fr ([127.0.0.1]) by localhost (province.act-europe.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 07402-09; Wed, 5 Apr 2006 17:34:19 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by province.act-europe.fr (Postfix) with ESMTP id 89D8D4ACD7; Wed, 5 Apr 2006 17:34:19 +0200 (CEST) From: Eric Botcazou To: Alan Modra Subject: Re: [PATCH] New option --print-gc-sections Date: Wed, 05 Apr 2006 15:52:00 -0000 User-Agent: KMail/1.7.1 Cc: binutils@gcc.gnu.org, Arnaud Charlet References: <200603281131.41402.ebotcazou@adacore.com> <200604050951.19920.ebotcazou@adacore.com> <20060405151011.GV9418@bubble.grove.modra.org> In-Reply-To: <20060405151011.GV9418@bubble.grove.modra.org> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200604051738.16307.ebotcazou@adacore.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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/msg00067.txt.bz2 > > + 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. > > @@ -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. -- Eric Botcazou