Make sure there's space for the PT_OPENBSD_WXNEEDED segment, if requested
authorguenther <guenther@openbsd.org>
Tue, 26 Jul 2016 02:38:12 +0000 (02:38 +0000)
committerguenther <guenther@openbsd.org>
Tue, 26 Jul 2016 02:38:12 +0000 (02:38 +0000)
problem noted by Juan Francisco Cantero Hurtado (iam (at) juanfra.info)
ok deraadt@

gnu/usr.bin/binutils-2.17/bfd/elf.c

index c73238b..2e874b8 100644 (file)
@@ -4731,6 +4731,12 @@ get_program_header_size (bfd *abfd)
       ++segs;
     }
 
+  if (elf_tdata (abfd)->wxneeded)
+    {
+      /* We need a PT_OPENBSD_WXNEEDED segment.  */
+      ++segs;
+    }
+
   for (s = abfd->sections; s != NULL; s = s->next)
     {
       if ((s->flags & SEC_LOAD) != 0