* pe-dll.c (build_filler_bfd): Conform error message to standard.
[deliverable/binutils-gdb.git] / bfd / elfcode.h
index 102b215949c9012c918415e5bf4f8835811e08d1..f7f85ba2056cd786e90fa68413bb7d356a05a51c 100644 (file)
@@ -607,9 +607,6 @@ elf_object_p (bfd *abfd)
        goto got_no_match;
     }
 
-  /* Remember the entry point specified in the ELF file header.  */
-  bfd_set_start_address (abfd, i_ehdrp->e_entry);
-
   if (i_ehdrp->e_shoff != 0)
     {
       bfd_signed_vma where = i_ehdrp->e_shoff;
@@ -791,8 +788,8 @@ elf_object_p (bfd *abfd)
            shindex += SHN_HIRESERVE + 1 - SHN_LORESERVE;
        }
 
-      /* Set up group pointers.  */
-      if (! _bfd_elf_setup_group_pointers (abfd))
+      /* Set up ELF sections for SHF_GROUP and SHF_LINK_ORDER.  */
+      if (! _bfd_elf_setup_sections (abfd))
        goto got_wrong_format_error;
     }
 
@@ -804,6 +801,9 @@ elf_object_p (bfd *abfd)
        goto got_wrong_format_error;
     }
 
+  /* Remember the entry point specified in the ELF file header.  */
+  bfd_set_start_address (abfd, i_ehdrp->e_entry);
+
   /* If we have created any reloc sections that are associated with
      debugging sections, mark the reloc sections as debugging as well.  */
   for (s = abfd->sections; s != NULL; s = s->next)
@@ -875,6 +875,12 @@ elf_write_relocs (bfd *abfd, asection *sec, void *data)
   if (sec->reloc_count == 0)
     return;
 
+  /* If we have opened an existing file for update, reloc_count may be
+     set even though we are not linking.  In that case we have nothing
+     to do.  */
+  if (sec->orelocation == NULL)
+    return;
+
   rela_hdr = &elf_section_data (sec)->rel_hdr;
 
   rela_hdr->sh_size = rela_hdr->sh_entsize * sec->reloc_count;
@@ -1656,7 +1662,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
   for (i = 0; i < i_ehdr.e_phnum; ++i)
     {
       elf_swap_phdr_in (templ, &x_phdrs[i], &i_phdrs[i]);
-      if (i_phdrs[i].p_type == PT_LOAD)
+      /* IA-64 vDSO may have two mappings for one segment, where one mapping
+        is executable only, and one is read only.  We must not use the
+        executable one.  */
+      if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
        {
          bfd_vma segment_end;
          segment_end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
@@ -1703,7 +1712,10 @@ NAME(_bfd_elf,bfd_from_remote_memory)
     }
 
   for (i = 0; i < i_ehdr.e_phnum; ++i)
-    if (i_phdrs[i].p_type == PT_LOAD)
+    /* IA-64 vDSO may have two mappings for one segment, where one mapping
+       is executable only, and one is read only.  We must not use the
+       executable one.  */
+    if (i_phdrs[i].p_type == PT_LOAD && (i_phdrs[i].p_flags & PF_R))
       {
        bfd_vma start = i_phdrs[i].p_offset & -i_phdrs[i].p_align;
        bfd_vma end = (i_phdrs[i].p_offset + i_phdrs[i].p_filesz
This page took 0.023618 seconds and 4 git commands to generate.