From 33bfe77466aaf8e59a3b8c4d99797ad8c8c646fc Mon Sep 17 00:00:00 2001 From: Julian Brown Date: Fri, 15 Apr 2005 16:37:47 +0000 Subject: * bfd/bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype. * bfd/bfd-in2.h: Regenerate. * bfd/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. * ld/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. --- ld/ChangeLog | 10 ++++++++++ ld/emultempl/armelf.em | 12 ++++++++++-- ld/ld.texinfo | 11 +++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) (limited to 'ld') diff --git a/ld/ChangeLog b/ld/ChangeLog index 36fba51..3af8c71 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,13 @@ +2005-04-15 Julian Brown + + * 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. + 2005-04-14 Alan Modra * Makefile.am (NO_WERROR): Define. Use instead of -Wno-error. diff --git a/ld/emultempl/armelf.em b/ld/emultempl/armelf.em index 886cf8b..d380400 100644 --- a/ld/emultempl/armelf.em +++ b/ld/emultempl/armelf.em @@ -32,6 +32,7 @@ static int byteswap_code = 0; static int target1_is_rel = 0${TARGET1_IS_REL}; static char *target2_type = "${TARGET2_TYPE}"; static int fix_v4bx = 0; +static int use_blx = 0; static void gld${EMULATION_NAME}_before_parse (void) @@ -192,7 +193,7 @@ static void arm_elf_create_output_section_statements (void) { bfd_elf32_arm_set_target_relocs (&link_info, target1_is_rel, target2_type, - fix_v4bx); + fix_v4bx, use_blx); } EOF @@ -206,7 +207,8 @@ PARSE_AND_LIST_PROLOGUE=' #define OPTION_TARGET1_REL 303 #define OPTION_TARGET1_ABS 304 #define OPTION_TARGET2 305 -#define OPTION_FIX_V4BX 306 +#define OPTION_FIX_V4BX 306 +#define OPTION_USE_BLX 307 ' PARSE_AND_LIST_SHORTOPTS=p @@ -219,6 +221,7 @@ PARSE_AND_LIST_LONGOPTS=' { "target1-abs", no_argument, NULL, OPTION_TARGET1_ABS}, { "target2", required_argument, NULL, OPTION_TARGET2}, { "fix-v4bx", no_argument, NULL, OPTION_FIX_V4BX}, + { "use-blx", no_argument, NULL, OPTION_USE_BLX}, ' PARSE_AND_LIST_OPTIONS=' @@ -228,6 +231,7 @@ PARSE_AND_LIST_OPTIONS=' fprintf (file, _(" --target1=abs Interpret R_ARM_TARGET1 as R_ARM_ABS32\n")); fprintf (file, _(" --target2= Specify definition of R_ARM_TARGET2\n")); fprintf (file, _(" --fix-v4bx Rewrite BX rn as MOV pc, rn for ARMv4\n")); + fprintf (file, _(" --use-blx Enable use of BLX instructions\n")); ' PARSE_AND_LIST_ARGS_CASES=' @@ -258,6 +262,10 @@ PARSE_AND_LIST_ARGS_CASES=' case OPTION_FIX_V4BX: fix_v4bx = 1; break; + + case OPTION_USE_BLX: + use_blx = 1; + break; ' # We have our own after_open and before_allocation functions, but they call diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 99afaf2..7860e25 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5262,6 +5262,17 @@ linker, which causes v4t @code{BX rM} instructions to be rewritten as In the former case, the switch should not be used, and @samp{R_ARM_V4BX} relocations are ignored. +@cindex USE_BLX +@kindex --use-blx +The @samp{--use-blx} switch enables the linker to use ARM/Thumb +BLX instructions (available on ARMv5t and above) in various +situations. Currently it is used to perform calls via the PLT from Thumb +code using BLX rather than using BX and a mode-switching stub before +each PLT entry. This should lead to such calls executing slightly faster. + +This option is enabled implicitly for SymbianOS, so there is no need to +specify it if you are using that target. + @ifclear GENERIC @lowersections @end ifclear -- cgit v1.1