$OpenBSD: patch-bfd_elf_c,v 1.5 2003/10/11 00:52:22 brad Exp $
--- bfd/elf.c.orig	2003-06-02 16:35:20.000000000 -0400
+++ bfd/elf.c	2003-09-04 02:03:34.000000000 -0400
@@ -4073,9 +4073,12 @@ get_program_header_size (abfd)
       return elf_tdata (abfd)->program_header_size;
     }
 
-  /* Assume we will need exactly two PT_LOAD segments: one for text
-     and one for data.  */
-  segs = 2;
+  /* We used to assume that two PT_LOAD segments would be enough,
+     code and data, with the change to pad the PLT and GOT, this is no
+     longer true. Now there can be several PT_LOAD sections. 7 seems
+     to be enough with BSS_PLT and .rodata-X, where we have text, data,
+     GOT, dynamic, PLT, bss */
+  segs = 7;
 
   s = bfd_get_section_by_name (abfd, ".interp");
   if (s != NULL && (s->flags & SEC_LOAD) != 0)
