PowerPC64 ELFv2 entry code
authorAlan Modra <amodra@gmail.com>
Tue, 2 Feb 2016 12:46:14 +0000 (23:16 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 2 Feb 2016 13:29:03 +0000 (23:59 +1030)
This tightens the condition under which ld optimizes PIC entry code
to non-PIC.

bfd/
* elf64-ppc.c (ppc64_elf_relocate_section): Further restrict
ELFv2 entry optimization.
gold/
* powerpc.cc (relocate): Further restrict ELFv2 entry optimization.

bfd/ChangeLog
bfd/elf64-ppc.c
gold/ChangeLog
gold/powerpc.cc

index 898af56..81e751c 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-02  Alan Modra  <amodra@gmail.com>
+
+       * elf64-ppc.c (ppc64_elf_relocate_section): Further restrict
+       ELFv2 entry optimization.
+
 2016-02-02  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR binutils/19547
index f9c37b5..369eae5 100644 (file)
@@ -13915,6 +13915,7 @@ ppc64_elf_relocate_section (bfd *output_bfd,
          if (!bfd_link_pic (info)
              && !info->traditional_format
              && !htab->opd_abi
+             && rel->r_addend == 0
              && h != NULL && &h->elf == htab->elf.hgot
              && rel + 1 < relend
              && rel[1].r_info == ELF64_R_INFO (r_symndx, R_PPC64_REL16_LO)
index 06cafb0..c0b7e56 100644 (file)
@@ -1,3 +1,7 @@
+2016-02-02  Alan Modra  <amodra@gmail.com>
+
+       * powerpc.cc (relocate): Further restrict ELFv2 entry optimization.
+
 2016-01-15 Han Shen  <shenhan@google.com>
 
        PR gold/19472 - need pc-relative stubs.
index e26a198..6df2904 100644 (file)
@@ -7727,6 +7727,7 @@ Target_powerpc<size, big_endian>::Relocate::relocate(
              && preloc != NULL
              && target->abiversion() >= 2
              && !parameters->options().output_is_position_independent()
+             && rela.get_r_addend() == 4
              && gsym != NULL
              && strcmp(gsym->name(), ".TOC.") == 0)
            {