[PATCH] Enable use of ARMv5t BLX for Thumb-mode calls via PLT

Julian Brown julian@codesourcery.com
Tue Apr 12 21:14:00 GMT 2005


Daniel Jacobowitz wrote:
> On Mon, Apr 11, 2005 at 07:55:12PM +0100, Julian Brown wrote:
> 
>>With this patch, the option "--use-thumb-blx" can be passed to the 
>>linker to enable the use of the BLX instruction when the target supports 
>>it. The format of the PLT itself isn't changed by this patch: there is 
>>still a Thumb stub before each ARM PLT entry, but it is now unused. The 
>>ARM mode entry is called directly instead.
> 
> 
> The Thumb stub is never referenced from outside of the object.  So, if
> we aren't going to branch to it, no point in emitting it either.  Patch
> looks plausible to me...

This is a new version of the patch which doesn't emit Thumb stubs before 
PLT entries if BLX is being used to call them, and also renames the 
switch to --use-blx as per Paul's suggestion.

Re-tested on arm-none-eabi and arm-none-symbianelf.

OK to apply?

ChangeLog:

bfd:
   * bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype.
   * bfd-in2.h: Regenerate.
   * elf32-arm.c (elf32_arm_link_hash_table): New field, 'use_blx'.
   (elf32_arm_link_hash_table_create): Initialise fix_v4bx, use_blx.
   (bfd_elf32_arm_set_target_relocs): Handle use_blx.
   (elf32_arm_final_link_relocate): Use Thumb BLX for R_ARM_THM_PC22
   relocations if requested to.
   (allocate_dynrelocs): Don't count size of omitted Thumb stubs based on
   use_blx rather than symbian_p.
   (elf32_arm_finish_dynamic_symbol): Don't output Thumb PLT stubs if
   use_blx is in effect.
   (elf32_arm_symbian_link_hash_table_create): Enable use_blx by default
   for SymbianOS.

ld:
   * ld.texinfo: Document --use-blx.
   * emultempl/armelf.em (use_blx): New variable.
   (arm_elf_create_output_section_statements): Communicate value of
   use_blx to bfd.
   (PARSE_AND_LIST_PROLOGUE): Add OPTION_USE_BLX.
   (PARSE_AND_LIST_OPTIONS): Add --use-blx option.
   (PARSE_AND_LIST_ARGS_CASES): Add OPTION_USE_BLX case.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch-4
URL: <https://sourceware.org/pipermail/binutils/attachments/20050412/816a0ca9/attachment.ksh>


More information about the Binutils mailing list