[GOLD] fix ppc32 function pointer comparisons

Alan Modra amodra@gmail.com
Fri Nov 30 05:02:00 GMT 2012


Committed.

	* powerpc.c (Target_powerpc::Scan::global): Don't emit relative
	relocs against protected symbols when building 32-bit shared libs.

Index: gold/powerpc.cc
===================================================================
RCS file: /cvs/src/src/gold/powerpc.cc,v
retrieving revision 1.70
diff -u -p -r1.70 powerpc.cc
--- gold/powerpc.cc	30 Nov 2012 04:50:00 -0000	1.70
+++ gold/powerpc.cc	30 Nov 2012 04:54:00 -0000
@@ -3664,11 +3664,15 @@ Target_powerpc<size, big_endian>::Scan::
 		target->copy_reloc(symtab, layout, object,
 				   data_shndx, output_section, gsym, reloc);
 	      }
-	    else if (((size == 32 && r_type == elfcpp::R_POWERPC_ADDR32)
-		      || (size == 64 && r_type == elfcpp::R_PPC64_ADDR64))
-		     && (gsym->can_use_relative_reloc(false)
-			 || (size == 64
-			     && data_shndx == ppc_object->opd_shndx())))
+	    else if ((size == 32
+		      && r_type == elfcpp::R_POWERPC_ADDR32
+		      && gsym->can_use_relative_reloc(false)
+		      && !(gsym->visibility() == elfcpp::STV_PROTECTED
+			   && parameters->options().shared()))
+		     || (size == 64
+			 && r_type == elfcpp::R_PPC64_ADDR64
+			 && (gsym->can_use_relative_reloc(false)
+			     || data_shndx == ppc_object->opd_shndx())))
 	      {
 		Reloc_section* rela_dyn = target->rela_dyn_section(layout);
 		unsigned int dynrel = elfcpp::R_POWERPC_RELATIVE;

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list