From: Tristan Gingold Date: Wed, 14 Jan 2009 09:13:49 +0000 (+0000) Subject: Backport of: X-Git-Tag: binutils-2_19_1~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5fb41c40452a58b095dc436a8596f870307ee189;p=thirdparty%2Fbinutils-gdb.git Backport of: bfd: 2008-11-24 Joseph Myers * elf32-arm.c (elf32_arm_final_link_relocate): Do not turn branches to undefine weak symbols into branches to the next instruction if creating PLT entries for those symbols. ld/testsuite: 2008-11-24 Joseph Myers * ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New. * ld-arm/arm-elf.exp: Run thumb2-bl-undefweak test. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 51362e3efa0..e137b000b67 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2009-01-14 Joseph Myers + + * elf32-arm.c (elf32_arm_final_link_relocate): Do not turn + branches to undefine weak symbols into branches to the next + instruction if creating PLT entries for those symbols. + 2008-12-23 Nick Clifton * Import this patch from the mainline: diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index da1ac24d34a..8ce028e6be4 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -6381,8 +6381,9 @@ elf32_arm_final_link_relocate (reloc_howto_type * howto, int thumb2 = using_thumb2 (globals); /* A branch to an undefined weak symbol is turned into a jump to - the next instruction. */ - if (h && h->root.type == bfd_link_hash_undefweak) + the next instruction unless a PLT entry will be created. */ + if (h && h->root.type == bfd_link_hash_undefweak + && !(splt != NULL && h->plt.offset != (bfd_vma) -1)) { bfd_put_16 (input_bfd, 0xe000, hit_data); bfd_put_16 (input_bfd, 0xbf00, hit_data + 2); diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 6ca9266fada..f67cfbd0556 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-14 Joseph Myers + + * ld-arm/thumb2-bl-undefweak.d, ld-arm/thumb2-bl-undefweak.s: New. + * ld-arm/arm-elf.exp: Run thumb2-bl-undefweak test. + 2008-09-30 Alan Modra * ld-elf/extract-symbol-1sec.d: Correct section lma. diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 6075e68d357..665dab19d4a 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -184,6 +184,7 @@ run_dump_test "group-relocs-alu-bad" run_dump_test "group-relocs-ldr-bad" run_dump_test "group-relocs-ldrs-bad" run_dump_test "group-relocs-ldc-bad" +run_dump_test "thumb2-bl-undefweak" run_dump_test "emit-relocs1" # Exclude non-ARM-EABI targets.