[PATCH][GOLD] Generate PLTs for the same sets of relocation types as ld.

Doug Kwan (關振德) dougkwan@google.com
Fri Jan 29 22:41:00 GMT 2010


Hi,

    This patch changes Target_arm::Scan::global so that we generate
PLTs for the same set of relocation types as ld.  Previously we did
not use PLTs for R_ARM_PREL31 but ld does.  I also simplied the code a
bit by removing a check for calling to assembly functions without
proper symbol type annotations.

-Doug

2010-01-29  Doug Kwan  <dougkwan@google.com>

        * arm.cc (Target_arm::Scan::global): General PLTs for the same set
        of relocation types as ld.
-------------- next part --------------
? gold/autom4te.cache
Index: gold/arm.cc
===================================================================
RCS file: /cvs/src/src/gold/arm.cc,v
retrieving revision 1.70
diff -u -u -p -r1.70 arm.cc
--- gold/arm.cc	29 Jan 2010 22:16:17 -0000	1.70
+++ gold/arm.cc	29 Jan 2010 22:30:29 -0000
@@ -6792,9 +6792,6 @@ Target_arm<big_endian>::Scan::global(Sym
       break;
 
     case elfcpp::R_ARM_REL32:
-      break;
-
-    case elfcpp::R_ARM_PREL31:
       {
 	// Make a dynamic relocation if necessary.
 	int flags = Symbol::NON_PIC_REF;
@@ -6821,26 +6818,9 @@ Target_arm<big_endian>::Scan::global(Sym
     case elfcpp::R_ARM_THM_JUMP19:
     case elfcpp::R_ARM_CALL:
     case elfcpp::R_ARM_THM_CALL:
-
-      if (Target_arm<big_endian>::Scan::symbol_needs_plt_entry(gsym))
-	target->make_plt_entry(symtab, layout, gsym);
-      else
-	{
-	   // Check to see if this is a function that would need a PLT
-	   // but does not get one because the function symbol is untyped.
-	   // This happens in assembly code missing a proper .type directive.
-	  if ((!gsym->is_undefined() || parameters->options().shared())
-	      && !parameters->doing_static_link()
-	      && gsym->type() == elfcpp::STT_NOTYPE
-	      && (gsym->is_from_dynobj()
-		  || gsym->is_undefined()
-		  || gsym->is_preemptible()))
-	    gold_error(_("%s is not a function."),
-		       gsym->demangled_name().c_str());
-	}
-      break;
-
     case elfcpp::R_ARM_PLT32:
+    case elfcpp::R_ARM_PREL31:
+    case elfcpp::R_ARM_PC24:
       // If the symbol is fully resolved, this is just a relative
       // local reloc.  Otherwise we need a PLT entry.
       if (gsym->final_value_is_known())


More information about the Binutils mailing list