public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error
@ 2011-09-23 15:13 Richard Sandiford
  2011-10-13  9:50 ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Sandiford @ 2011-09-23 15:13 UTC (permalink / raw)
  To: binutils

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))

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error
  2011-09-23 15:13 [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error Richard Sandiford
@ 2011-10-13  9:50 ` Nick Clifton
  2011-10-13  9:52   ` Tristan Gingold
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Clifton @ 2011-10-13  9:50 UTC (permalink / raw)
  To: richard.sandiford, Tristan Gingold; +Cc: binutils

Hi Richard,

> Tested on arm-linux-gnueabi.  OK to install?

Approved and applied.


> I'd like to put this on the 2.22 branch too.

Tristan ?


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

Cheers
   Nick


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error
  2011-10-13  9:50 ` Nick Clifton
@ 2011-10-13  9:52   ` Tristan Gingold
  2011-10-13 10:09     ` Nick Clifton
  0 siblings, 1 reply; 4+ messages in thread
From: Tristan Gingold @ 2011-10-13  9:52 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: binutils Development, Nick Clifton


On Oct 13, 2011, at 11:50 AM, Nick Clifton wrote:

> Hi Richard,
> 
>> Tested on arm-linux-gnueabi.  OK to install?
> 
> Approved and applied.
> 
> 
>> I'd like to put this on the 2.22 branch too.
> 
> Tristan ?

Sure, ok.

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error
  2011-10-13  9:52   ` Tristan Gingold
@ 2011-10-13 10:09     ` Nick Clifton
  0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2011-10-13 10:09 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Richard Sandiford, binutils Development

Hi Tristan,

> Sure, ok.

Thanks - I have applied the patch to the branch.

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-10-13 10:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23 15:13 [ARM] Fix bogus 'unresolvable R_ARM_THM_CALL' error Richard Sandiford
2011-10-13  9:50 ` Nick Clifton
2011-10-13  9:52   ` Tristan Gingold
2011-10-13 10:09     ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).