From da17376b704177fc4d8fa038169782e28b1f3b24 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Mon, 17 Jan 2011 16:36:43 +0000 Subject: [PATCH] bfd/ * elf32-arm.c (elf32_arm_check_relocs): Check needs_plt rather than h->needs_plt when deciding whether to record a possible dynamic reloc. ld/testsuite/ * ld-arm/arm-rel32.s, ld-arm/arm-rel32.d: New testcase. * ld-arm/arm-elf.exp: Run it. --- bfd/ChangeLog | 5 +++++ bfd/elf32-arm.c | 2 +- ld/testsuite/ChangeLog | 5 +++++ ld/testsuite/ld-arm/arm-elf.exp | 3 +++ ld/testsuite/ld-arm/arm-rel32.d | 12 ++++++++++++ ld/testsuite/ld-arm/arm-rel32.s | 8 ++++++++ 6 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 ld/testsuite/ld-arm/arm-rel32.d create mode 100644 ld/testsuite/ld-arm/arm-rel32.s diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 93291ef98ed..7c513d8a3f1 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-01-17 Richard Sandiford + + * elf32-arm.c (elf32_arm_check_relocs): Check needs_plt rather than + h->needs_plt when deciding whether to record a possible dynamic reloc. + 2011-01-17 Richard Sandiford * elf32-arm.c (elf32_arm_gc_sweep_hook): Remove all registered diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index 8e9e30f8381..54001a32413 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -11576,7 +11576,7 @@ elf32_arm_check_relocs (bfd *abfd, struct bfd_link_info *info, if ((info->shared || htab->root.is_relocatable_executable) && (sec->flags & SEC_ALLOC) != 0 && ((r_type == R_ARM_ABS32 || r_type == R_ARM_ABS32_NOI) - || (h != NULL && ! h->needs_plt + || (h != NULL && ! needs_plt && (! info->symbolic || ! h->def_regular)))) { struct elf_dyn_relocs *p, **head; diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index fd92f261a8d..678b547115d 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-01-17 Richard Sandiford + + * ld-arm/arm-rel32.s, ld-arm/arm-rel32.d: New testcase. + * ld-arm/arm-elf.exp: Run it. + 2011-01-17 Richard Sandiford * ld-arm/gc-thumb-lib.s, ld-arm/gc-thumb.s, diff --git a/ld/testsuite/ld-arm/arm-elf.exp b/ld/testsuite/ld-arm/arm-elf.exp index 9efdaf02cf9..798b2cb5af3 100644 --- a/ld/testsuite/ld-arm/arm-elf.exp +++ b/ld/testsuite/ld-arm/arm-elf.exp @@ -126,6 +126,9 @@ set armelftests { {"arm-rel31" "-static -T arm.ld" "" {arm-rel31.s} {{objdump -s arm-rel31.d}} "arm-rel31"} + {"arm-rel32" "-shared -T arm-dyn.ld" "" {arm-rel32.s} + {{objdump -Rsj.data arm-rel32.d}} + "arm-rel32"} {"arm-call" "-static -T arm.ld" "-meabi=4" {arm-call1.s arm-call2.s} {{objdump -d arm-call.d}} "arm-call"} diff --git a/ld/testsuite/ld-arm/arm-rel32.d b/ld/testsuite/ld-arm/arm-rel32.d new file mode 100644 index 00000000000..919aaa42be4 --- /dev/null +++ b/ld/testsuite/ld-arm/arm-rel32.d @@ -0,0 +1,12 @@ + +.*: file format .* + +DYNAMIC RELOCATION RECORDS +OFFSET +TYPE +VALUE +[^ ]+ R_ARM_REL32 +foo +[^ ]+ R_ARM_REL32 +foo +[^ ]+ R_ARM_JUMP_SLOT +foo + + +Contents of section \.data: + [^ ]+ 00000000 00010000 .* diff --git a/ld/testsuite/ld-arm/arm-rel32.s b/ld/testsuite/ld-arm/arm-rel32.s new file mode 100644 index 00000000000..885b87cdbba --- /dev/null +++ b/ld/testsuite/ld-arm/arm-rel32.s @@ -0,0 +1,8 @@ + .globl foo +foo: + mov pc,lr + bal foo(PLT) + + .data + .word foo-. + .word foo-.+0x100 -- 2.30.2