From 27e55c4d0b94f5d358385b9641d26b84ee611768 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Tue, 20 Mar 2007 20:19:07 +0000 Subject: 2007-03-20 Paul Brook ld/ * emultempl/armelf.em (pic_veneer): New variable. (PARSE_AND_LIST_PROLOGUE): Add OPTION_PIC_VENEER. (PARSE_AND_LIST_ARGS_CASES): Ditto. (PARSE_AND_LIST_LONGOPTS): Add "pic-veneer". (PARSE_AND_LIST_OPTIONS): Ditto. * ld.texinfo: Document --pic-veneer. ld/testsuite/ * ld-arm/arm-elf.exp (ld-arm/arm-elf.exp): Add arm-pic-veneer. * ld-arm/arm-pic-veneer.d: New test. * ld-arm/arm-pic-veneer.s: New test. bfd/ * bfd-in.h (bfd_elf32_arm_set_target_relocs): Update prototype. * bfd-in2.h: Regenerate. * elf32-arm.c (elf32_arm_link_hash_table): Add pic_veneer. (record_arm_to_thumb_glue): Use globals->pic_veneer. (elf32_arm_create_thumb_stub): Ditto. (bfd_elf32_arm_set_target_relocs): Set globals->pic_veneer. --- bfd/elf32-arm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'bfd/elf32-arm.c') diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 3be85b1..be10923 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -2191,6 +2191,9 @@ struct elf32_arm_link_hash_table /* Global counter for the number of fixes we have emitted. */ int num_vfp11_fixes; + /* Nonzero to force PIC branch veneers. */ + int pic_veneer; + /* The number of bytes in the initial entry in the PLT. */ bfd_size_type plt_header_size; @@ -2714,7 +2717,8 @@ record_arm_to_thumb_glue (struct bfd_link_info * link_info, free (tmp_name); - if ((link_info->shared || globals->root.is_relocatable_executable)) + if (link_info->shared || globals->root.is_relocatable_executable + || globals->pic_veneer) size = ARM2THUMB_PIC_GLUE_SIZE; else size = ARM2THUMB_STATIC_GLUE_SIZE; @@ -3868,7 +3872,7 @@ bfd_elf32_arm_set_target_relocs (struct bfd *output_bfd, int fix_v4bx, int use_blx, bfd_arm_vfp11_fix vfp11_fix, - int no_enum_warn) + int no_enum_warn, int pic_veneer) { struct elf32_arm_link_hash_table *globals; @@ -3889,6 +3893,7 @@ bfd_elf32_arm_set_target_relocs (struct bfd *output_bfd, globals->fix_v4bx = fix_v4bx; globals->use_blx |= use_blx; globals->vfp11_fix = vfp11_fix; + globals->pic_veneer = pic_veneer; elf32_arm_tdata (output_bfd)->no_enum_size_warning = no_enum_warn; } @@ -4127,7 +4132,8 @@ elf32_arm_create_thumb_stub (struct bfd_link_info * info, --my_offset; myh->root.u.def.value = my_offset; - if ((info->shared || globals->root.is_relocatable_executable)) + if (info->shared || globals->root.is_relocatable_executable + || globals->pic_veneer) { /* For relocatable objects we can't use absolute addresses, so construct the address from a relative offset. */ -- cgit v1.1