PR21132, hppa-linux pie support doesn't work
authorAlan Modra <amodra@gmail.com>
Thu, 16 Feb 2017 01:53:12 +0000 (12:23 +1030)
committerAlan Modra <amodra@gmail.com>
Thu, 16 Feb 2017 12:24:36 +0000 (22:54 +1030)
This fixes a long-standing hppa bug seen when generating PIEs, and I
think possible to trigger with forced local symbols in shared
libraries.  Not allocating enough space for PLT relocs results in ld
writing outside of the buffer.

PR 21132
* elf32-hppa.c (allocate_plt_static): Allocate space for relocs
if pic.

bfd/ChangeLog
bfd/elf32-hppa.c

index a6a4c646b611bfe229960f511f7f672d402cb281..4be12b802272c8a8130f2f4ebd278687fb6b6c98 100644 (file)
@@ -1,3 +1,9 @@
+2017-02-16  Alan Modra  <amodra@gmail.com>
+
+       PR 21132
+       * elf32-hppa.c (allocate_plt_static): Allocate space for relocs
+       if pic.
+
 2017-02-16  Jiong Wang <jiong.wang@arm.com>
 
        * bfd.c (BFD_FLAGS_SAVED): Add BFD_LINKER_CREATED.
index de14468a27e922e4610e4771a58fa41c3a8ed5e9..e64ea9aff98c1eaf53bd04e6622bb32a3b6b5e4d 100644 (file)
@@ -1976,6 +1976,8 @@ allocate_plt_static (struct elf_link_hash_entry *eh, void *inf)
          sec = htab->etab.splt;
          eh->plt.offset = sec->size;
          sec->size += PLT_ENTRY_SIZE;
+         if (bfd_link_pic (info))
+           htab->etab.srelplt->size += sizeof (Elf32_External_Rela);
        }
       else
        {