From 69c5861ee1e736adf16998ba505b5054fc633f3f Mon Sep 17 00:00:00 2001 From: Christophe Lyon Date: Fri, 17 Apr 2009 13:04:41 +0000 Subject: 2009-04-17 Christophe Lyon bfd/ * elf32-arm.c (elf32_arm_size_stubs): Handle long branches through PLT entries to an undefined symbol when generating a shared library. testsuite/ * ld-arm/arm-elf.exp: Add new test farcall-mixed-lib. * ld-arm/farcall-mixed-lib.d: Update expected output. * ld-arm/farcall-mixed-lib1.s: New file. * ld-arm/farcall-mixed-lib2.s: New file. --- bfd/ChangeLog | 6 ++++++ bfd/elf32-arm.c | 29 +++++++++++++++++++++++------ 2 files changed, 29 insertions(+), 6 deletions(-) (limited to 'bfd') diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 0739367..894c497 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2009-04-17 Christophe Lyon + + * elf32-arm.c (elf32_arm_size_stubs): Handle long branches through + PLT entries to an undefined symbol when generating a shared + library. + 2009-04-17 Nick Clifton PR 9909 diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 99beb9e..2f49b7e 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -3832,12 +3832,29 @@ elf32_arm_size_stubs (bfd *output_bfd, + sym_sec->output_offset + sym_sec->output_section->vma); } - else if (hash->root.root.type == bfd_link_hash_undefweak - || hash->root.root.type == bfd_link_hash_undefined) - /* For a shared library, these will need a PLT stub, - which is treated separately. - For absolute code, they cannot be handled. */ - continue; + else if ((hash->root.root.type == bfd_link_hash_undefined) + || (hash->root.root.type == bfd_link_hash_undefweak)) + { + /* For a shared library, use the PLT stub as + target address to decide whether a long + branch stub is needed. + For absolute code, they cannot be handled. */ + struct elf32_arm_link_hash_table *globals = + elf32_arm_hash_table (info); + + if (globals->splt != NULL && hash != NULL + && hash->root.plt.offset != (bfd_vma) -1) + { + sym_sec = globals->splt; + sym_value = hash->root.plt.offset; + if (sym_sec->output_section != NULL) + destination = (sym_value + + sym_sec->output_offset + + sym_sec->output_section->vma); + } + else + continue; + } else { bfd_set_error (bfd_error_bad_value); -- cgit v1.1