This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Gold][Powerpc64] Avoid assertion in relocate


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]