public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Gold][Powerpc64] Avoid assertion in relocate
@ 2015-05-04 18:38 Sterling Augustine
  2015-05-05  0:14 ` Alan Modra
  0 siblings, 1 reply; 3+ messages in thread
From: Sterling Augustine @ 2015-05-04 18:38 UTC (permalink / raw)
  To: Binutils, ccoutant, Alan Modra

[-- 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Gold][Powerpc64] Avoid assertion in relocate
  2015-05-04 18:38 [Gold][Powerpc64] Avoid assertion in relocate Sterling Augustine
@ 2015-05-05  0:14 ` Alan Modra
  2015-05-05  0:32   ` Sterling Augustine
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Modra @ 2015-05-05  0:14 UTC (permalink / raw)
  To: Sterling Augustine; +Cc: Binutils, ccoutant

On Mon, May 04, 2015 at 11:38:03AM -0700, Sterling Augustine wrote:
> This patch from Alan Modra removes an assertion that the entry is
> added to the table, and copes with the condition appropriately.

Already committed 6ec65f28.  Note also the followup faa2211d which
adds back the assertion for non-debug, and handles the analagous case
for plt call stubs as 6ec65f28 did for global entry stubs.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Gold][Powerpc64] Avoid assertion in relocate
  2015-05-05  0:14 ` Alan Modra
@ 2015-05-05  0:32   ` Sterling Augustine
  0 siblings, 0 replies; 3+ messages in thread
From: Sterling Augustine @ 2015-05-05  0:32 UTC (permalink / raw)
  To: Sterling Augustine, Binutils, ccoutant

On Mon, May 4, 2015 at 5:14 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, May 04, 2015 at 11:38:03AM -0700, Sterling Augustine wrote:
>> This patch from Alan Modra removes an assertion that the entry is
>> added to the table, and copes with the condition appropriately.
>
> Already committed 6ec65f28.  Note also the followup faa2211d which
> adds back the assertion for non-debug, and handles the analagous case
> for plt call stubs as 6ec65f28 did for global entry stubs.

Thanks Alan.

>
> --
> Alan Modra
> Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-05-05  0:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 18:38 [Gold][Powerpc64] Avoid assertion in relocate Sterling Augustine
2015-05-05  0:14 ` Alan Modra
2015-05-05  0:32   ` Sterling Augustine

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).