Module Name:    src
Committed By:   matt
Date:           Tue Jul 17 21:37:21 UTC 2012

Modified Files:
        src/external/gpl3/binutils/dist/bfd: elf32-vax.c

Log Message:
Two fixes.  Better PLT pruning (don't emit PLTs for local functions).
If emitting a reloc against a readonly section in a shared image,
cause TEXTREL to be set.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/gpl3/binutils/dist/bfd/elf32-vax.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/binutils/dist/bfd/elf32-vax.c
diff -u src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.5 src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.6
--- src/external/gpl3/binutils/dist/bfd/elf32-vax.c:1.5	Fri Feb 10 01:47:37 2012
+++ src/external/gpl3/binutils/dist/bfd/elf32-vax.c	Tue Jul 17 21:37:21 2012
@@ -973,39 +973,21 @@ elf_vax_adjust_dynamic_symbol (info, h)
   if (h->type == STT_FUNC
       || h->needs_plt)
     {
-      if (! info->shared
-	  && !h->def_dynamic
-	  && !h->ref_dynamic
-	  /* We must always create the plt entry if it was referenced
-	     by a PLTxxO relocation.  In this case we already recorded
-	     it as a dynamic symbol.  */
-	  && h->dynindx == -1)
+      if (h->plt.refcount == 0
+	  || SYMBOL_CALLS_LOCAL (info, 0)
+	  || (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+	      && h->root.type == bfd_link_hash_undefweak))
 	{
 	  /* This case can occur if we saw a PLTxx reloc in an input
 	     file, but the symbol was never referred to by a dynamic
-	     object.  In such a case, we don't actually need to build
-	     a procedure linkage table, and we can just do a PCxx
-	     reloc instead.  */
-	  BFD_ASSERT (h->needs_plt);
+	     object, or if all references were garbage collected..  In
+	     such a case, we don't actually need to build a procedure
+	     linkage table, and we can just do a PCxx reloc instead.  */
 	  h->plt.offset = (bfd_vma) -1;
-	  return TRUE;
-	}
-
-      /* GC may have rendered this entry unused.  */
-      if (h->plt.refcount <= 0)
-	{
 	  h->needs_plt = 0;
-	  h->plt.offset = (bfd_vma) -1;
 	  return TRUE;
 	}
 
-      /* Make sure this symbol is output as a dynamic symbol.  */
-      if (h->dynindx == -1)
-	{
-	  if (! bfd_elf_link_record_dynamic_symbol (info, h))
-	    return FALSE;
-	}
-
       s = bfd_get_section_by_name (dynobj, ".plt");
       BFD_ASSERT (s != NULL);
 
@@ -1751,14 +1733,15 @@ elf_vax_relocate_section (bfd *output_bf
 		    }
 		}
 
-	      if (strcmp (bfd_get_section_name (input_bfd, input_section),
-			   ".text") == 0 ||
-		  (info->shared
-		   && ELF32_R_TYPE(outrel.r_info) != R_VAX_32
-		   && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE
-		   && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY
-		   && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT
-		   && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT))
+	      if (input_section->flags & SEC_READONLY)
+		 info->flags |= DF_TEXTREL;
+
+	      if (input_section->flags & SEC_READONLY
+		  || (ELF32_R_TYPE(outrel.r_info) != R_VAX_32
+		      && ELF32_R_TYPE(outrel.r_info) != R_VAX_RELATIVE
+		      && ELF32_R_TYPE(outrel.r_info) != R_VAX_COPY
+		      && ELF32_R_TYPE(outrel.r_info) != R_VAX_JMP_SLOT
+		      && ELF32_R_TYPE(outrel.r_info) != R_VAX_GLOB_DAT))
 		{
 		  if (h != NULL)
 		    (*_bfd_error_handler)

Reply via email to