From 4f038ee5d22f04a16a413cf2e3d8ddeecdc75639 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 4 Feb 2016 00:25:56 +1030 Subject: [PATCH] Fix "PowerPC64 ELFv2 entry code" for big-endian bfd/ * elf64-ppc.c (ppc64_elf_relocate_section): Adjust last patch for big-endian. gold/ * powerpc.cc (relocate): Adjust last patch for big-endian. --- bfd/ChangeLog | 5 +++++ bfd/elf64-ppc.c | 2 +- gold/ChangeLog | 4 ++++ gold/powerpc.cc | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index ff74998aca7..93bfe05ee89 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2016-02-04 Alan Modra + + * elf64-ppc.c (ppc64_elf_relocate_section): Adjust last patch + for big-endian. + 2016-02-02 H.J. Lu PR ld/19542 diff --git a/bfd/elf64-ppc.c b/bfd/elf64-ppc.c index 369eae52f14..f0bcee1687f 100644 --- a/bfd/elf64-ppc.c +++ b/bfd/elf64-ppc.c @@ -13915,7 +13915,7 @@ ppc64_elf_relocate_section (bfd *output_bfd, if (!bfd_link_pic (info) && !info->traditional_format && !htab->opd_abi - && rel->r_addend == 0 + && rel->r_addend == d_offset && h != NULL && &h->elf == htab->elf.hgot && rel + 1 < relend && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_REL16_LO) diff --git a/gold/ChangeLog b/gold/ChangeLog index c0b7e5607a2..ae50474b604 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,7 @@ +2016-02-04 Alan Modra + + * powerpc.cc (relocate): Adjust last patch for big-endian. + 2016-02-02 Alan Modra * powerpc.cc (relocate): Further restrict ELFv2 entry optimization. diff --git a/gold/powerpc.cc b/gold/powerpc.cc index 6df2904b708..60530bab984 100644 --- a/gold/powerpc.cc +++ b/gold/powerpc.cc @@ -7727,7 +7727,7 @@ Target_powerpc::Relocate::relocate( && preloc != NULL && target->abiversion() >= 2 && !parameters->options().output_is_position_independent() - && rela.get_r_addend() == 4 + && rela.get_r_addend() == d_offset + 4 && gsym != NULL && strcmp(gsym->name(), ".TOC.") == 0) { -- 2.30.2