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]

[ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error


Some Ubuntu packages were failing to link on ARM because of bogus errors like:

   unresolvable R_ARM_THM_CALL relocation against symbol 'foo'

They occured in situations where we had an out-of-range Thumb-2 call
to foo's PLT entry.  The linker correctly redirects the call to a stub,
but it doesn't then record that the relocation has been statically resolved.

(Of course, when we use a stub, the branch to the stub itself is always
statically resolved.  In those cases we want to know whether the stub's
target is statically resolved or not.)

Tested on arm-linux-gnueabi.  OK to install?  I'd like to put this
on the 2.22 branch too.

Richard


bfd/
	* elf32-arm.c (elf32_arm_final_link_relocate): Mark PLT calls via
	stubs as resolved.

Index: bfd/elf32-arm.c
===================================================================
--- bfd/elf32-arm.c	2011-09-07 13:51:18.000000000 +0100
+++ bfd/elf32-arm.c	2011-09-07 14:01:56.128934365 +0100
@@ -8226,9 +8226,13 @@ elf32_arm_final_link_relocate (reloc_how
 							 rel, globals,
 							 stub_type);
 		  if (stub_entry != NULL)
-		    value = (stub_entry->stub_offset
-			     + stub_entry->stub_sec->output_offset
-			     + stub_entry->stub_sec->output_section->vma);
+		    {
+		      value = (stub_entry->stub_offset
+			       + stub_entry->stub_sec->output_offset
+			       + stub_entry->stub_sec->output_section->vma);
+		      if (plt_offset != (bfd_vma) -1)
+			*unresolved_reloc_p = FALSE;
+		    }
 		}
 	      else
 		{
@@ -8653,9 +8657,13 @@ elf32_arm_final_link_relocate (reloc_how
 						       rel, globals,
 						       stub_type);
 		if (stub_entry != NULL)
-		  value = (stub_entry->stub_offset
-			   + stub_entry->stub_sec->output_offset
-			   + stub_entry->stub_sec->output_section->vma);
+		  {
+		    value = (stub_entry->stub_offset
+			     + stub_entry->stub_sec->output_offset
+			     + stub_entry->stub_sec->output_section->vma);
+		    if (plt_offset != (bfd_vma) -1)
+		      *unresolved_reloc_p = FALSE;
+		  }
 
 		/* If this call becomes a call to Arm, force BLX.  */
 		if (globals->use_blx && (r_type == R_ARM_THM_CALL))


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