* elf32-mips.c: Extensive changes for a start at dynamic linking
[deliverable/binutils-gdb.git] / bfd / elf.c
index a7bdf5cbb762e54d021eca7a52581c320e655301..05254ff68f353a759339e8b89df100758b397d1f 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -576,6 +576,7 @@ bfd_section_from_shdr (abfd, shindex)
     case SHT_DYNAMIC:  /* Dynamic linking information.  */
     case SHT_NOBITS:   /* .bss section.  */
     case SHT_HASH:     /* .hash section.  */
+    case SHT_NOTE:     /* .note section.  */
       return _bfd_elf_make_section_from_shdr (abfd, hdr, name);
 
     case SHT_SYMTAB:           /* A symbol table */
@@ -752,9 +753,6 @@ bfd_section_from_shdr (abfd, shindex)
       }
       break;
 
-    case SHT_NOTE:
-      break;
-
     case SHT_SHLIB:
       return true;
 
@@ -1746,6 +1744,12 @@ assign_file_positions_for_segments (abfd)
        return false;
     }
 
+  if (bed->elf_backend_modify_segment_map)
+    {
+      if (! (*bed->elf_backend_modify_segment_map) (abfd))
+       return false;
+    }
+
   count = 0;
   for (m = elf_tdata (abfd)->segment_map; m != NULL; m = m->next)
     ++count;
@@ -1757,11 +1761,6 @@ assign_file_positions_for_segments (abfd)
   if (count == 0)
     return true;
 
-  /* Let the backend count up any program headers it might need.  */
-  if (bed->elf_backend_create_program_headers)
-    count = ((*bed->elf_backend_create_program_headers)
-            (abfd, (Elf_Internal_Phdr *) NULL, count));
-
   /* If we already counted the number of program segments, make sure
      that we allocated enough space.  This happens when SIZEOF_HEADERS
      is used in a linker script.  */
@@ -1978,11 +1977,6 @@ assign_file_positions_for_segments (abfd)
        }
     }
 
-  /* Let the backend set up any program headers it might need.  */
-  if (bed->elf_backend_create_program_headers)
-    count = ((*bed->elf_backend_create_program_headers)
-            (abfd, phdrs, count));
-
   /* Clear out any program headers we allocated but did not use.  */
   for (; count < alloc; count++, p++)
     {
@@ -2057,9 +2051,15 @@ get_program_header_size (abfd)
     }
 
   /* Let the backend count up any program headers it might need.  */
-  if (bed->elf_backend_create_program_headers)
-    segs = ((*bed->elf_backend_create_program_headers)
-           (abfd, (Elf_Internal_Phdr *) NULL, segs));
+  if (bed->elf_backend_additional_program_headers)
+    {
+      int a;
+
+      a = (*bed->elf_backend_additional_program_headers) (abfd);
+      if (a == -1)
+       abort ();
+      segs += a;
+    }
 
   elf_tdata (abfd)->program_header_size = segs * bed->s->sizeof_phdr;
   return elf_tdata (abfd)->program_header_size;
This page took 0.024349 seconds and 4 git commands to generate.