This is the mail archive of the binutils@sources.redhat.com 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]

[csl-arm] SymbianOS calls via PLT from thumb mode


The SymbianOS PLT does not contain thumb stubs, so we need to use blx to jump 
to the plt entry from thumb mode.
Long-term we want to make this work for all armv5 targets, as discussed here:
http://sourceware.org/ml/binutils/2005-03/msg00438.html

I've applied the attached patch as a Symbian-specific short-term fix to the 
binutils-csl-arm-2005q1-branch.

Paul

2005-03-29  Julian Brown  <julian@codesourcery.com>

 * elf32-arm.c (elf32_arm_final_link_relocate): Use blx to get to
 symbian plt entries from thumb mode.
? bfd/doc/bfd.info
? bfd/doc/bfd.info-1
? gas/doc/as.info
? gas/doc/as.info-1
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.26
diff -c -p -r1.26 elf32-arm.c
*** bfd/elf32-arm.c	22 Mar 2005 15:39:32 -0000	1.26
--- bfd/elf32-arm.c	24 Mar 2005 18:05:56 -0000
*************** elf32_arm_final_link_relocate (reloc_how
*** 2650,2655 ****
--- 2650,2656 ----
  	bfd_signed_vma reloc_signed_min = ~ reloc_signed_max;
  	bfd_vma check;
  	bfd_signed_vma signed_check;
+ 	bfd_boolean thumb_plt_call = FALSE;
  
  	/* Need to refetch the addend and squish the two 11 bit pieces
  	   together.  */
*************** elf32_arm_final_link_relocate (reloc_how
*** 2699,2706 ****
  	    value = (splt->output_section->vma
  		     + splt->output_offset
  		     + h->plt.offset);
! 	    /* Target the Thumb stub before the ARM PLT entry.  */
! 	    value -= 4;
  	    *unresolved_reloc_p = FALSE;
  	  }
  
--- 2700,2719 ----
  	    value = (splt->output_section->vma
  		     + splt->output_offset
  		     + h->plt.offset);
!  	    if (globals->symbian_p)
!  	      {
!  		/* On SymbianOS, we are guaranteed to be using at least ARMv5t.
!  		   Convert the BL to a BLX instruction to call the ARM-mode PLT
!  		   entry.  */
!  		if ((lower_insn & (0x3 << 11)) == 0x3 << 11)
! 		  {
! 		    lower_insn = (lower_insn & ~(0x3 << 11)) | 0x1 << 11;
! 		    thumb_plt_call = TRUE;
! 		  }
!  	      }
!  	    else
!  	      /* Target the Thumb stub before the ARM PLT entry.  */
!  	      value -= PLT_THUMB_STUB_SIZE;
  	    *unresolved_reloc_p = FALSE;
  	  }
  
*************** elf32_arm_final_link_relocate (reloc_how
*** 2724,2731 ****
  	  overflow = TRUE;
  
  #ifndef OLD_ARM_ABI
! 	if (r_type == R_ARM_THM_XPC22
! 	    && ((lower_insn & 0x1800) == 0x0800))
  	  /* For a BLX instruction, make sure that the relocation is rounded up
  	     to a word boundary.  This follows the semantics of the instruction
  	     which specifies that bit 1 of the target address will come from bit
--- 2737,2745 ----
  	  overflow = TRUE;
  
  #ifndef OLD_ARM_ABI
! 	if ((r_type == R_ARM_THM_XPC22
! 	     && ((lower_insn & 0x1800) == 0x0800))
! 	    || thumb_plt_call)
  	  /* For a BLX instruction, make sure that the relocation is rounded up
  	     to a word boundary.  This follows the semantics of the instruction
  	     which specifies that bit 1 of the target address will come from bit

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