* elf-bfd.h (struct elf_backend_data): Add
[deliverable/binutils-gdb.git] / bfd / elf.c
index 25570eccb96802e92080534d0ce7c8099c9ddcdc..8a725c39edf36e61a8c08842877e9ff6a10f9b97 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -3734,8 +3734,6 @@ elf_modify_segment_map (bfd *abfd, struct bfd_link_info *info)
        m->count = new_count;
     }
 
-  /* Yes, we call elf_backend_modify_segment_map at least two times
-     for the linker.  The final time the link_orders are available.  */
   bed = get_elf_backend_data (abfd);
   if (bed->elf_backend_modify_segment_map != NULL)
     {
@@ -4217,7 +4215,8 @@ assign_file_positions_for_load_sections (bfd *abfd,
   unsigned int alloc;
   unsigned int i;
 
-  if (!elf_modify_segment_map (abfd, link_info))
+  if (link_info == NULL
+      && !elf_modify_segment_map (abfd, link_info))
     return FALSE;
 
   alloc = 0;
@@ -4720,8 +4719,8 @@ assign_file_positions_for_non_load_sections (bfd *abfd,
                  if (lp->p_type == PT_LOAD
                      && lp->p_vaddr <= link_info->relro_end
                      && lp->p_vaddr >= link_info->relro_start
-                     && lp->p_vaddr + lp->p_filesz
-                        >= link_info->relro_end)
+                     && (lp->p_vaddr + lp->p_filesz
+                         >= link_info->relro_end))
                    break;
                }
 
@@ -4823,6 +4822,12 @@ assign_file_positions_except_relocs (bfd *abfd,
       if (!assign_file_positions_for_non_load_sections (abfd, link_info))
        return FALSE;
 
+      if (bed->elf_backend_modify_program_headers != NULL)
+       {
+         if (!(*bed->elf_backend_modify_program_headers) (abfd, link_info))
+           return FALSE;
+       }
+
       /* Write out the program headers.  */
       alloc = tdata->program_header_size / bed->s->sizeof_phdr;
       if (bfd_seek (abfd, (bfd_signed_vma) bed->s->sizeof_ehdr, SEEK_SET) != 0
This page took 0.025735 seconds and 4 git commands to generate.