summaryrefslogtreecommitdiff
path: root/bfd/elf64-ppc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-19 09:35:00 +1030
committerAlan Modra <amodra@gmail.com>2022-01-19 09:44:15 +1030
commit858b0eff3c79fa6217ebf4491e146be23552764d (patch)
treec416582a0a0d282709b3d8d9dc6feec90972c68e /bfd/elf64-ppc.c
parent72a52f2a86f33434a511da11fae0471253df068d (diff)
Re: PowerPC64 DT_RELR
HJ: "There are 238 R_PPC64_NONEs in libc.so.6 alone." Indeed, let's make them go away. I had the SYMBOL_REFERENCES_LOCAL test in the wrong place. check_relocs is too early to know whether a symbol is dynamic in a shared library. Lots of glibc symbols are made local by version script, but that doesn't happen until size_dynamic_sections. * elf64-ppc.c (ppc64_elf_check_relocs): Don't count relative relocs here depending on SYMBOL_REFERENCES_LOCAL. (dec_dynrel_count): Likewise. (allocate_dynrelocs): Do so here instead.
Diffstat (limited to 'bfd/elf64-ppc.c')
-rw-r--r--bfd/elf64-ppc.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index 923c7a3b40..aeae3b7e64 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -5390,8 +5390,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
if ((r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
&& rel->r_offset % 2 == 0
&& sec->alignment_power != 0
- && ((!NO_OPD_RELOCS && is_opd)
- || (!ifunc && SYMBOL_REFERENCES_LOCAL (info, h))))
+ && ((!NO_OPD_RELOCS && is_opd) || !ifunc))
p->rel_count += 1;
}
else
@@ -7287,8 +7286,7 @@ dec_dynrel_count (const Elf_Internal_Rela *rel,
&& sec->alignment_power != 0
&& ((!NO_OPD_RELOCS
&& ppc64_elf_section_data (sec)->sec_type == sec_opd)
- || (h->type != STT_GNU_IFUNC
- && SYMBOL_REFERENCES_LOCAL (info, h))))
+ || h->type != STT_GNU_IFUNC))
p->rel_count -= 1;
p->count -= 1;
if (p->count == 0)
@@ -10016,7 +10014,7 @@ allocate_dynrelocs (struct elf_link_hash_entry *h, void *inf)
if (eh->elf.type == STT_GNU_IFUNC)
sreloc = htab->elf.irelplt;
count = p->count;
- if (info->enable_dt_relr)
+ if (info->enable_dt_relr && SYMBOL_REFERENCES_LOCAL (info, h))
count -= p->rel_count;
sreloc->size += count * sizeof (Elf64_External_Rela);
}