public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Sterling Augustine <saugustine@google.com>
To: Binutils <binutils@sourceware.org>,
	ccoutant@gmail.com, 	Alan Modra <amodra@gmail.com>
Subject: [Gold][Powerpc64] Avoid assertion in relocate
Date: Mon, 04 May 2015 18:38:00 -0000	[thread overview]
Message-ID: <CAEG7qUzWFFQ0LVm3FxWy3+VS9oLWWRjH+K6JU9G07wpbJDVwDQ@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 679 bytes --]

Hi Cary,

Under certain conditions that have defied my best test-case reduction,
the .debug_addr section can contain references to functions that don't
have pc relative relocations in a .text section, on all architectures.
Due to the way the powerpc64 builds its address tables, these symbols
don't (and shouldn't) get added to its global_entry_table.

This patch from Alan Modra removes an assertion that the entry is
added to the table, and copes with the condition appropriately.

OK for Gold?

Sterling

ChangeLog

2015-05-04  Alan Modra  <amodra@gmail.com>

* powerpc.cc (Target_powerpc<size, big_endian>::Relocate::relocate): Handle
address not found instead of asserting.

[-- Attachment #2: debug.patch --]
[-- Type: text/x-patch, Size: 893 bytes --]

diff --git a/gold/powerpc.cc b/gold/powerpc.cc
index fddf3fa..3d753b5 100644
--- a/gold/powerpc.cc
+++ b/gold/powerpc.cc
@@ -6836,8 +6836,11 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
 	  && !is_branch_reloc(r_type))
 	{
 	  unsigned int off = target->glink_section()->find_global_entry(gsym);
-	  gold_assert(off != (unsigned int)-1);
-	  value = target->glink_section()->global_entry_address() + off;
+	  if (off != (unsigned int)-1)
+	    {
+	      value = target->glink_section()->global_entry_address() + off;
+	      has_stub_value = true;
+	    }
 	}
       else
 	{
@@ -6859,8 +6862,8 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
 						  rela.get_r_addend());
 	  gold_assert(off != invalid_address);
 	  value = stub_table->stub_address() + off;
+	  has_stub_value = true;
 	}
-      has_stub_value = true;
     }
 
   if (r_type == elfcpp::R_POWERPC_GOT16

             reply	other threads:[~2015-05-04 18:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04 18:38 Sterling Augustine [this message]
2015-05-05  0:14 ` Alan Modra
2015-05-05  0:32   ` Sterling Augustine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAEG7qUzWFFQ0LVm3FxWy3+VS9oLWWRjH+K6JU9G07wpbJDVwDQ@mail.gmail.com \
    --to=saugustine@google.com \
    --cc=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).