ada-lang.c::ada_value_cast: remove unnecessary parentheses
[deliverable/binutils-gdb.git] / bfd / elf.c
index f72182788f9e2c5428fb23b3d951de2502d0f814..02d605c19c0443f69655e4cdafe4e716efda4e13 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1877,7 +1877,7 @@ _bfd_elf_get_symbol_version_string (bfd *abfd, asymbol *symbol,
        {
          Elf_Internal_Verneed *t;
 
-         version_string = "";
+         version_string = _("<corrupt>");
          for (t = elf_tdata (abfd)->verref;
               t != NULL;
               t = t->vn_nextref)
@@ -2011,7 +2011,7 @@ bfd_section_from_shdr (bfd *abfd, unsigned int shindex)
   if (++ nesting > 3)
     {
       /* PR17512: A corrupt ELF binary might contain a recursive group of
-        sections, with each the string indicies pointing to the next in the
+        sections, with each the string indices pointing to the next in the
         loop.  Detect this here, by refusing to load a section that we are
         already in the process of loading.  We only trigger this test if
         we have nested at least three sections deep as normal ELF binaries
@@ -5140,7 +5140,7 @@ elf_sort_sections (const void *arg1, const void *arg2)
     {
       if (TOEND (sec2))
        {
-         /* If the indicies are the same, do not return 0
+         /* If the indices are the same, do not return 0
             here, but continue to try the next comparison.  */
          if (sec1->target_index - sec2->target_index != 0)
            return sec1->target_index - sec2->target_index;
@@ -7235,6 +7235,7 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
       Elf_Internal_Shdr *this_hdr;
       asection *first_section = NULL;
       asection *lowest_section;
+      bfd_boolean no_contents = TRUE;
 
       /* Compute how many sections are in this segment.  */
       for (section = ibfd->sections, section_count = 0;
@@ -7246,6 +7247,8 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
            {
              if (first_section == NULL)
                first_section = section;
+             if (elf_section_type (section) != SHT_NOBITS)
+               no_contents = FALSE;
              section_count++;
            }
        }
@@ -7342,8 +7345,17 @@ copy_elf_program_header (bfd *ibfd, bfd *obfd)
        }
 
       if (map->includes_filehdr && lowest_section != NULL)
-       /* We need to keep the space used by the headers fixed.  */
-       map->header_size = lowest_section->vma - segment->p_vaddr;
+       {
+         /* Try to keep the space used by the headers plus any
+            padding fixed.  If there are sections with file contents
+            in this segment then the lowest sh_offset is the best
+            guess.  Otherwise the segment only has file contents for
+            the headers, and p_filesz is the best guess.  */
+         if (no_contents)
+           map->header_size = segment->p_filesz;
+         else
+           map->header_size = lowest_section->filepos;
+       }
 
       if (!map->includes_phdrs
          && !map->includes_filehdr
This page took 0.026564 seconds and 4 git commands to generate.