From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9473 invoked by alias); 18 Oct 2013 08:13:22 -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 9461 invoked by uid 89); 18 Oct 2013 08:13:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from mail-pd0-f180.google.com (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 18 Oct 2013 08:13:21 +0000 Received: by mail-pd0-f180.google.com with SMTP id p10so1990176pdj.11 for ; Fri, 18 Oct 2013 01:13:19 -0700 (PDT) X-Received: by 10.68.218.3 with SMTP id pc3mr1802875pbc.71.1382083999636; Fri, 18 Oct 2013 01:13:19 -0700 (PDT) Received: from bubble.grove.modra.org ([101.166.26.37]) by mx.google.com with ESMTPSA id ve9sm714340pbc.19.2013.10.18.01.13.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 18 Oct 2013 01:13:18 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id F27EAEA006C; Fri, 18 Oct 2013 18:43:13 +1030 (CST) Date: Fri, 18 Oct 2013 08:13:00 -0000 From: Alan Modra To: Jan Beulich Cc: binutils@sourceware.org Subject: Re: your change "bfd_find_nearest_line without debug info" Message-ID: <20131018081313.GU20756@bubble.grove.modra.org> Mail-Followup-To: Jan Beulich , binutils@sourceware.org References: <5260FF1602000078000FBF97@nat28.tlf.novell.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5260FF1602000078000FBF97@nat28.tlf.novell.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00260.txt.bz2 On Fri, Oct 18, 2013 at 08:27:50AM +0100, Jan Beulich wrote: > --- binutils-2.23.2/bfd/elflink.c > +++ 2.23.2/bfd/elflink.c > @@ -7457,6 +7457,7 @@ struct elf_outext_info > bfd_boolean localsyms; > bfd_boolean need_second_pass; > bfd_boolean second_pass; > + bfd_boolean file_sym_done; > struct elf_final_link_info *flinfo; > }; > > @@ -8660,6 +8661,22 @@ elf_link_output_extsym (struct bfd_hash_ > || h->root.type == bfd_link_hash_defweak) > && h->root.u.def.section->output_section != NULL)) > return TRUE; > + > + if (!eoinfo->file_sym_done > + && (eoinfo->second_pass ? eoinfo->flinfo->filesym_count == 1 > + : eoinfo->flinfo->filesym_count > 1)) > + { > + /* Output a FILE symbol so that following locals are not associated > + with the wrong input file. */ > + memset (&sym, 0, sizeof (sym)); > + sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); > + sym.st_shndx = SHN_ABS; > + if (!elf_link_output_sym (eoinfo->flinfo, NULL, &sym, > + bfd_und_section_ptr, NULL)) > + return FALSE; > + > + eoinfo->file_sym_done = TRUE; > + } > } > else > { > @@ -10907,17 +10924,6 @@ bfd_elf_final_link (bfd *abfd, struct bf > } > } > > - /* Output a FILE symbol so that following locals are not associated > - with the wrong input file. */ > - memset (&elfsym, 0, sizeof (elfsym)); > - elfsym.st_info = ELF_ST_INFO (STB_LOCAL, STT_FILE); > - elfsym.st_shndx = SHN_ABS; > - > - if (flinfo.filesym_count > 1 > - && !elf_link_output_sym (&flinfo, NULL, &elfsym, > - bfd_und_section_ptr, NULL)) > - return FALSE; > - > /* Output any global symbols that got converted to local in a > version script or due to symbol visibility. We do this in a > separate step since ELF requires all local symbols to appear > @@ -10929,15 +10935,11 @@ bfd_elf_final_link (bfd *abfd, struct bf > eoinfo.localsyms = TRUE; > eoinfo.need_second_pass = FALSE; > eoinfo.second_pass = FALSE; > + eoinfo.file_sym_done = FALSE; > bfd_hash_traverse (&info->hash->table, elf_link_output_extsym, &eoinfo); > if (eoinfo.failed) > return FALSE; > > - if (flinfo.filesym_count == 1 > - && !elf_link_output_sym (&flinfo, NULL, &elfsym, > - bfd_und_section_ptr, NULL)) > - return FALSE; > - > if (eoinfo.need_second_pass) > { > eoinfo.second_pass = TRUE; > Looks good to me. -- Alan Modra Australia Development Lab, IBM