aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2022-01-19 13:19:51 +1030
committerAlan Modra <amodra@gmail.com>2022-01-19 16:45:45 +1030
commit8ffb6df2aa60af2fae5378e2520fbf6bdd0b0962 (patch)
tree3ab7df9a0ea08ef13372b813c0599d9bee521e2f /bfd
parentedca615ac1901ddab9beec51a4bcf8395c307109 (diff)
downloadgdb-8ffb6df2aa60af2fae5378e2520fbf6bdd0b0962.zip
gdb-8ffb6df2aa60af2fae5378e2520fbf6bdd0b0962.tar.gz
gdb-8ffb6df2aa60af2fae5378e2520fbf6bdd0b0962.tar.bz2
PowerPC64 DT_RELR ELFv1
More fun with R_PPC64_NONE found in .opd. Fixed by the allocate_dynrelocs and ppc64_elf_size_dynamic_sections changes, and since we are doing ifunc, opd and SYMBOL_REFERENCES_LOCAL tests later, don't duplicate that work in check_relocs. * elf64-ppc.c (ppc64_elf_check_relocs): Remove opd and ifunc conditions for rel_count. (dec_dynrel_count): Likewise. (allocate_dynrelocs): Test for opd and ifunc when allocating relative relocs. (ppc64_elf_size_dynamic_sections): Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elf64-ppc.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index dccd535..05d2d9f 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -5389,8 +5389,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
p->pc_count += 1;
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))
+ && sec->alignment_power != 0)
p->rel_count += 1;
}
else
@@ -5435,8 +5434,7 @@ ppc64_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
p->count += 1;
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) || !is_ifunc))
+ && sec->alignment_power != 0)
p->rel_count += 1;
}
}
@@ -7283,10 +7281,7 @@ dec_dynrel_count (const Elf_Internal_Rela *rel,
p->pc_count -= 1;
if ((r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
&& rel->r_offset % 2 == 0
- && sec->alignment_power != 0
- && ((!NO_OPD_RELOCS
- && ppc64_elf_section_data (sec)->sec_type == sec_opd)
- || h->type != STT_GNU_IFUNC))
+ && sec->alignment_power != 0)
p->rel_count -= 1;
p->count -= 1;
if (p->count == 0)
@@ -7321,10 +7316,7 @@ dec_dynrel_count (const Elf_Internal_Rela *rel,
{
if ((r_type == R_PPC64_ADDR64 || r_type == R_PPC64_TOC)
&& rel->r_offset % 2 == 0
- && sec->alignment_power != 0
- && ((!NO_OPD_RELOCS
- && ppc64_elf_section_data (sec)->sec_type == sec_opd)
- || !is_ifunc))
+ && sec->alignment_power != 0)
p->rel_count -= 1;
p->count -= 1;
if (p->count == 0)
@@ -10014,7 +10006,11 @@ 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 && SYMBOL_REFERENCES_LOCAL (info, h))
+ if (info->enable_dt_relr
+ && ((!NO_OPD_RELOCS
+ && ppc64_elf_section_data (p->sec)->sec_type == sec_opd)
+ || (eh->elf.type != STT_GNU_IFUNC
+ && SYMBOL_REFERENCES_LOCAL (info, h))))
count -= p->rel_count;
sreloc->size += count * sizeof (Elf64_External_Rela);
}
@@ -10264,7 +10260,11 @@ ppc64_elf_size_dynamic_sections (bfd *output_bfd,
asection *srel;
count = p->count;
- if (info->enable_dt_relr)
+ if (info->enable_dt_relr
+ && ((!NO_OPD_RELOCS
+ && (ppc64_elf_section_data (p->sec)->sec_type
+ == sec_opd))
+ || !p->ifunc))
count -= p->rel_count;
srel = elf_section_data (p->sec)->sreloc;
if (p->ifunc)