From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17725 invoked by alias); 29 Mar 2005 15:00:45 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 17627 invoked from network); 29 Mar 2005 15:00:35 -0000 Received: from unknown (HELO mail.codesourcery.com) (65.74.133.9) by sourceware.org with SMTP; 29 Mar 2005 15:00:35 -0000 Received: (qmail 28371 invoked from network); 29 Mar 2005 15:00:34 -0000 Received: from localhost (HELO wren.home) (paul@127.0.0.1) by mail.codesourcery.com with SMTP; 29 Mar 2005 15:00:34 -0000 From: Paul Brook Organization: CodeSourcery To: binutils@sources.redhat.com Subject: [csl-arm] SymbianOS calls via PLT from thumb mode Date: Tue, 29 Mar 2005 16:20:00 -0000 User-Agent: KMail/1.7.2 Cc: Julian Brown MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_O2WSCkqfWo9TBUh" Message-Id: <200503291600.30471.paul@codesourcery.com> X-SW-Source: 2005-03/txt/msg00860.txt.bz2 --Boundary-00=_O2WSCkqfWo9TBUh Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 521 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 * elf32-arm.c (elf32_arm_final_link_relocate): Use blx to get to symbian plt entries from thumb mode. --Boundary-00=_O2WSCkqfWo9TBUh Content-Type: text/x-diff; charset="us-ascii"; name="patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch" Content-length: 2477 ? 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 --Boundary-00=_O2WSCkqfWo9TBUh--