PR ld/3107

Daniel Jacobowitz drow@false.org
Wed Nov 1 20:01:00 GMT 2006


On Tue, Oct 31, 2006 at 10:55:07PM -0500, Daniel Jacobowitz wrote:
> Do I have to duplicate the logic to determine whether a symbol will get
> a PLT entry?  It's rather too convoluted to move it out of
> adjust_dynamic_symbol.

Alan suggested that I in fact do have to, and pretty much wrote this
patch for me.  I've tested it with a full glibc testsuite run using an
ARM glibc and -mthumb, and then committed it.

-- 
Daniel Jacobowitz
CodeSourcery

2006-11-01  Alan Modra  <amodra@bigpond.net.au>

	* elf32-arm.c (bfd_elf32_arm_process_before_allocation): Correct
	check for PLT usage.

Index: elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.97
diff -u -p -r1.97 elf32-arm.c
--- elf32-arm.c	19 Oct 2006 02:10:41 -0000	1.97
+++ elf32-arm.c	1 Nov 2006 19:05:31 -0000
@@ -2934,9 +2934,19 @@ bfd_elf32_arm_process_before_allocation 
 	  if (h == NULL)
 	    continue;
 
-	  /* If the call will go through a PLT entry then we do not need
-	     glue.  */
-	  if (globals->splt != NULL && h->plt.offset != (bfd_vma) -1)
+	  /* If the call will go through a PLT entry then we do not
+	     need glue.  We have to do a fairly complicated check
+	     here, since we don't determine this finally (by setting
+	     plt.offset) until later; this test should be kept in sync
+	     with elf32_arm_adjust_dynamic_symbol.  */
+	  if (globals->splt != NULL
+	      && h->plt.refcount > 0
+	      && (h->type == STT_FUNC
+		  || h->type == STT_ARM_TFUNC
+		  || h->needs_plt)
+	      && !SYMBOL_CALLS_LOCAL (link_info, h)
+	      && !(ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
+		   && h->root.type == bfd_link_hash_undefweak))
 	    continue;
 
 	  switch (r_type)



More information about the Binutils mailing list