From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 115532 invoked by alias); 28 Apr 2015 07:27:02 -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 115521 invoked by uid 89); 28 Apr 2015 07:27:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f181.google.com Received: from mail-pd0-f181.google.com (HELO mail-pd0-f181.google.com) (209.85.192.181) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 28 Apr 2015 07:27:00 +0000 Received: by pdbqa5 with SMTP id qa5so155243037pdb.1 for ; Tue, 28 Apr 2015 00:26:57 -0700 (PDT) X-Received: by 10.68.229.136 with SMTP id sq8mr29816683pbc.160.1430206017813; Tue, 28 Apr 2015 00:26:57 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-160-155-134.oycza5.sa.bigpond.net.au. [58.160.155.134]) by mx.google.com with ESMTPSA id bn7sm4908125pac.22.2015.04.28.00.26.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Apr 2015 00:26:57 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id D59B9EA017E; Tue, 28 Apr 2015 16:56:52 +0930 (ACST) Date: Tue, 28 Apr 2015 07:27:00 -0000 From: Alan Modra To: binutils@sourceware.org Subject: Re: PowerPC gold assertion on missing global entry stub Message-ID: <20150428072652.GH12627@bubble.grove.modra.org> Mail-Followup-To: binutils@sourceware.org References: <20150428041510.GF12627@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150428041510.GF12627@bubble.grove.modra.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg00429.txt.bz2 On Tue, Apr 28, 2015 at 01:45:10PM +0930, Alan Modra wrote: > * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert > on missing global entry stub due to bogus debug info. Completely removing the assert probably wasn't the best idea, so reinstate it for allocated sections. Also cope with debug info potentially referring to a missing plt call stub. And a tidy. find_global_entry now returns an Address, so make temps holding the return value of type Address, and compare against invalid_address. * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather than unsigned int for find_global_entry result temp. Compare against invalid_address. (Target_powerpc::do_plt_address_for_global): Likewise. (Target_powerpc::Relocate::relocate): Likewise. Don't assert on plt call stub existence for debug info. Do assert for plt and global entry stub existence if an alloc section. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 3d753b5..9a0bd9d 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -6835,8 +6835,8 @@ Target_powerpc::Relocate::relocate( && !parameters->options().output_is_position_independent() && !is_branch_reloc(r_type)) { - unsigned int off = target->glink_section()->find_global_entry(gsym); - if (off != (unsigned int)-1) + Address off = target->glink_section()->find_global_entry(gsym); + if (off != invalid_address) { value = target->glink_section()->global_entry_address() + off; has_stub_value = true; @@ -6852,18 +6852,26 @@ Target_powerpc::Relocate::relocate( if (target->stub_tables().size() != 0) stub_table = target->stub_tables()[0]; } - gold_assert(stub_table != NULL); - Address off; - if (gsym != NULL) - off = stub_table->find_plt_call_entry(object, gsym, r_type, - rela.get_r_addend()); - else - off = stub_table->find_plt_call_entry(object, r_sym, r_type, - rela.get_r_addend()); - gold_assert(off != invalid_address); - value = stub_table->stub_address() + off; - has_stub_value = true; + if (stub_table != NULL) + { + Address off; + if (gsym != NULL) + off = stub_table->find_plt_call_entry(object, gsym, r_type, + rela.get_r_addend()); + else + off = stub_table->find_plt_call_entry(object, r_sym, r_type, + rela.get_r_addend()); + if (off != invalid_address) + { + value = stub_table->stub_address() + off; + has_stub_value = true; + } + } } + // We don't care too much about bogus debug references to + // non-local functions, but otherwise there had better be a plt + // call stub or global entry stub as appropriate. + gold_assert(has_stub_value || !(os->flags() & elfcpp::SHF_ALLOC)); } if (r_type == elfcpp::R_POWERPC_GOT16 @@ -8232,8 +8240,8 @@ Target_powerpc::do_dynsym_value(const Symbol* gsym) const } else if (this->abiversion() >= 2) { - unsigned int off = this->glink_section()->find_global_entry(gsym); - if (off != (unsigned int)-1) + Address off = this->glink_section()->find_global_entry(gsym); + if (off != invalid_address) return this->glink_section()->global_entry_address() + off; } gold_unreachable(); @@ -8282,8 +8290,8 @@ Target_powerpc::do_plt_address_for_global( } else if (this->abiversion() >= 2) { - unsigned int off = this->glink_section()->find_global_entry(gsym); - if (off != (unsigned int)-1) + Address off = this->glink_section()->find_global_entry(gsym); + if (off != invalid_address) return this->glink_section()->global_entry_address() + off; } gold_unreachable(); -- Alan Modra Australia Development Lab, IBM