aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elf64-ppc.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 818f580..44286c2 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2021-03-02 Alan Modra <amodra@gmail.com>
+
+ * elf64-ppc.c (ppc64_elf_relocate_section): Don't optimise got
+ indirect to pc-relative or toc-relative for undefined symbols.
+
2021-03-01 Alan Modra <amodra@gmail.com>
Fangrui Song <maskray@google.com>
diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c
index dcd427b..769fff9 100644
--- a/bfd/elf64-ppc.c
+++ b/bfd/elf64-ppc.c
@@ -16081,6 +16081,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
break;
from = TOCstart + htab->sec_info[input_section->id].toc_off;
if (relocation + addend - from + 0x8000 < 0x10000
+ && sec != NULL
+ && sec->output_section != NULL
+ && !discarded_section (sec)
&& (h == NULL || SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
{
insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
@@ -16101,6 +16104,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
break;
from = TOCstart + htab->sec_info[input_section->id].toc_off;
if (relocation + addend - from + 0x80008000ULL < 0x100000000ULL
+ && sec != NULL
+ && sec->output_section != NULL
+ && !discarded_section (sec)
&& (h == NULL || SYMBOL_REFERENCES_LOCAL (info, &h->elf)))
{
insn = bfd_get_32 (input_bfd, contents + (rel->r_offset & ~3));
@@ -16129,6 +16135,9 @@ ppc64_elf_relocate_section (bfd *output_bfd,
+ input_section->output_section->vma
+ input_section->output_offset);
if (!(relocation - from + (1ULL << 33) < 1ULL << 34
+ && sec != NULL
+ && sec->output_section != NULL
+ && !discarded_section (sec)
&& (h == NULL || SYMBOL_REFERENCES_LOCAL (info, &h->elf))))
break;