summaryrefslogtreecommitdiffstats
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-11-18 04:52:57 +0000
committerAlan Modra <amodra@gmail.com>2005-11-18 04:52:57 +0000
commit220c76ddc0eee77b4165d778be9f6be0d5398d9f (patch)
treef6a4f1075d64206d7672eab52f81bd6afeeb1ec3 /bfd/elf64-ppc.c
parent33ec65816e2f0dad27d9c02ed3e7384d22b314fc (diff)
downloadppe42-binutils-220c76ddc0eee77b4165d778be9f6be0d5398d9f.tar.gz
ppe42-binutils-220c76ddc0eee77b4165d778be9f6be0d5398d9f.zip
* elf64-ppc.c (ppc64_elf_check_relocs): Don't set has_14bit_branch
on branches to same section.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index d15c77230d..65b9c2162b 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -4507,7 +4507,24 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
case R_PPC64_REL14:
case R_PPC64_REL14_BRTAKEN:
case R_PPC64_REL14_BRNTAKEN:
- htab->has_14bit_branch = 1;
+ {
+ asection *dest = NULL;
+
+ /* Heuristic: If jumping outside our section, chances are
+ we are going to need a stub. */
+ if (h != NULL)
+ {
+ /* If the sym is weak it may be overridden later, so
+ don't assume we know where a weak sym lives. */
+ if (h->root.type == bfd_link_hash_defined)
+ dest = h->root.u.def.section;
+ }
+ else
+ dest = bfd_section_from_r_symndx (abfd, &htab->sym_sec,
+ sec, r_symndx);
+ if (dest != sec)
+ htab->has_14bit_branch = 1;
+ }
/* Fall through. */
case R_PPC64_REL24:
OpenPOWER on IntegriCloud